Execution Guided Line-by-Line Code Generation

要約

言語モデル生成プロセスにリアルタイムの実行信号を組み込んだニューラルコード生成への新しいアプローチを提示します。
大規模な言語モデル(LLM)は印象的なコード生成機能を実証していますが、通常、人間のプログラマーが定期的に活用する重要なシグナルである推論中に実行フィードバックを利用しません。
私たちの方法である実行ガイド付き分類器フリーガイダンス(EG-CFG)は、モデルがコードを生成するときに実行プロセスをガイドするラインバイラインフィードバックを提供すると、モデルがコードを生成するときに実行シグナルを動的に組み込みます。
EG-CFGはマルチステージプロセスを採用しています。まず、各行の候補プログラムの完了をサンプリングするためにビーム検索を行います。
第二に、これらの候補者をテストケースに対して実行することにより、実行信号を抽出します。
そして最後に、これらの信号を生成中にプロンプ​​トに組み込みます。
同じライン内のトークン全体で一貫した信号を維持し、ライン境界でリフレッシュする信号を維持することにより、このアプローチは構文構造を保存しながら一貫したガイダンスを提供します。
さらに、この方法は、複数のエージェントが並行して動作し、多様な推論パスを調査し、幅広い候補ソリューションを集合的に生成するタスクレベルでのネイティブ並列性を自然にサポートします。
多様なコーディングタスク全体の実験は、EG-CFGが標準的なアプローチと比較してコード生成パフォーマンスを大幅に改善し、基礎的な問題から競争の激しいプログラミングタスクまで、さまざまなレベルの複雑さにわたって最先端の結果を達成することを示しています。
私たちのコードは、https://github.com/boazlavon/eg_cfgで入手できます

要約(オリジナル)

We present a novel approach to neural code generation that incorporates real-time execution signals into the language model generation process. While large language models (LLMs) have demonstrated impressive code generation capabilities, they typically do not utilize execution feedback during inference, a critical signal that human programmers regularly leverage. Our method, Execution-Guided Classifier-Free Guidance (EG-CFG), dynamically incorporates execution signals as the model generates code, providing line-by-line feedback that guides the generation process toward executable solutions. EG-CFG employs a multi-stage process: first, we conduct beam search to sample candidate program completions for each line; second, we extract execution signals by executing these candidates against test cases; and finally, we incorporate these signals into the prompt during generation. By maintaining consistent signals across tokens within the same line and refreshing signals at line boundaries, our approach provides coherent guidance while preserving syntactic structure. Moreover, the method naturally supports native parallelism at the task level in which multiple agents operate in parallel, exploring diverse reasoning paths and collectively generating a broad set of candidate solutions. Our experiments across diverse coding tasks demonstrate that EG-CFG significantly improves code generation performance compared to standard approaches, achieving state-of-the-art results across various levels of complexity, from foundational problems to challenging competitive programming tasks. Our code is available at: https://github.com/boazlavon/eg_cfg

arxiv情報

著者 Boaz Lavon,Shahar Katz,Lior Wolf
発行日 2025-06-12 17:50:05+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.LG パーマリンク