EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

AdaDec: A Uncertainty-Guided Lookahead Decoding Framework for LLM-Based Code Generation

Kaifeng He, Mingwei Liu, Chong Wang, Zike Li, Yanlin Wang, Xin Peng, Zibin Zheng

Proceedings of the ACM on Software Engineering · 30.06.2026 · 3 (FSE) · 3047-3069

DOI: 10.1145/3808142 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Proceedings of the ACM on Software Engineering, online erschienen am 30.06.2026. Verfasst von Kaifeng He und 6 weiteren Autor:innen. Die Arbeit nennt 46 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: National Natural Science Foundation of China, General Program of the Natural Science Foundation of Guangdong Province, China.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Code generation with large language models (LLMs) is highly sensitive to token selection during decoding, particularly at uncertain decision points that influence program logic. While standard strategies such as greedy decoding treat all tokens uniformly, they overlook code-specific uncertainty patterns, leading to suboptimal performance. This paper presents an empirical study revealing that many generation errors stem from token ranking mistakes at high-uncertainty steps, where the correct token is present but not top-ranked. Motivated by these findings, we propose AdaDec, a lookahead-based uncertainty-guided adaptive decoding framework that integrates a token-level pause-then-rerank mechanism driven by token uncertainty. AdaDec learns model-specific uncertainty thresholds and applies a lookahead-based reranking strategy when uncertainty is high. Experiments on HumanEval+, MBPP+, and DevEval benchmarks show that AdaDec improves Pass@1 accuracy by up to 20.9% in absolute terms over greedy decoding. More importantly, it consistently outperforms both competitive baselines like Beam Search and state-of-the-art adaptive decoding methods such as AdapT, while maintaining high efficiency through selective, uncertainty-triggered pausing. Our results highlight the promise of uncertainty-aware adaptive decoding for improving both the reliability and efficiency of LLM-based code generation.

Förderung

  • National Natural Science Foundation of China
  • General Program of the Natural Science Foundation of Guangdong Province, China

Zitieren

APA

He, K., Liu, M., Wang, C., Li, Z., Wang, Y., Peng, X., & Zheng, Z. (2026). AdaDec: A Uncertainty-Guided Lookahead Decoding Framework for LLM-Based Code Generation. Proceedings of the ACM on Software Engineering, 3(FSE), 3047-3069. https://doi.org/10.1145/3808142

Vancouver

He K, Liu M, Wang C, Li Z, Wang Y, Peng X, et al. AdaDec: A Uncertainty-Guided Lookahead Decoding Framework for LLM-Based Code Generation. Proceedings of the ACM on Software Engineering. 2026;3(FSE):3047-3069. doi:10.1145/3808142

BibTeX
@article{He2026,
  author = {He, Kaifeng and Liu, Mingwei and Wang, Chong and Li, Zike and Wang, Yanlin and Peng, Xin and Zheng, Zibin},
  title = {AdaDec: A Uncertainty-Guided Lookahead Decoding Framework for LLM-Based Code Generation},
  journal = {Proceedings of the ACM on Software Engineering},
  year = {2026},
  volume = {3},
  number = {FSE},
  pages = {3047--3069},
  doi = {10.1145/3808142}
}
Kostenlos starten →