低リソース言語のためのコード生成の向上:銀の弾丸はない
Enhancing Code Generation for Low-Resource Languages: No Silver Bullet
January 31, 2025
著者: Alessandro Giagnorio, Alberto Martin-Lopez, Gabriele Bavota
cs.AI
要旨
大規模言語モデル(LLM)の登場により、自動コード生成の分野が大きく進歩しました。LLMは、プログラミング言語の構文、意味、および使用パターンを学習するために大規模かつ多様なデータセットに依存しています。低リソース言語(つまり、トレーニングデータが不足しているニッチなプログラミング言語)では、そのようなデータの入手が制限されているため、モデルが効果的に汎化する能力が妨げられ、高リソース言語と比較してコード生成のパフォーマンスが低下します。このため、このパフォーマンスの差を埋める技術の探求が行われています。本研究では、低リソース言語におけるLLMのパフォーマンス向上のいくつかのアプローチの効果を調査した経験的研究を提案します。具体的には、(i)トレーニングデータの不足によりサイズが制限されるクラシックなファインチューニング、(ii)プロンプトを工夫してLLMに対象言語の追加情報を提供するインコンテキストラーニングの3つのバリアント(例:対象言語の特徴を示すフューショット例など)、および(iii)高リソース言語と低リソース言語の間の翻訳方法をモデルに教える事前トレーニング目的です。本研究の文脈は、2つの低リソース言語(RおよびRacket)と異なるアーキテクチャとサイズを持つ6つのLLMです。研究結果から、小さなLLMにとっては通常、ファインチューニングが最良の選択肢であることがわかりました。おそらく、少量のデータでも十分にトレーニングできるため、その制限されたパラメータ数を訓練するのに十分だからです。モデルのサイズが大きくなるにつれて、インコンテキストラーニングがより効果的になり、安全でコストのかからない選択肢となります(つまり、常に助けになりますが、その効果は異なります)。一方、非常に大規模なLLMは、ファインチューニングを行うと低リソース言語でのパフォーマンスが低下する可能性があります。おそらく、効果的に重みを更新するために十分なデータが不足しているためです。
English
The advent of Large Language Models (LLMs) has significantly advanced the
field of automated code generation. LLMs rely on large and diverse datasets to
learn syntax, semantics, and usage patterns of programming languages. For
low-resource languages (i.e., niche programming languages characterized by the
scarcity of training data), the limited availability of such data hampers the
models' ability to generalize effectively, resulting in poorer code generation
performance as compared to high-resource languages. For this reason, there is a
quest for techniques able to close this performance gap. We present an
empirical study investigating the effectiveness of several approaches for
boosting LLMs' performance on low-resource languages, namely: (i) a classic
fine-tuning, which is however capped in size by the scarcity of training data;
(ii) three variants of in-context learning, with prompts crafted to provide the
LLM with additional information about the low-resource language (e.g., few-shot
examples showcasing features of the targeted language); and (iii) a
pre-training objective teaching the model how to translate between high- and
low-resource languages. The context of our study are two low-resource languages
(R and Racket) and six LLMs having different architectures and sizes. Our
findings reveal that a fine-tuning is usually the best choice for smaller LLMs,
possibly due to the fact that even a small dataset is sufficient to train their
limited number of parameters. With the increase in size of the models,
in-context learning becomes more and more effective, representing a safe and
cheap bet (i.e., it always helps, but with different magnitudes). Differently,
very large LLMs may deteriorate their performance on low-resource languages
when fine-tuning is performed, possibly due to the lack of enough data needed
to effectively update their weights.Summary
AI-Generated Summary