Confidence-Gated Transductive Test Generation for Code Reranking

Sungjae Lee, Youngsik Yoon, Seockbean Song, Siwei Wang, Wei Chen, Jungseul OkarXiv 2026

TL;DR

The paper introduces Confidence-Gated Transductive Test Generation (CoTT), an adaptive framework that generates highly reliable test cases for code reranking using a single, efficient LLM. By using a cheap "inductive" majority vote first and only triggering an expensive, input-specific "transductive" generation when confidence is low, CoTT achieves state-of-the-art reranking accuracy while significantly cutting computational costs.

What Problem Does This Paper Address?

When Large Language Models (LLMs) generate code, they often produce multiple candidate solutions. To find the best one, we need to rank them, usually by running them against test cases. However, high-quality, human-written test suites are rarely available at scale, forcing us to synthesize test cases automatically.

This introduces the oracle problem: how do we know what the correct expected output should be for a newly synthesized test input?

Current approaches fall into two flawed camps:

  1. Inductive methods: They generate a bunch of general solution candidates and use a majority vote to guess the output. If the generated programs are weak or buggy, the consensus output will be wrong.
  2. Transductive methods: They force the LLM to reason about specific inputs to deduce the output. While accurate, doing this for every single test case is computationally expensive and wasteful for easy inputs.

CoTT bridges this gap by dynamically allocating test-time compute only when an input is genuinely difficult or ambiguous.

Methods

CoTT establishes a two-tier adaptive pipeline using a single efficient LLM (Llama-3.1-8B-Instruct):

Figure 1: Overview of CoTT. CoTT predicts the expected output for a synthesized test input using inductive generation, and invokes transductive generation only when inductive confidence is low. This confidence-gated design improves output reliability while allocating additional computation only when needed.
  1. Inductive Output Estimation (Cheap): For a given test input $x$, CoTT samples a pool of general solution candidates for the problem and executes them on $x$. It calculates an inductive confidence score based on the majority ratio (how many programs agree on the same output).
  2. Confidence Gating: If the confidence score meets or exceeds a threshold $\tau$ (set to 0.8 in the main experiments), CoTT trusts the majority vote and moves on.
  3. Transductive Refinement (Expensive): If confidence is below $\tau$, the gating mechanism triggers a transductive step. The LLM is explicitly prompted to write a Python function narrowly tailored to that exact target input, ignoring general edge cases. CoTT then takes the majority vote of these input-specific programs to determine the final expected output.

Datasets

The authors evaluated CoTT on two primary code reranking benchmarks:

  • HumanEval-R+
  • MBPP-R+

Derived from the popular HumanEval+ and MBPP+ datasets, these benchmarks pair each coding task with five candidate solutions of varying correctness. The goal is to accurately recover the ground-truth ranking of these candidates based on synthesized test execution.

Key Insights and Ideas

  • Why Transduction Helps: General-purpose programs often fail on tricky boundary conditions. However, when the LLM is forced to focus only on a single input instance (e.g., eulerian_num(0, 10)), it frequently injects specific hardcoded or simplified logic that correctly handles that exact case, even if the model is incapable of writing a fully correct general solution.
  • Agreement is a Reliable Gate: The empirical distribution of the inductive majority ratio serves as an excellent proxy for correctness. As shown in the paper's analysis, when the inductive prediction is wrong, the confidence score is noticeably lower, making it a highly effective trigger for extra compute.
Comparison of inductive and transductive majority-ratio distributions

Key Results

CoTT demonstrates a superior efficiency-effectiveness trade-off compared to uniform scaling baselines:

Comparison of reranking performance and average cost
  • State-of-the-Art Reranking: On MBPP-R+, CoTT achieved the highest scores across all metrics, including a 61.6% Top-1 accuracy and a 0.580 Spearman’s $\rho$, outperforming more expensive baselines like SYNTRA and rStar-Coder.
  • Cost Efficiency: Compared to an "Always Transductive" approach (which applies transductive generation to every input), CoTT reduced the average inference cost from \$0.077 to \$0.065 per problem, while maintaining or even improving ranking accuracy.

Limitations and Future Work

The authors note several limitations to their current study:

  • Lack of External Context: CoTT relies purely on the LLM's internal knowledge and does not leverage external documentation or Retrieval-Augmented Generation (RAG).
  • No Iterative Co-Evolution: The framework generates tests and code in isolation rather than allowing them to iteratively improve each other through a feedback loop.
  • Scope of Evaluation: Testing was restricted to function-level Python tasks using a single model size (8B parameters), leaving repository-level tasks and cross-model robustness unexplored.
  • Execution Dependency: CoTT requires a secure, sandboxed environment to execute code with timeouts, making it less practical for environments where code execution is restricted or highly expensive.

Summary updated

BibTeX
@misc{lee2026confidence,
  author = {Sungjae Lee and Youngsik Yoon and Seockbean Song and Siwei Wang and Wei Chen and Jungseul Ok},
  title = {{Confidence-Gated Transductive Test Generation for Code Reranking}},
  year = {2026},
  eprint = {2609.12489},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.12489},
}
Figure