arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.22368cs.SEcs.AI

EyeLayer:将人类注意力模式整合到基于LLM的代码摘要中

EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarization

Vanderbilt University(范德比尔特大学)

Jiahao Zhang, Yifan Zhang, Kevin Leach, Yu Huang

AI总结:

EyeLayer通过整合人类眼动模式提升LLM代码摘要效果,实现13.17%的BLEU-4提升。

摘要:

代码摘要任务是生成源代码的自然语言描述,这对于软件理解和维护至关重要。尽管大型语言模型(LLMs)在该任务上取得了显著进展,但仍然存在一个开放性问题:人类在代码理解方面的专业知识能否进一步指导和增强这些模型?我们提出了EyeLayer,一个轻量级的注意力增强模块,该模块将人类眼动模式作为人类专业知识的代理,整合到基于LLM的代码摘要中。EyeLayer通过多模态高斯混合模型模拟代码阅读过程中的人类注意力,根据学习到的参数(μ_i,σ_i²)重新分配令牌嵌入,这些参数捕捉了开发者关注的位置和强度。这种设计使我们能够从眼动数据中学习通用的注意力先验,并无缝地将它们整合到LLMs中,而不会干扰现有的表示。我们评估了EyeLayer在不同的模型家族(即LLaMA-3.2、Qwen3和CodeBERT)上的表现,这些模型涵盖了不同的规模和架构。EyeLayer在标准指标上始终优于强大的微调基线,最高在BLEU-4上实现了13.17%的提升。这些结果表明,人类眼动模式编码了互补的注意力信号,可以增强LLMs的语义聚焦,并在不同的模型上有效转移用于代码摘要。

英文摘要:

Code summarization is the task of generating natural language descriptions of source code, which is critical for software comprehension and maintenance. While large language models (LLMs) have achieved remarkable progress on this task, an open question remains: can human expertise in code understanding further guide and enhance these models? We propose EyeLayer, a lightweight attention-augmentation module that incorporates human eye-gaze patterns, as a proxy of human expertise, into LLM-based code summarization. EyeLayer models human attention during code reading via a Multimodal Gaussian Mixture, redistributing token embeddings based on learned parameters (μ_i, σ_i^2) that capture where and how intensively developers focus. This design enables learning generalizable attention priors from eye-tracking data and incorporating them into LLMs seamlessly, without disturbing existing representations. We evaluate EyeLayer across diverse model families (i.e., LLaMA-3.2, Qwen3, and CodeBERT) covering different scales and architectures. EyeLayer consistently outperforms strong fine-tuning baselines across standard metrics, achieving gains of up to 13.17% on BLEU-4. These results demonstrate that human gaze patterns encode complementary attention signals that enhance the semantic focus of LLMs and transfer effectively across diverse models for code summarization.

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

↑