$\mathbb{USCD}$: Improving Code Generation of LLMs by Uncertainty-Aware Selective Contrastive Decoding
Shuai Wang, Liang Ding, Li Shen, Yong Luo, Zheng He, Wei Yu, Dacheng, Tao

TL;DR
This paper introduces USCD, a simple uncertainty-aware selective contrastive decoding method that enhances one-pass code generation quality in large language models by reducing output noise and hallucinations.
Contribution
The paper proposes a novel plug-and-play inference mechanism, USCD, that leverages uncertainty estimation to selectively eliminate noise, improving code generation performance in LLMs.
Findings
USCD significantly improves pass@1 scores by 16.59% on benchmarks.
The Jensen-Shannon divergence indicates high relevance between uncertainty and output noise.
USCD is flexible and applicable to various LLMs and benchmarks.
Abstract
Large language models (LLMs) have shown remarkable capabilities in code generation. However, the effects of hallucinations (e.g., output noise) make it particularly challenging for LLMs to generate high-quality code in one pass. In this work, we propose a simple and effective \textbf{u}ncertainty-aware \textbf{s}elective \textbf{c}ontrastive \textbf{d}ecoding () mechanism to improve the quality of one-pass code generation in LLMs and reduce the impact of output noise. To be specific, we first elaborately designed a negative prompt (namely lame prompt) to output noise by removing input-output examples from the standard few-shot prompt. Our preliminary study shows that the Jensen-Shannon divergence (JS divergence) between token distribution uncertainty and the output noise is relatively low (approximately ), indicating their high relevance. Then, we selectively…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Mathematics, Computing, and Information Processing
