Large Language Models (LLM) are a new class of computation engines, "programmed" via prompt engineering. We are still learning how to best "program" these LLMs to help developers. We start with the intuition that developers tend to consciously and unconsciously have a collection of semantics facts in mind when working on coding tasks. Mostly these are shallow, simple facts arising from a quick read. For a function, examples of facts might include parameter and local variable names, return expressions, simple pre- and post-conditions, and basic control and data flow, etc. One might assume that the powerful multi-layer architecture of transformer-style LLMs makes them inherently capable of doing this simple level of "code analysis" and extracting such information, implicitly, while processing code: but are they, really? If they aren't, could explicitly adding this information help? Our goal here is to investigate this question, using the code summarization task and evaluate whether automatically augmenting an LLM's prompt with semantic facts explicitly, actually helps. Prior work shows that LLM performance on code summarization benefits from few-shot samples drawn either from the same-project or from examples found via information retrieval methods (such as BM25). While summarization performance has steadily increased since the early days, there is still room for improvement: LLM performance on code summarization still lags its performance on natural-language tasks like translation and text summarization. We find that adding semantic facts actually does help! This approach improves performance in several different settings suggested by prior work, including for two different Large Language Models. In most cases, improvement nears or exceeds 2 BLEU; for the PHP language in the challenging CodeSearchNet dataset, this augmentation actually yields performance surpassing 30 BLEU.


翻译:大型语言模型(LLM)是一种新型计算引擎,通过提示工程进行“编程”。我们仍在探索如何最佳地“编程”这些LLM以帮助开发者。我们基于一个直觉:开发者在处理编码任务时,会有意或无意地在脑海中保留一系列语义事实。这些大多是快速阅读产生的浅层、简单事实。以函数为例,这些事实可能包括参数和局部变量名称、返回表达式、简单的前置和后置条件、基本控制流和数据流等。人们可能会假设,Transformer风格LLM的强大多层架构使其天生具备处理这种简单“代码分析”并隐式提取此类信息的能力,但事实果真如此吗?如果并非如此,显式添加这些信息是否有帮助?本文旨在通过代码摘要任务探究这一问题,评估将语义事实显式自动增强到LLM提示中是否真正有效。先前研究表明,LLM在代码摘要任务中的性能受益于从同一项目中抽取的少样本示例,或通过信息检索方法(如BM25)找到的样本。虽然自早期以来摘要性能稳步提升,但仍存在改进空间:LLM在代码摘要上的性能仍落后于其在翻译和文本摘要等自然语言任务上的表现。我们发现添加语义事实确实有效!该方法在先前研究建议的多种不同设置下均能提升性能,包括针对两种不同的大型语言模型。在大多数情况下,提升幅度接近或超过2个BLEU;对于具有挑战性的CodeSearchNet数据集中的PHP语言,这种增强甚至使性能超过30 BLEU。

0
下载
关闭预览

相关内容

【MIT博士论文】可部署的鲁棒文本分类器
专知会员服务
27+阅读 · 2023年5月4日
专知会员服务
36+阅读 · 2020年11月29日
注意力图神经网络的小样本学习
专知会员服务
192+阅读 · 2020年7月16日
零样本文本分类,Zero-Shot Learning for Text Classification
专知会员服务
97+阅读 · 2020年5月31日
论文浅尝 | Language Models (Mostly) Know What They Know
开放知识图谱
2+阅读 · 2022年11月18日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
综述:Image Caption 任务之语句多样性
PaperWeekly
22+阅读 · 2018年11月30日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
3+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
2+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
1+阅读 · 2009年12月31日
国家自然科学基金
2+阅读 · 2009年12月31日
国家自然科学基金
3+阅读 · 2008年12月31日
Arxiv
0+阅读 · 2023年6月1日
Arxiv
39+阅读 · 2021年11月11日
Arxiv
15+阅读 · 2019年11月26日
VIP会员
最新内容
现代战争的隐蔽系统:伊朗战争十大启示
专知会员服务
0+阅读 · 今天3:58
ICML 2026 | 自回归Boltzmann生成器重塑分子采样
专知会员服务
3+阅读 · 6月26日
GNN跨域综述:从消息传递到图基础模型
专知会员服务
4+阅读 · 6月26日
无人机自主控制与人工智能:系统性综述
专知会员服务
12+阅读 · 6月26日
巡飞弹与反无人机系统——现代战场的两大支柱
《打造“黄金舰队”》57页报告
专知会员服务
4+阅读 · 6月26日
《北约数字教官网络发展路径》128页报告
专知会员服务
3+阅读 · 6月26日
ECCV 2026 | MIMFlow:MIM与归一化流统一图像生成
专知会员服务
7+阅读 · 6月25日
网状网络及其在军事领域的运用
专知会员服务
8+阅读 · 6月25日
无美国参与的欧洲战争方式(万字长文)
专知会员服务
8+阅读 · 6月25日
相关VIP内容
相关资讯
论文浅尝 | Language Models (Mostly) Know What They Know
开放知识图谱
2+阅读 · 2022年11月18日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
综述:Image Caption 任务之语句多样性
PaperWeekly
22+阅读 · 2018年11月30日
相关基金
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
3+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
2+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
1+阅读 · 2009年12月31日
国家自然科学基金
2+阅读 · 2009年12月31日
国家自然科学基金
3+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员