事前学習済み言語モデルを用いたコード実行
Code Execution with Pre-trained Language Models
May 8, 2023
著者: Chenxiao Liu, Shuai Lu, Weizhu Chen, Daxin Jiang, Alexey Svyatkovskiy, Shengyu Fu, Neel Sundaresan, Nan Duan
cs.AI
要旨
コード実行は、プログラミング言語の意味論における基本的な側面であり、コードの正確な振る舞いを反映するものです。しかし、コード知能のための事前学習済みモデルのほとんどは、実行トレースを無視し、ソースコードと構文構造のみに依存しています。本論文では、事前学習済みモデルがコード実行をどの程度理解し実行できるかを調査します。我々は、変異ベースのデータ拡張技術を開発し、大規模で現実的なPythonデータセットとコード実行タスクを作成し、Codexなどの既存モデルに挑戦します。次に、コード実行の事前学習とカリキュラム学習を活用して意味理解を強化するTransformerモデルであるCodeExecutorを提案します。我々はCodeExecutorをコード実行において評価し、その有望な性能と限界を示します。また、ゼロショットのコード間検索やテキストからコード生成といったコード知能タスクにおける潜在的な利点を実証します。我々の分析は、コード実行のための事前学習済みモデルの学習能力と汎化能力に関する洞察を提供します。
English
Code execution is a fundamental aspect of programming language semantics that
reflects the exact behavior of the code. However, most pre-trained models for
code intelligence ignore the execution trace and only rely on source code and
syntactic structures. In this paper, we investigate how well pre-trained models
can understand and perform code execution. We develop a mutation-based data
augmentation technique to create a large-scale and realistic Python dataset and
task for code execution, which challenges existing models such as Codex. We
then present CodeExecutor, a Transformer model that leverages code execution
pre-training and curriculum learning to enhance its semantic comprehension. We
evaluate CodeExecutor on code execution and show its promising performance and
limitations. We also demonstrate its potential benefits for code intelligence
tasks such as zero-shot code-to-code search and text-to-code generation. Our
analysis provides insights into the learning and generalization abilities of
pre-trained models for code execution.