Towards Better Code Generation: Adaptive Decoding with Uncertainty Guidance Article Swipe
YOU?
·
· 2025
· Open Access
·
· DOI: https://doi.org/10.48550/arxiv.2506.08980
Code generation with large language models (LLMs) is highly sensitive to token selection during decoding, particularly at decision points where uncertainty strongly affects program correctness. Conventional strategies such as greedy decoding treat all tokens uniformly and fail to capture the uncertainty characteristics unique to code, often resulting in suboptimal outputs. In this work, we conduct an empirical analysis and show that a large fraction of generation errors arises from token misranking at high-uncertainty positions, where the correct token is available but not prioritized. To address this, we introduce AdaDec, an adaptive decoding framework that employs a lookahead-based, uncertainty-aware pause-and-rerank mechanism. AdaDec automatically learns model-specific uncertainty thresholds and selectively invokes reranking when high uncertainty is detected, leveraging lookahead to refine token choice. Across HumanEval+, MBPP+, and DevEval benchmarks, AdaDec yields substantial improvements, achieving up to 20.9% absolute gains in Pass@1 accuracy compared with greedy decoding, while consistently outperforming prior adaptive decoding approaches such as AdapT. Furthermore, by applying reranking only when necessary, AdaDec reduces computational overhead and latency, enhancing efficiency alongside reliability. These findings underscore the value of uncertainty-guided decoding strategies in advancing the robustness and practicality of LLM-based code generation.
Related Topics
- Type
- preprint
- Language
- en
- Landing Page
- http://arxiv.org/abs/2506.08980
- https://arxiv.org/pdf/2506.08980
- OA Status
- green
- OpenAlex ID
- https://openalex.org/W4417257976
Raw OpenAlex JSON
- OpenAlex ID
-
https://openalex.org/W4417257976Canonical identifier for this work in OpenAlex
- DOI
-
https://doi.org/10.48550/arxiv.2506.08980Digital Object Identifier
- Title
-
Towards Better Code Generation: Adaptive Decoding with Uncertainty GuidanceWork title
- Type
-
preprintOpenAlex work type
- Language
-
enPrimary language
- Publication year
-
2025Year of publication
- Publication date
-
2025-06-10Full publication date if available
- Authors
-
Kaifeng He, Mingwei Liu, Chong Wang, Zhonghai Li, Yanlin Wang, Xin Peng, Zibin ZhengList of authors in order
- Landing page
-
https://arxiv.org/abs/2506.08980Publisher landing page
- PDF URL
-
https://arxiv.org/pdf/2506.08980Direct link to full text PDF
- Open access
-
YesWhether a free full text is available
- OA status
-
greenOpen access status per OpenAlex
- OA URL
-
https://arxiv.org/pdf/2506.08980Direct OA link when available
- Cited by
-
0Total citation count in OpenAlex
Full payload
| id | https://openalex.org/W4417257976 |
|---|---|
| doi | https://doi.org/10.48550/arxiv.2506.08980 |
| ids.doi | https://doi.org/10.48550/arxiv.2506.08980 |
| ids.openalex | https://openalex.org/W4417257976 |
| fwci | |
| type | preprint |
| title | Towards Better Code Generation: Adaptive Decoding with Uncertainty Guidance |
| biblio.issue | |
| biblio.volume | |
| biblio.last_page | |
| biblio.first_page | |
| is_xpac | False |
| apc_list | |
| apc_paid | |
| language | en |
| locations[0].id | pmh:oai:arXiv.org:2506.08980 |
| locations[0].is_oa | True |
| locations[0].source.id | https://openalex.org/S4306400194 |
| locations[0].source.issn | |
| locations[0].source.type | repository |
| locations[0].source.is_oa | True |
| locations[0].source.issn_l | |
| locations[0].source.is_core | False |
| locations[0].source.is_in_doaj | False |
| locations[0].source.display_name | arXiv (Cornell University) |
| locations[0].source.host_organization | https://openalex.org/I205783295 |
| locations[0].source.host_organization_name | Cornell University |
| locations[0].source.host_organization_lineage | https://openalex.org/I205783295 |
| locations[0].license | |
| locations[0].pdf_url | https://arxiv.org/pdf/2506.08980 |
| locations[0].version | submittedVersion |
| locations[0].raw_type | text |
| locations[0].license_id | |
| locations[0].is_accepted | False |
| locations[0].is_published | False |
| locations[0].raw_source_name | |
| locations[0].landing_page_url | http://arxiv.org/abs/2506.08980 |
| locations[1].id | doi:10.48550/arxiv.2506.08980 |
| locations[1].is_oa | True |
| locations[1].source.id | https://openalex.org/S4306400194 |
| locations[1].source.issn | |
| locations[1].source.type | repository |
| locations[1].source.is_oa | True |
| locations[1].source.issn_l | |
| locations[1].source.is_core | False |
| locations[1].source.is_in_doaj | False |
| locations[1].source.display_name | arXiv (Cornell University) |
| locations[1].source.host_organization | https://openalex.org/I205783295 |
| locations[1].source.host_organization_name | Cornell University |
| locations[1].source.host_organization_lineage | https://openalex.org/I205783295 |
| locations[1].license | cc-by |
| locations[1].pdf_url | |
| locations[1].version | |
| locations[1].raw_type | article |
| locations[1].license_id | https://openalex.org/licenses/cc-by |
| locations[1].is_accepted | False |
| locations[1].is_published | |
| locations[1].raw_source_name | |
| locations[1].landing_page_url | https://doi.org/10.48550/arxiv.2506.08980 |
| indexed_in | arxiv, datacite |
| authorships[0].author.id | https://openalex.org/A5100525379 |
| authorships[0].author.orcid | |
| authorships[0].author.display_name | Kaifeng He |
| authorships[0].author_position | first |
| authorships[0].raw_author_name | He, Kaifeng |
| authorships[0].is_corresponding | False |
| authorships[1].author.id | https://openalex.org/A5102154339 |
| authorships[1].author.orcid | |
| authorships[1].author.display_name | Mingwei Liu |
| authorships[1].author_position | middle |
| authorships[1].raw_author_name | Liu, Mingwei |
| authorships[1].is_corresponding | False |
| authorships[2].author.id | https://openalex.org/A5101732147 |
| authorships[2].author.orcid | https://orcid.org/0009-0001-8356-878X |
| authorships[2].author.display_name | Chong Wang |
| authorships[2].author_position | middle |
| authorships[2].raw_author_name | Wang, Chong |
| authorships[2].is_corresponding | False |
| authorships[3].author.id | https://openalex.org/A5014969495 |
| authorships[3].author.orcid | https://orcid.org/0000-0003-4735-1193 |
| authorships[3].author.display_name | Zhonghai Li |
| authorships[3].author_position | middle |
| authorships[3].raw_author_name | Li, Zike |
| authorships[3].is_corresponding | False |
| authorships[4].author.id | https://openalex.org/A5100350708 |
| authorships[4].author.orcid | https://orcid.org/0000-0001-7761-7269 |
| authorships[4].author.display_name | Yanlin Wang |
| authorships[4].author_position | middle |
| authorships[4].raw_author_name | Wang, Yanlin |
| authorships[4].is_corresponding | False |
| authorships[5].author.id | https://openalex.org/A5101854992 |
| authorships[5].author.orcid | https://orcid.org/0000-0003-3376-2581 |
| authorships[5].author.display_name | Xin Peng |
| authorships[5].author_position | middle |
| authorships[5].raw_author_name | Peng, Xin |
| authorships[5].is_corresponding | False |
| authorships[6].author.id | https://openalex.org/A5012731436 |
| authorships[6].author.orcid | https://orcid.org/0000-0001-7872-7718 |
| authorships[6].author.display_name | Zibin Zheng |
| authorships[6].author_position | last |
| authorships[6].raw_author_name | Zheng, Zibin |
| authorships[6].is_corresponding | False |
| has_content.pdf | False |
| has_content.grobid_xml | False |
| is_paratext | False |
| open_access.is_oa | True |
| open_access.oa_url | https://arxiv.org/pdf/2506.08980 |
| open_access.oa_status | green |
| open_access.any_repository_has_fulltext | False |
| created_date | 2025-10-10T00:00:00 |
| display_name | Towards Better Code Generation: Adaptive Decoding with Uncertainty Guidance |
| has_fulltext | False |
| is_retracted | False |
| updated_date | 2025-12-12T09:39:50.650621 |
| primary_topic | |
| cited_by_count | 0 |
| locations_count | 2 |
| best_oa_location.id | pmh:oai:arXiv.org:2506.08980 |
| best_oa_location.is_oa | True |
| best_oa_location.source.id | https://openalex.org/S4306400194 |
| best_oa_location.source.issn | |
| best_oa_location.source.type | repository |
| best_oa_location.source.is_oa | True |
| best_oa_location.source.issn_l | |
| best_oa_location.source.is_core | False |
| best_oa_location.source.is_in_doaj | False |
| best_oa_location.source.display_name | arXiv (Cornell University) |
| best_oa_location.source.host_organization | https://openalex.org/I205783295 |
| best_oa_location.source.host_organization_name | Cornell University |
| best_oa_location.source.host_organization_lineage | https://openalex.org/I205783295 |
| best_oa_location.license | |
| best_oa_location.pdf_url | https://arxiv.org/pdf/2506.08980 |
| best_oa_location.version | submittedVersion |
| best_oa_location.raw_type | text |
| best_oa_location.license_id | |
| best_oa_location.is_accepted | False |
| best_oa_location.is_published | False |
| best_oa_location.raw_source_name | |
| best_oa_location.landing_page_url | http://arxiv.org/abs/2506.08980 |
| primary_location.id | pmh:oai:arXiv.org:2506.08980 |
| primary_location.is_oa | True |
| primary_location.source.id | https://openalex.org/S4306400194 |
| primary_location.source.issn | |
| primary_location.source.type | repository |
| primary_location.source.is_oa | True |
| primary_location.source.issn_l | |
| primary_location.source.is_core | False |
| primary_location.source.is_in_doaj | False |
| primary_location.source.display_name | arXiv (Cornell University) |
| primary_location.source.host_organization | https://openalex.org/I205783295 |
| primary_location.source.host_organization_name | Cornell University |
| primary_location.source.host_organization_lineage | https://openalex.org/I205783295 |
| primary_location.license | |
| primary_location.pdf_url | https://arxiv.org/pdf/2506.08980 |
| primary_location.version | submittedVersion |
| primary_location.raw_type | text |
| primary_location.license_id | |
| primary_location.is_accepted | False |
| primary_location.is_published | False |
| primary_location.raw_source_name | |
| primary_location.landing_page_url | http://arxiv.org/abs/2506.08980 |
| publication_date | 2025-06-10 |
| publication_year | 2025 |
| referenced_works_count | 0 |
| abstract_inverted_index.a | 61, 95 |
| abstract_inverted_index.In | 50 |
| abstract_inverted_index.To | 83 |
| abstract_inverted_index.an | 55, 89 |
| abstract_inverted_index.as | 28, 152 |
| abstract_inverted_index.at | 16, 71 |
| abstract_inverted_index.by | 155 |
| abstract_inverted_index.in | 47, 137, 180 |
| abstract_inverted_index.is | 7, 78, 113 |
| abstract_inverted_index.of | 64, 176, 186 |
| abstract_inverted_index.to | 10, 37, 43, 117, 133 |
| abstract_inverted_index.up | 132 |
| abstract_inverted_index.we | 53, 86 |
| abstract_inverted_index.all | 32 |
| abstract_inverted_index.and | 35, 58, 106, 124, 165, 184 |
| abstract_inverted_index.but | 80 |
| abstract_inverted_index.not | 81 |
| abstract_inverted_index.the | 39, 75, 174, 182 |
| abstract_inverted_index.Code | 0 |
| abstract_inverted_index.code | 188 |
| abstract_inverted_index.fail | 36 |
| abstract_inverted_index.from | 68 |
| abstract_inverted_index.high | 111 |
| abstract_inverted_index.only | 158 |
| abstract_inverted_index.show | 59 |
| abstract_inverted_index.such | 27, 151 |
| abstract_inverted_index.that | 60, 93 |
| abstract_inverted_index.this | 51 |
| abstract_inverted_index.when | 110, 159 |
| abstract_inverted_index.with | 2, 141 |
| abstract_inverted_index.20.9% | 134 |
| abstract_inverted_index.These | 171 |
| abstract_inverted_index.code, | 44 |
| abstract_inverted_index.gains | 136 |
| abstract_inverted_index.large | 3, 62 |
| abstract_inverted_index.often | 45 |
| abstract_inverted_index.prior | 147 |
| abstract_inverted_index.this, | 85 |
| abstract_inverted_index.token | 11, 69, 77, 119 |
| abstract_inverted_index.treat | 31 |
| abstract_inverted_index.value | 175 |
| abstract_inverted_index.where | 19, 74 |
| abstract_inverted_index.while | 144 |
| abstract_inverted_index.work, | 52 |
| abstract_inverted_index.(LLMs) | 6 |
| abstract_inverted_index.Across | 121 |
| abstract_inverted_index.AdaDec | 100, 127, 161 |
| abstract_inverted_index.AdapT. | 153 |
| abstract_inverted_index.MBPP+, | 123 |
| abstract_inverted_index.Pass@1 | 138 |
| abstract_inverted_index.arises | 67 |
| abstract_inverted_index.during | 13 |
| abstract_inverted_index.errors | 66 |
| abstract_inverted_index.greedy | 29, 142 |
| abstract_inverted_index.highly | 8 |
| abstract_inverted_index.learns | 102 |
| abstract_inverted_index.models | 5 |
| abstract_inverted_index.points | 18 |
| abstract_inverted_index.refine | 118 |
| abstract_inverted_index.tokens | 33 |
| abstract_inverted_index.unique | 42 |
| abstract_inverted_index.yields | 128 |
| abstract_inverted_index.AdaDec, | 88 |
| abstract_inverted_index.DevEval | 125 |
| abstract_inverted_index.address | 84 |
| abstract_inverted_index.affects | 22 |
| abstract_inverted_index.capture | 38 |
| abstract_inverted_index.choice. | 120 |
| abstract_inverted_index.conduct | 54 |
| abstract_inverted_index.correct | 76 |
| abstract_inverted_index.employs | 94 |
| abstract_inverted_index.invokes | 108 |
| abstract_inverted_index.program | 23 |
| abstract_inverted_index.reduces | 162 |
| abstract_inverted_index.absolute | 135 |
| abstract_inverted_index.accuracy | 139 |
| abstract_inverted_index.adaptive | 90, 148 |
| abstract_inverted_index.analysis | 57 |
| abstract_inverted_index.applying | 156 |
| abstract_inverted_index.compared | 140 |
| abstract_inverted_index.decision | 17 |
| abstract_inverted_index.decoding | 30, 91, 149, 178 |
| abstract_inverted_index.findings | 172 |
| abstract_inverted_index.fraction | 63 |
| abstract_inverted_index.language | 4 |
| abstract_inverted_index.latency, | 166 |
| abstract_inverted_index.outputs. | 49 |
| abstract_inverted_index.overhead | 164 |
| abstract_inverted_index.strongly | 21 |
| abstract_inverted_index.LLM-based | 187 |
| abstract_inverted_index.achieving | 131 |
| abstract_inverted_index.advancing | 181 |
| abstract_inverted_index.alongside | 169 |
| abstract_inverted_index.available | 79 |
| abstract_inverted_index.decoding, | 14, 143 |
| abstract_inverted_index.detected, | 114 |
| abstract_inverted_index.empirical | 56 |
| abstract_inverted_index.enhancing | 167 |
| abstract_inverted_index.framework | 92 |
| abstract_inverted_index.introduce | 87 |
| abstract_inverted_index.lookahead | 116 |
| abstract_inverted_index.reranking | 109, 157 |
| abstract_inverted_index.resulting | 46 |
| abstract_inverted_index.selection | 12 |
| abstract_inverted_index.sensitive | 9 |
| abstract_inverted_index.uniformly | 34 |
| abstract_inverted_index.approaches | 150 |
| abstract_inverted_index.efficiency | 168 |
| abstract_inverted_index.generation | 1, 65 |
| abstract_inverted_index.leveraging | 115 |
| abstract_inverted_index.mechanism. | 99 |
| abstract_inverted_index.misranking | 70 |
| abstract_inverted_index.necessary, | 160 |
| abstract_inverted_index.positions, | 73 |
| abstract_inverted_index.robustness | 183 |
| abstract_inverted_index.strategies | 26, 179 |
| abstract_inverted_index.suboptimal | 48 |
| abstract_inverted_index.thresholds | 105 |
| abstract_inverted_index.underscore | 173 |
| abstract_inverted_index.HumanEval+, | 122 |
| abstract_inverted_index.benchmarks, | 126 |
| abstract_inverted_index.generation. | 189 |
| abstract_inverted_index.selectively | 107 |
| abstract_inverted_index.substantial | 129 |
| abstract_inverted_index.uncertainty | 20, 40, 104, 112 |
| abstract_inverted_index.Conventional | 25 |
| abstract_inverted_index.Furthermore, | 154 |
| abstract_inverted_index.consistently | 145 |
| abstract_inverted_index.correctness. | 24 |
| abstract_inverted_index.particularly | 15 |
| abstract_inverted_index.practicality | 185 |
| abstract_inverted_index.prioritized. | 82 |
| abstract_inverted_index.reliability. | 170 |
| abstract_inverted_index.automatically | 101 |
| abstract_inverted_index.computational | 163 |
| abstract_inverted_index.improvements, | 130 |
| abstract_inverted_index.outperforming | 146 |
| abstract_inverted_index.model-specific | 103 |
| abstract_inverted_index.characteristics | 41 |
| abstract_inverted_index.high-uncertainty | 72 |
| abstract_inverted_index.lookahead-based, | 96 |
| abstract_inverted_index.pause-and-rerank | 98 |
| abstract_inverted_index.uncertainty-aware | 97 |
| abstract_inverted_index.uncertainty-guided | 177 |
| cited_by_percentile_year | |
| countries_distinct_count | 0 |
| institutions_distinct_count | 7 |
| citation_normalized_percentile |