paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Preference-Guided Refactored Tuning for Retrieval Augmented Code Generation

面向检索增强代码生成的偏好引导重构式调优
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 2/10 · 论文聚焦检索增强代码生成中的信息冗余与检索器-生成器偏好差距,属于LLM辅助代码生成,并未涉及静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也未面向Agentic程序分析。因此与用户核心研究方向关联较弱。引用 24 inbox
Xinyu Gao, Yun Xiong, Deze Wang, Zhenhan Guan, Zejian Shi, Haofen Wang, Shanshan Li
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出RRG框架,在检索器与生成器之间加入代码重构器,消除冗余并弥合偏好差距,提升代码生成效果与效率。

检索增强代码生成借助检索器为大语言模型提供相关代码与文档,但存在两个主要限制:一是无关冗余信息会被盲目引入,浪费资源并误导生成器;二是检索器与生成器的优化目标不同,导致两者偏好的“金标准”代码不一致,形成偏好差距,且不同生成器因预训练知识差异而有不同偏好。为此,本文提出RRG(Retrieve, Refactor, Generate)框架,在检索器与生成器之间引入代码重构器,将原始检索代码转换为更简洁、高效且模型友好的版本,去除冗余与噪声并缩短输入长度,从而以更低推理成本获得更高质量的上下文。多数据集实验证实了偏好差距的存在,并显示RRG能有效弥合该差距,最高提升EM 28%、BLEU 13%、CodeBLEU 6.8%。

问题
检索增强代码生成中,检索信息冗余以及检索器与生成器之间的偏好差距会导致生成效果与效率次优。
方法
提出RRG框架,在检索器与生成器之间加入代码重构器,将检索到的原始代码重构为更简洁、高效且模型友好的版本,以去除冗余噪声并缩短输入。
评估
在多个数据集上进行实验,验证了检索器与生成器之间偏好差距的存在,并显示RRG能弥合该差距,在EM、BLEU和CodeBLEU上取得最高28%、13%和6.8%的提升。
原文摘要(Abstract)

Retrieval-augmented code generation utilizes Large Language Models as the generator and significantly expands their code generation capabilities by providing relevant code, documentation, and more via the retriever. The current approach suffers from two primary limitations: 1) information redundancy. The indiscriminate inclusion of redundant information can result in resource wastage and may misguide generators, affecting their effectiveness and efficiency. 2) preference gap. Due to different optimization objectives, the retriever strives to procure code with higher ground truth similarity, yet this effort does not substantially benefit the generator. The retriever and the generator may prefer different golden code, and this gap in preference results in a suboptimal design. Additionally, differences in parameterization knowledge acquired during pre-training result in varying preferences among different generators.To address these limitations, in this paper, we propose RRG (Retrieve, Refactor, Generate), a novel framework for effective and efficient code generation. This framework introduces a code refactorer module between the retriever and the generator to bridge them. The refactoring process transforms the raw retrieved code into a more concise, efficient, and model-friendly version. It eliminates redundant information and noise, reducing the input length. Consequently, the generator receives higher-quality context, enabling it to produce more accurate results with lower inference costs. We conducted comprehensive experiments on multiple datasets. In the experiments, we confirmed the existence of a preference gap between the retriever and the generator, and RRG effectively bridges this gap. Specifically, RRG achieved significant performance improvements, with increases of up to 28% on EM, 13% on BLEU, and 6.8% on CodeBLEU.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2409-15895,
  title = {Preference-Guided Refactored Tuning for Retrieval Augmented Code Generation},
  author = {Xinyu Gao and Yun Xiong and Deze Wang and Zhenhan Guan and Zejian Shi and Haofen Wang and Shanshan Li},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3694987}
}