Improving Code Generation by Dynamic Temperature Sampling

要約

最近、Large Language Model (LLM) はコード生成において目覚ましい結果を示しています。
ただし、既存のデコード戦略は自然言語 (NL) 生成用に設計されており、NL とプログラミング言語 (PL) の違いを見落としています。
この見落としのため、コード生成のためのより良いデコード戦略は未解決のままです。
この論文では、コード生成に特化した復号化戦略を探求するための最初の体系的な研究を実施します。
コード トークンの損失分布を分析すると、コード トークンは 2 つのカテゴリに分類できることがわかりました。予測が難しい困難なトークンと、容易に推測できる信頼性の高いトークンです。
このうち、チャレンジトークンは主にコードブロックの先頭に出現します。
上記の発見に触発されて、私たちはシンプルで効果的な方法である適応温度 (AdapT) サンプリングを提案します。これは、さまざまなトークンをデコードするときに温度係数を動的に調整します。
困難なトークンのサンプリング時にはより高い温度を適用し、LLM が多様な選択肢を探索できるようにします。
テールランダムノイズの影響を避けるために、信頼できるトークンにはより低い温度を採用します。
AdapT サンプリングをさまざまなサイズの LLM に適用し、2 つの一般的なデータセットで評価を実施します。
結果は、AdapT サンプリングが最先端のデコード戦略よりも大幅に優れていることを示しています。

要約(オリジナル)

Recently, Large Language Models (LLMs) have shown impressive results in code generation. However, existing decoding strategies are designed for Natural Language (NL) generation, overlooking the differences between NL and programming languages (PL). Due to this oversight, a better decoding strategy for code generation remains an open question. In this paper, we conduct the first systematic study to explore a decoding strategy specialized in code generation. With an analysis of loss distributions of code tokens, we find that code tokens can be divided into two categories: challenging tokens that are difficult to predict and confident tokens that can be easily inferred. Among them, the challenging tokens mainly appear at the beginning of a code block. Inspired by the above findings, we propose a simple yet effective method: Adaptive Temperature (AdapT) sampling, which dynamically adjusts the temperature coefficient when decoding different tokens. We apply a larger temperature when sampling for challenging tokens, allowing LLMs to explore diverse choices. We employ a smaller temperature for confident tokens avoiding the influence of tail randomness noises. We apply AdapT sampling to LLMs with different sizes and conduct evaluations on two popular datasets. Results show that AdapT sampling significantly outperforms state-of-the-art decoding strategy.

arxiv情報

著者 Yuqi Zhu,Jia Allen Li,Ge Li,YunFei Zhao,Jia Li,Zhi Jin,Hong Mei
発行日 2023-09-06 06:27:33+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.SE パーマリンク