Skip to main content
QUICK REVIEW

[Paper Review] Improving Code Generation via Small Language Model-as-a-judge

Giuseppe Crupi, Rosalia Tufano|arXiv (Cornell University)|Feb 12, 2026
Software Engineering ResearchComputer Science0 citations
TL;DR

The paper investigates fine-tuning small language models (SLMs) to judge code correctness and use them as judges to select among multiple SLM-generated solutions, achieving competitive code generation performance at a fraction of the cost of large LLMs.

ABSTRACT

Large language models (LLMs) have shown remarkable capabilities in automated code generation. While effective for mainstream languages, they may underperform on less common or domain-specific languages, prompting companies to develop in-house code generators. While open-source models can be trained for this, only LLMs with tens of billions of parameters match the performance of commercial tools, demanding costly training and deployment. Recent work proposed supporting code generation with smaller models (SLMs) by generating multiple candidate solutions and using another SLM to select the most likely correct one. The most recent work in this area is the one by Sun et al. [29] presenting RankEF, a T5 model trained to rank code solutions using both execution-based and non-execution-based information. However, Sun et al. do not assess the T5 ranker's classification accuracy, that is, how often it misjudges correct implementations as incorrect or vice versa, leaving open questions about the reliability of LMs as code correctness judges for other tasks (e.g., automated code review). Moreover, their experiments involve relatively old models, making it unclear the extent to which such a methodology would still help companies in cheaply training their own code generators with performance comparable to those of massive LLMs. We present a study addressing these limitations. We train several state-of-the-art SLMs as code correctness judges and assess their ability to discriminate between correct and wrong implementations. We show that modern SLMs outperform RankEF, even without exploiting execution-based information. When used as code rankers, they achieve higher performance gains than RankEF and perform competitively with LLMs 5-25x larger, at a fraction of the cost.

Motivation & Objective

  • Motivate the need for cost-efficient in-house code generation tools for DSLs and less-common languages.
  • Assess whether fine-tuned SLMs can reliably judge code correctness independent of generation tasks.
  • Evaluate whether SLMs-as-judges can boost code generation performance by selecting among multiple candidate solutions.
  • Compare SLM-based approaches with RankEF and large LLM baselines in terms of performance and deployment cost.

Proposed method

  • Fine-tune four state-of-the-art SLMs (Qwen2.5 Coder 0.5B/3B, Gemma-3 4B, Llama-3.2 3B) as code correctness judges and compare to GPT-4.1-mini and RankEF.
  • Assemble training data from 722 code-generation tasks across Java HumanEval/MBPP (Java) and CoderEval benchmarks with candidate implementations labeled as correct or incorrect via test execution.
  • Generate 10 candidate solutions per task from five code generators, yielding 50 candidates per task for judging.
  • Train judges using four setups: zero-shot, few-shot, and fine-tuning (with and without execution feedback); evaluate using F1 and Cohen’s Kappa against test outcomes.
  • Use top-performing SLMs as judges to select the best solution from pools of candidates generated by SLMs, and compare against RankEF, random, and log-likelihood baselines.
  • Analyze cost/latency by comparing inference hardware requirements for small models versus large LLMs.

Experimental results

Research questions

  • RQ1RQ1: Can small language models be effectively fine-tuned to judge code correctness, and how do they perform compared to GPT-4.1-mini and RankEF?
  • RQ2RQ2: Can using SLMs-as-judges boost code generation performance when selecting among multiple candidates from an SLM generator, and how does this compare to large LLMs in terms of accuracy and cost?

Key findings

  • SLMs cannot act as zero-shot judges for code correctness, but fine-tuning substantially improves judgment accuracy.
  • Fine-tuned SLMs achieve moderate agreement with ground truth (Cohen’s Kappa between 0.45 and 0.57) and outperform RankEF in several settings.
  • SLMs-as-judges can yield higher code generation performance than RankEF in four of five benchmarks when selecting among multiple candidates.
  • Using multiple SLM judges to rank candidates achieves competitive performance with LLMs that are 5–25 times larger, at a fraction of deployment cost.
  • Hardware/inference cost for running a generator plus judges with small models is dramatically cheaper (around 1k) than running a ~30B LLM (~17k).
  • The study provides public code and data for replication.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.