GALLa: Graph Aligned Large Language Models for Improved Source Code Understanding

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Zhang, Ziyin, Yu, Hang, Li, Shijie, Di, Peng, Li, Jianguo, Wang, Rui
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866911170021031936
author Zhang, Ziyin
Yu, Hang
Li, Shijie
Di, Peng
Li, Jianguo
Wang, Rui
author_facet Zhang, Ziyin
Yu, Hang
Li, Shijie
Di, Peng
Li, Jianguo
Wang, Rui
contents Programming languages possess rich semantic information - such as data flow - that is represented by graphs and not available from the surface form of source code. Recent code language models have scaled to billions of parameters, but model source code solely as text tokens while ignoring any other structural information. Conversely, models that do encode structural information of code make modifications to the Transformer architecture, limiting their scale and compatibility with pretrained LLMs. In this work, we take the best of both worlds with GALLa - Graph Aligned Large Language Models. GALLa utilizes graph neural networks and cross-modal alignment technologies to inject the structural information of code into LLMs as an auxiliary task during finetuning. This framework is both model-agnostic and task-agnostic, as it can be applied to any code LLM for any code downstream task, and requires the structural graph data only at training time from a corpus unrelated to the finetuning data, while incurring no cost at inference time over the baseline LLM. Experiments on five code tasks with seven different baseline LLMs ranging in size from 350M to 14B validate the effectiveness of GALLa, demonstrating consistent improvement over the baseline, even for powerful models such as LLaMA3 and Qwen2.5-Coder.
format Preprint
id arxiv_https___arxiv_org_abs_2409_04183
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle GALLa: Graph Aligned Large Language Models for Improved Source Code Understanding
Zhang, Ziyin
Yu, Hang
Li, Shijie
Di, Peng
Li, Jianguo
Wang, Rui
Computation and Language
Artificial Intelligence
Programming languages possess rich semantic information - such as data flow - that is represented by graphs and not available from the surface form of source code. Recent code language models have scaled to billions of parameters, but model source code solely as text tokens while ignoring any other structural information. Conversely, models that do encode structural information of code make modifications to the Transformer architecture, limiting their scale and compatibility with pretrained LLMs. In this work, we take the best of both worlds with GALLa - Graph Aligned Large Language Models. GALLa utilizes graph neural networks and cross-modal alignment technologies to inject the structural information of code into LLMs as an auxiliary task during finetuning. This framework is both model-agnostic and task-agnostic, as it can be applied to any code LLM for any code downstream task, and requires the structural graph data only at training time from a corpus unrelated to the finetuning data, while incurring no cost at inference time over the baseline LLM. Experiments on five code tasks with seven different baseline LLMs ranging in size from 350M to 14B validate the effectiveness of GALLa, demonstrating consistent improvement over the baseline, even for powerful models such as LLaMA3 and Qwen2.5-Coder.
title GALLa: Graph Aligned Large Language Models for Improved Source Code Understanding
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2409.04183