Adaptive Test-Time Compute Allocation with Evolving In-Context Demonstrations

Bowen Zuo, Dongruo Zhou, Yinglun ZhuarXiv 2026

TL;DR

Current test-time scaling methods typically rely on generating multiple answers from a fixed distribution or simply allocating more samples to harder questions. This paper introduces a framework that jointly optimizes where compute is spent and how answers are generated by dynamically updating the model's prompt with successfully solved, semantically related queries from the test set itself. This self-evolving in-context learning approach significantly boosts accuracy across reasoning benchmarks while dramatically reducing inference-time token consumption.

What Problem Does This Paper Address?

Large Language Models (LLMs) can perform significantly better if given more compute budget at inference time—a paradigm known as test-time scaling (e.g., via Best-of-N sampling or self-consistency). However, most current test-time scaling techniques suffer from two major inefficiencies:

  1. Static Allocation: They treat all questions equally, wasting compute on easy questions while undersampling hard ones.
  2. Static Distributions: Even adaptive methods that allocate more samples to harder questions continue to sample from the exact same base distribution. If a model's base probability of generating the correct answer to a very hard question is near zero, simply drawing more independent samples yields diminishing returns.

The authors tackle this by asking: Can we adaptively shift the generation distribution during inference using the model's own successful problem-solving history?

Methods

The proposed algorithm, Self-Evolving Test-Time Allocation, operates entirely at inference time without modifying model parameters. It runs in two distinct stages:

  • Warm-up Phase: Every query in the test set receives a small, fixed budget of samples. Easy questions are solved immediately and removed from the active pool. Crucially, these solved question-response pairs form an initial test-time demonstration pool ($D_{test}$).
  • Adaptive Distribution Sampling Phase: For the remaining unsolved queries, the algorithm concentrates further compute over multiple rounds. Instead of standard resampling, it constructs a dynamic In-Context Learning (ICL) prompt for each active query. It embeds the query and uses cosine similarity to retrieve the top-$P$ most semantically similar already solved queries from $D_{test}$.

As more queries get resolved over successive rounds, the demonstration pool grows, and the effective sampling distribution continuously evolves to guide the model through harder reasoning trajectories.

Datasets

The method was evaluated across five diverse reasoning and coding benchmarks:

  • MATH-500: A subset of 500 challenging math problems.
  • GPQA-Diamond: A high-quality graduate-level Google-proof Q&A dataset (198 questions).
  • LiveCodeBench: 166 recent coding problems released between Oct 2024 and Jan 2025.
  • MinervaMath: 272 quantitative reasoning questions.
  • Reasoning Gym: A custom evaluation dataset constructed by the authors consisting of 400 hard math-oriented reasoning problems across four categories (decimal arithmetic, advanced geometry, binary alternation, and letter counting).

Key Insights and Ideas

  • The Test Set as a Dynamic Textbook: The test set itself can serve as its own dynamic few-shot training data. By solving easy problems first, the model generates high-quality, task-relevant demonstrations that unlock solution paths for harder, semantically related problems.
  • Distribution Shifting > Pure Oversampling: Simply drawing more samples from a flawed base distribution is token-inefficient. Shifting the distribution via similarity-guided ICL introduces beneficial diversity and guides the model toward correct reasoning paths.
  • Multiplicative Efficiency: Solving a hard question early doesn't just save tokens for that specific question by stopping further iterations; it also adds a powerful new demonstration to the pool, helping to solve other related questions faster.

Key Results

The proposed adaptive method (Ours (Adpt)) consistently outperformed uniform sampling (Unif) and standard adaptive elimination (Elim) across all model families tested (Gemini-2.5-flash-lite, GPT-4.1 Mini, GPT-5 Nano).

Figure 1: Average coverage (%) across 4 model variants, where each result is averaged over 5 benchmarks spanning math, coding, and reasoning. See Section 5 for details.

As shown in Figure 1, the average coverage across all benchmarks improved dramatically. For instance, on Gemini (non-thinking), coverage jumped from ~59% (Unif) to over 70% (Ours (Adpt)).

Furthermore, the method achieves these accuracy gains while using significantly fewer output tokens. In a token usage analysis on GPQA-Diamond, the method saved nearly 1.5 million tokens compared to the standard Elimination baseline over 4 rounds, representing a massive reduction in inference costs.

Figure 2: Coverage comparison on MATH-500.

Limitations and Future Work

  • Weak Semantic Structure: The method relies heavily on semantic clustering within the test set. The authors tested a "failure mode" by deliberately constructing a highly heterogeneous dataset with semantically distant questions. While Ours (Adpt) still provided modest improvements, the gains were noticeably narrower when local clustering was disrupted.
  • Verification Dependency: The framework assumes access to a reliable reward oracle or verifier to determine when a question is successfully solved. While they demonstrated robustness to a noisy reward model (with 5% flipped labels), highly flawed verifiers would degrade performance by adding incorrect examples to the demonstration pool.
  • Future Directions: The authors suggest exploring alternative non-ICL mechanisms to shift the distribution (like dynamic temperature adjustment) and extending the framework to handle streaming inference workloads.

Summary updated

BibTeX
@misc{zuo2026adaptive,
  author = {Bowen Zuo and Dongruo Zhou and Yinglun Zhu},
  title = {{Adaptive Test-Time Compute Allocation with Evolving In-Context Demonstrations}},
  year = {2026},
  eprint = {2604.21018},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.21018},
}
Figure