arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.12236cs.LGcs.AI
收藏

通过可能性与通过率优先的经验回放增强用于代码生成的LLM智能体

Enhancing LLM Agents for Code Generation with Possibility and Pass-rate Prioritized Experience Replay

School of Computer Science, Wuhan University(武汉大学计算机学院);Northwestern University(西北大学);University of Macau(澳门大学)

Yuyang Chen, Kaiyan Zhao, Yiming Wang, Ming Yang, Jian Zhang, Xiaoguang Niu

AI总结:

针对代码生成中LLM因稀疏奖励采样冗余程序效率低的问题,提出含束搜索采样、测试、优先经验回放三阶段的BTP流水线,用综合输出可能性与通过率的P2Value筛选回放程序,提升了多个LLM的代码生成性能。

摘要:

如今,用于代码生成任务的基于Transformer的大语言模型(LLM)通常采用采样与过滤流水线。由于单token错误导致代码生成任务存在稀疏奖励问题,基于Transformer的模型会采样大量冗余程序,直到找到正确的程序,进而导致效率低下。为克服这一挑战,我们在微调阶段引入经验回放(Experience Replay,ER)机制,将生成的代码和程序存储起来并进行回放,使LLM智能体有机会从过往经验中学习。基于ER的核心思想,我们提出了一种名为BTP流水线的新方法,该方法包含三个阶段:束搜索采样、测试阶段和优先经验回放阶段。该方法利用代码模型收集的失败程序,从回放缓冲区中回放具有高可能性与通过率优先值(P2Value)的程序,以提升效率。P2Value综合考虑Transformer输出的可能性和通过率,能够利用LLM收集的大多数程序无法通过任何测试这一问题所产生的冗余资源。我们在多个LLM上对所提方法进行了实证验证,结果表明该方法提升了模型在代码生成任务上的性能,且优于现有基线方法。

英文摘要:

Nowadays transformer-based Large Language Models (LLM) for code generation tasks usually apply sampling and filtering pipelines. Due to the sparse reward problem in code generation tasks caused by one-token incorrectness, transformer-based models will sample redundant programs till they find a correct one, leading to low efficiency. To overcome the challenge, we incorporate Experience Replay (ER) in the fine-tuning phase, where codes and programs produced are stored and will be replayed to give the LLM agent a chance to learn from past experiences. Based on the spirit of ER, we introduce a novel approach called BTP pipeline which consists of three phases: beam search sampling, testing phase, and prioritized experience replay phase. The approach makes use of failed programs collected by code models and replays programs with high Possibility and Pass-rate Prioritized value (P2Value) from the replay buffer to improve efficiency. P2Value comprehensively considers the possibility of transformers' output and pass rate and can make use of the redundant resources caused by the problem that most programs collected by LLMs fail to pass any tests. We empirically apply our approach in several LLMs, demonstrating that it enhances their performance in code generation tasks and surpasses existing baselines.

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

↑