ChatPaper.aiChatPaper

AST-T5: コード生成と理解のための構造認識事前学習

AST-T5: Structure-Aware Pretraining for Code Generation and Understanding

January 5, 2024
著者: Linyuan Gong, Mostafa Elhoushi, Alvin Cheung
cs.AI

要旨

大規模言語モデル(LLM)はコード関連タスクにおいて大きな進歩を遂げてきたが、多くのLLMはコードを単なるシーケンスとして扱い、その構造的な性質を無視している。本論文では、Abstract Syntax Tree(AST)を活用した新しい事前学習パラダイムであるAST-T5を紹介する。これにより、コード生成、トランスパイル、理解が強化される。動的計画法を用いたAST-Aware Segmentationはコード構造を保持し、AST-Aware Span Corruption目的関数はモデルに様々なコード構造を再構築する能力を与える。他のモデルとは異なり、AST-T5は複雑なプログラム解析やアーキテクチャ変更を必要としないため、任意のエンコーダ-デコーダTransformerとシームレスに統合できる。評価結果では、AST-T5は様々なコード関連タスクにおいて、同規模の言語モデルを一貫して上回ることを示している。構造認識により、AST-T5は特にコード間タスクで強力であり、Bugs2FixタスクではCodeT5を2ポイント、CodeXGLUEのJava-C#トランスパイルでは3ポイント上回る正確一致スコアを達成した。我々のコードとモデルはhttps://github.com/gonglinyuan/ast_t5で公開されている。
English
Large language models (LLMs) have made significant advancements in code-related tasks, yet many LLMs treat code as simple sequences, neglecting its structured nature. We introduce AST-T5, a novel pretraining paradigm that leverages the Abstract Syntax Tree (AST) for enhanced code generation, transpilation, and understanding. Using dynamic programming, our AST-Aware Segmentation retains code structure, while our AST-Aware Span Corruption objective equips the model to reconstruct various code structures. Unlike other models, AST-T5 avoids intricate program analyses or architectural changes, so it integrates seamlessly with any encoder-decoder Transformer. Evaluations show that AST-T5 consistently outperforms similar-sized LMs across various code-related tasks. Structure-awareness makes AST-T5 particularly powerful in code-to-code tasks, surpassing CodeT5 by 2 points in exact match score for the Bugs2Fix task and by 3 points in exact match score for Java-C# Transpilation in CodeXGLUE. Our code and model are publicly available at https://github.com/gonglinyuan/ast_t5.
PDF132December 15, 2024