On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality
作者: Xin Shen, San-Zhuo Xi, Yali Du, Ming Li
分类: cs.SE, cs.CL, cs.LG
发布日期: 2026-09-22
备注: 27 pages, 9 figures, 12 tables. Submitted to an ACM journal in September 2025. Preprint; manuscript under review. Corresponding author: Ming Li
💡 一句话要点
提出Face/Off框架以解决大语言模型对代码标识符的过度依赖问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 代码理解 标识符重命名 语义保持 模型评估 程序结构 词汇线索
📋 核心要点
- 现有大型语言模型在代码理解任务中对标识符名称的过度依赖,导致其在信息不可靠时表现不佳。
- 论文提出Face/Off框架,通过语义保持的标识符重命名方法,评估不同命名条件对模型性能的影响。
- 实验结果显示,随着标识符信息的减少,模型性能显著下降,表明词汇过度强调是一个根深蒂固的问题。
📝 摘要(中文)
近年来,大型语言模型(LLMs)在代码相关任务中的应用日益广泛。标识符名称在自然代码中具有统计信息,但其信息并不总是可靠。本文研究了当前LLMs在重命名时是否过度依赖词汇线索,提出了Face/Off框架,该框架在多个模型和代码理解任务中评估了逐步命名条件。研究发现,词汇过度强调在评估的模型和主要任务中普遍存在,随着标识符信息的移除或误导,性能普遍下降,输出往往受到误导性名称的影响。这些结果表明,当前LLMs在平衡词汇线索与程序结构方面存在系统性脆弱性。
🔬 方法详解
问题定义:本文旨在解决当前大型语言模型在代码理解中对标识符名称的过度依赖问题。现有方法在标识符信息不可靠时,模型性能显著下降,缺乏对程序结构的有效理解。
核心思路:论文提出Face/Off框架,旨在通过语义保持的标识符重命名,评估模型在不同命名条件下的表现,从而揭示词汇线索的影响。
技术框架:该框架包括多个模块,首先进行标识符重命名,然后在不同的模型和任务上进行评估,最后分析模型输出与命名条件的关系。
关键创新:最重要的创新在于引入了语义保持的重命名方法,系统性地评估了词汇线索对模型性能的影响,揭示了当前LLMs在处理代码时的脆弱性。
关键设计:在实验中,设计了不同的命名条件,并通过类型推断控制实验,确认了命名效应的边界,确保了实验结果的可靠性。具体的参数设置和损失函数设计未在摘要中详细说明,需参考原文获取更多技术细节。
🖼️ 关键图片
📊 实验亮点
实验结果表明,随着标识符信息的移除,模型性能普遍下降,尤其在误导性名称的情况下,输出更倾向于错误的语义理解。这一现象在多个模型和任务中均得到了验证,显示出词汇过度强调的普遍性和严重性。
🎯 应用场景
该研究的潜在应用领域包括代码自动重构、代码审查工具以及智能编程助手等。通过改善大型语言模型对代码结构的理解,能够提升代码生成和理解的准确性,进而提高开发效率和代码质量。未来,研究成果可能推动更智能的编程工具的发展。
📄 摘要(原文)
Recent advances in large language models (LLMs) have made them widely used for code-related tasks. Identifier names are statistically informative in naturally occurring code, but their information is not always reliable. We investigate whether current LLMs assign disproportionate weight to lexical cues when renaming preserves program structure. We introduce Face/Off, a semantics-preserving identifier-renaming framework, and evaluate progressive naming conditions across multiple models and code-comprehension tasks. Within this framework, lexical overemphasis is pervasive across the evaluated models and primary tasks: performance generally decreases as identifier information is removed or made misleading, and outputs are often directed toward the meanings suggested by misleading names. The pattern persists under representative prompt- and fine-tuning-based interventions, suggesting that lexical overemphasis is an entrenched problem. A type-inference control confirms a boundary: naming effects are smaller when the answer is locally recoverable without the target name. These results do not imply that identifiers are unhelpful; rather, they reveal a systematic vulnerability in how current LLMs balance lexical cues against program structure. Our findings motivate evaluations and modeling methods that preserve the benefits of natural code regularities while keeping conclusions grounded in accurate, formalized code semantics.