TL;DR
The paper introduces DOCE (Decoding Objectives for Code Execution), a unified framework that systematically evaluates and compares candidate generation, reranking, minimum Bayes risk (MBR) decoding, and self-debugging for LLM-based code generation. The authors demonstrate that combining high-temperature sampling with simple trial unit-test filtering and a novel multi-candidate self-debugging strategy yields performance that closely approaches the theoretical oracle limit.
What Problem Does This Paper Address?
While Large Language Models (LLMs) excel at generating code, the strategy used during inference heavily dictates their ultimate success. Engineers typically rely on greedy decoding, nucleus sampling, or complex neural rerankers to select the best code snippet from a pool of generated candidates.
However, the field has lacked a unified framework to compare these inference-time techniques apples-to-apples. Furthermore, the rapid advancement of powerful open-source code LLMs has challenged older assumptions—such as the belief that code generation requires low sampling temperatures, or that execution-based filtering is only useful when models are performing poorly. This paper establishes a rigorous benchmark to find the "sweet spot" of execution-based code generation.
Methods
The authors propose the Decoding Objectives for Code Execution (DOCE) framework, which standardizes the code generation pipeline into four core phases:
- Candidate Generation: Generating a diverse set of $N$ code programs using high-temperature sampling.
- Unit-Test Filtering: A simple but highly effective step that eliminates any candidate code that fails basic trial unit tests.
- Reranking & MBR Decoding: Selecting the final candidate using either $n$-best reranking (based on features like log-likelihood) or Minimum Bayes Risk (MBR) decoding, which uses execution agreement (majority voting on outputs) to find the most robust program.
- Self-Debugging (SD-Multi): Rather than debugging only the single top-ranked candidate (the standard approach, termed SD-1), the authors introduce SD-Multi, which applies the LLM's self-repair capabilities to all generated candidates simultaneously before the final reranking step occurs.
Datasets
The framework was evaluated using several prominent code generation benchmarks:
- HumanEval and MBPP: The standard baselines for Python code generation.
- EvalPlus (HumanEval+ / MBPP+): Enhanced versions of the above datasets containing 35x more unit tests to rigorously catch silent code bugs (correctness illusions).
- LiveCodeBench: A dataset composed of recent competitive programming problems designed to mitigate data contamination risks.
Key Insights and Ideas
- High Temperature is a Superpower (When Filtered): Traditionally, researchers used low sampling temperatures (e.g., 0.2) to keep code generation stable. DOCE shows that sampling at much higher temperatures (1.2 to 1.6) dramatically increases the diversity of the candidate pool. When paired with unit-test filtering, this high-temperature strategy unlocks significantly higher oracle performance.
- Filtering is Underrated: Simply discarding candidates that fail basic trial unit tests provides the single largest performance boost among all non-MBR techniques, effectively aligning the reranker with the true target function.
- Debug Everything, Not Just the Winner: Applying self-debugging to the entire pool of candidates (SD-Multi) yields consistently better results than debugging a single chosen candidate (SD-1). It increases the density of viable programs before the final selection is made.
- Diminishing Returns on Test Quantities: For execution-based MBR decoding, you don't need hundreds of test cases. The authors found that performance plateaus rapidly: just 5 unit tests for MBPP+ and 20 for HumanEval+ are enough to achieve optimal reranking accuracy.
Key Results
The inclusion of execution-based filtering and MBR decoding consistently closed the gap to the theoretical oracle performance across multiple model sizes (7B to 16B parameters).
- Reranking Breakthroughs: On HumanEval+ using CodeLlama-7B-Instruct, standard MBR decoding achieved an execution accuracy of 49.5%. Adding the trial unit-test filter caused accuracy to skyrocket to 70.1% (close to the 76.2% oracle baseline).
- SD-Multi vs. SD-1: As shown in the paper's scaling analysis, the proposed multi-candidate debugging approach consistently outpaced traditional single-candidate debugging across varying candidate pool sizes.
Limitations and Future Work
- Model Scale Constraints: Due to computational budgets, the study was limited to open-source models under 16 billion parameters (e.g., CodeLlama and DeepSeekCoder-V2-Lite). The dynamics of these decoding objectives on massive frontier models (like GPT-4 or Claude 3.5 Sonnet) remain an open question.
- Future Directions: The authors suggest exploring the framework using entirely LLM-generated unit tests when ground-truth trial tests are unavailable, as well as developing more generalized, execution-free neural rerankers that can mimic these execution-based gains without the runtime overhead.
Summary updated