arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.11930cs.SEcs.AIcs.CL
收藏

关于代码大语言模型(Code-LLMs)学到与未学到内容的批判性研究

A Critical Study of What Code-LLMs (Do Not) Learn

Technische Universität Darmstadt(达姆施塔特工业大学);AI Quality & Testing Hub(AI质量与测试中心);Hessian Center for Artificial Intelligence(黑森人工智能中心);National Research Center for Applied Cybersecurity ATHENE(国家应用网络安全研究中心ATHENE)

Abhinav Anand, Shweta Verma, Krishna Narasimhan, Mira Mezini

AI总结:

本研究通过细粒度分析代码大语言模型的注意力图与隐藏表示,发现其仅能编码语法词元、标识符各自内部的关系,无法编码二者间的关系,且微调模型和超大规模模型的编码能力反而更弱。

摘要:

在代码语料库上训练的大语言模型(code-LLMs)已在各类代码辅助任务中展现出优异性能。然而,尽管模型规模和训练数据集不断扩大,code-LLMs仍存在局限性,例如生成的代码存在语法错误、变量误用等问题。部分研究认为,code-LLMs在代码任务上表现出色,是因为它们利用自注意力机制和隐藏表示来编码输入词元之间的关系。但此前的研究尚未探究code-LLMs未编码哪些代码属性。\n本文对code-LLMs的注意力图和隐藏表示开展了细粒度分析。研究表明,code-LLMs仅编码输入词元特定子集之间的关系。具体而言,通过将输入词元分为语法词元和标识符两类,我们发现模型能够编码语法词元之间以及标识符之间的关系,但无法编码语法词元与标识符之间的关系。我们还发现,与预训练模型相比,微调后的模型对这些关系的编码能力更差。此外,拥有数十亿参数的更大模型所编码的代码信息,显著少于仅数亿参数的模型。

英文摘要:

Large Language Models trained on code corpora (code-LLMs) have demonstrated impressive performance in various coding assistance tasks. However, despite their increased size and training dataset, code-LLMs still have limitations such as suggesting codes with syntactic errors, variable misuse etc. Some studies argue that code-LLMs perform well on coding tasks because they use self-attention and hidden representations to encode relations among input tokens. However, previous works have not studied what code properties are not encoded by code-LLMs. In this paper, we conduct a fine-grained analysis of attention maps and hidden representations of code-LLMs. Our study indicates that code-LLMs only encode relations among specific subsets of input tokens. Specifically, by categorizing input tokens into syntactic tokens and identifiers, we found that models encode relations among syntactic tokens and among identifiers, but they fail to encode relations between syntactic tokens and identifiers. We also found that fine-tuned models encode these relations poorly compared to their pre-trained counterparts. Additionally, larger models with billions of parameters encode significantly less information about code than models with only a few hundred million parameters.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑