Rethinking Repetition Problems of LLMs in Code Generation

要約

神経言語モデルの出現により、コード生成のパフォーマンスが大幅に向上しました。
ただし、生成プロセス中の繰り返しの問題は長続きし続けています。
以前の作業は主にコンテンツの繰り返しに焦点を当ててきました。これは、コード生成におけるより広範な繰り返し問題のほんの一部にすぎません。
より一般的で挑戦的な問題は、構造的な繰り返しです。
構造の繰り返しでは、繰り返されるコードはさまざまなパターンで表示されますが、固定構造を所有しており、これは本質的に文法に反映されます。
この論文では、構造的繰り返しを正式に定義し、LLMSのコード生成の繰り返し問題を軽減するために、文法に基づく繰り返しの罰則を表すRPGと呼ばれる効率的なデコードアプローチを提案します。
具体的には、RPGは最初に文法規則を活用してコード生成中の繰り返しの問題を特定し、その後、繰り返しに寄与する重要なトークンの可能性を戦略的に減少させ、それによってコード生成でそれらを軽減します。
この研究を促進するために、コード生成における繰り返しの問題を緩和するためのアプローチを包括的に評価するために、新しいデータセットCODEREPETEVALを構築します。
大規模な実験結果は、RPGがCoderepeteval DatasetおよびHumanevalおよびMBPPベンチマークで最もパフォーマンスの高いベースラインを大幅に上回り、繰り返しを効果的に削減し、生成されたコードの品質を向上させることを示しています。

要約(オリジナル)

With the advent of neural language models, the performance of code generation has been significantly boosted. However, the problem of repetitions during the generation process continues to linger. Previous work has primarily focused on content repetition, which is merely a fraction of the broader repetition problem in code generation. A more prevalent and challenging problem is structural repetition. In structural repetition, the repeated code appears in various patterns but possesses a fixed structure, which can be inherently reflected in grammar. In this paper, we formally define structural repetition and propose an efficient decoding approach called RPG, which stands for Repetition Penalization based on Grammar, to alleviate the repetition problems in code generation for LLMs. Specifically, RPG first leverages grammar rules to identify repetition problems during code generation, and then strategically decays the likelihood of critical tokens that contribute to repetitions, thereby mitigating them in code generation. To facilitate this study, we construct a new dataset CodeRepetEval to comprehensively evaluate approaches for mitigating the repetition problems in code generation. Extensive experimental results demonstrate that RPG substantially outperforms the best-performing baselines on CodeRepetEval dataset as well as HumanEval and MBPP benchmarks, effectively reducing repetitions and enhancing the quality of generated code.

arxiv情報

著者 Yihong Dong,Yuchen Liu,Xue Jiang,Zhi Jin,Ge Li
発行日 2025-05-15 15:26:32+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL, cs.LG, cs.SE パーマリンク