[Paper Review] The Larger the Better? Improved LLM Code-Generation via Budget Reallocation
Under a fixed compute budget, generating multiple outputs from smaller LLMs can outperform a single output from larger models in code generation, though ranking-based selection without unit tests is less effective than using a bigger model directly.
It is a common belief that large language models (LLMs) are better than smaller-sized ones. However, larger models also require significantly more time and compute during inference. This begs the question: what happens when both models operate under the same budget? (e.g., compute, run-time). To address this question, we analyze code generation LLMs of various sizes and make comparisons such as running a 70B model once vs. generating five outputs from a 13B model. We consider a standard unit-test setup, which can be used to select the correct output from the smaller model. Our findings reveal that the repeated use of smaller models can yield consistent improvements, with gains of up to 15% across five tasks. On the other hand, in scenarios where unit-tests are unavailable, a ranking-based selection of candidates from the smaller model falls short of the performance of a single output from larger ones. Our results highlight the potential of using smaller models instead of larger ones, and the importance of studying approaches for ranking LLM outputs.
Motivation & Objective
- Investigate whether a fixed compute budget favors larger models (single output) or smaller models (multiple outputs) for code generation tasks.
- Quantify performance under compute budgets using FLOPs and wall-time across Code Llama model sizes.
- Assess the effectiveness of ranking-based selection when unit tests are unavailable.
- Provide public data to support research into budget-aware model usage for code generation.
Proposed method
- Adapt pass@k evaluation to compare models of different sizes under fixed compute via generating as many outputs as the budget allows.
- Define pass@flops and pass@time to allocate k outputs based on FLOPs/time constraints (Equations 2 and 3).
- Use Code Llama models (7B, 13B, 34B, 70B) on HumanEval, MBPP, and APPS benchmarks with specified prompting strategies and decoding settings.
- Compare greedy decoding and sampling, and report pass@k with k = floor(n/2) for robustness (as in Chen et al., 2021).
- Examine rank-based output selection using negative log-likelihood as a scoring policy (Equations 4–6) and evaluate LLMs as rankers (Equation 7).
- Release large-scale outputs (Code Llama 7B) to support research.

Experimental results
Research questions
- RQ1Can smaller models matched to a fixed compute budget outperform larger models in code-generation tasks?
- RQ2How do FLOPs-based and wall-time-based budgets affect the relative performance of different model sizes?
- RQ3Does ranking-based selection without unit tests approach the performance of larger models under fixed budget?
- RQ4What is the effectiveness of using larger models as rankers for smaller-model outputs?
- RQ5What data and policies best support budget-aware model deployment for code generation?
Key findings
- Smaller models (7B, 13B) can outperform larger ones (34B, 70B) on HumanEval and MBPP across all compute budgets, with gains up to 15%.
- On APPS, the 13B model generally performs best across budgets, with about a 5% margin over larger models on the hardest competition split.
- Under fixed budgets, smaller models can match or exceed larger models’ performance using substantially less compute (e.g., 7B/13B reach target scores faster).
- Ranking-based selection without unit tests improves with budget and ranker size but still lags behind a single larger-model output at the same budget.
- LLMs used as rankers for outputs from smaller models can improve performance, yet greedy decoding with larger models remains superior under fixed budgets.
- The authors release over 1 million Code Llama 7B outputs for HumanEval and MBPP to support research.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.