Grammar-Based Code Representation: Is It a Worthy Pursuit for LLMs?

要約

文法は、プログラミング言語とソフトウェアエンジニアリングの基礎として機能し、構文空間とプログラム構造を定義するフレームワークを提供します。
既存の研究は、小規模モデルにおける文法ベースのコード表現の有効性を示しており、構文エラーを減らし、パフォーマンスを向上させる能力を示しています。
ただし、言語モデルが10億レベル以上にスケーリングするにつれて、構文レベルのエラーはまれになり、文法情報が依然としてパフォーマンスの利点をもたらすかどうかは不明です。
これを調査するために、コード生成プロセスに文法ルールを組み込んだ数十億規模の文法モデルのシリーズを開発します。
Humanval(+)およびMBPP(+)の実験は、コード生成の精度の顕著な改善を示しています。
さらなる分析により、文法ベースの表現は、微妙なコードの違いを識別するLLMSの能力を高め、軽度の変動によって引き起こされるセマンティックエラーを減らすことが示されています。
これらの調査結果は、文法ベースのコード表現は、構文の正確性を維持するだけでなく、セマンティック差別化を改善することによって、10億規模のモデルでも価値があることを示唆しています。

要約(オリジナル)

Grammar serves as a cornerstone in programming languages and software engineering, providing frameworks to define the syntactic space and program structure. Existing research demonstrates the effectiveness of grammar-based code representations in small-scale models, showing their ability to reduce syntax errors and enhance performance. However, as language models scale to the billion level or beyond, syntax-level errors become rare, making it unclear whether grammar information still provides performance benefits. To explore this, we develop a series of billion-scale GrammarCoder models, incorporating grammar rules in the code generation process. Experiments on HumanEval (+) and MBPP (+) demonstrate a notable improvement in code generation accuracy. Further analysis shows that grammar-based representations enhance LLMs’ ability to discern subtle code differences, reducing semantic errors caused by minor variations. These findings suggest that grammar-based code representations remain valuable even in billion-scale models, not only by maintaining syntax correctness but also by improving semantic differentiation.

arxiv情報

著者 Qingyuan Liang,Zhao Zhang,Zeyu Sun,Zheng Lin,Qi Luo,Yueyi Xiao,Yizhou Chen,Yuqun Zhang,Haotian Zhang,Lu Zhang,Bin Chen,Yingfei Xiong
発行日 2025-03-07 15:23:13+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.PL パーマリンク