Thought-Level Beam Search for Reasoning
Gambit dynamically redirects a reasoning model's computation toward its most promising answer attempts while they're still being generated
Large reasoning models boost accuracy by generating many parallel answer attempts and majority-voting (Self-Consistency), but most attempts end up wrong, wasting compute. Gambit periodically scores in-progress reasoning traces using their hidden states, cuts off the weakest ones, and immediately branches new continuations from the strongest prefixes, keeping GPU utilization high throughout. Under identical hardware budgets, it beats pruning-only baselines by up to +6.7 points accuracy on HMMT-24 and +3.3 points on AIME-25, more than doubles trace-completion throughput, and cuts total token usage by up to 68.5% versus standard parallel sampling.
METAL MEDIA explanatory visual
How Gambit actively reallocates compute
Evidence statusMeasured results reported
- Start with a fixed poolC parallel reasoning traces begin generating for one problem, filling the fixed hardware capacity
- Periodic scoringEvery Δ steps, a lightweight scorer reads each trace's hidden states to rank all active traces
- Zero-sum prune-and-branchThe K lowest-scoring traces are terminated while K new branches are spawned from the K highest-scoring prefixes via KV-cache inheritance, keeping the pool size fixed at C
- Completion and weighted voteFinished traces contribute their answers to a majority vote weighted by their own score
- Measured outcomesUp to +6.7 points accuracy over STEP, up to 68.5% less token usage than parallel sampling, and over 2x higher throughput
What they did
- Reframes test-time compute scaling for large reasoning models (LRMs) as a compute-allocation problem: not how much to compute, but where to direct it among partial reasoning trajectories.
- Identifies a dichotomy in existing approaches: parallel sampling (Self-Consistency) treats each trace independently and overloads GPU memory via the KV-cache, while pruning-only methods free memory but leave it idle, starving hardware without reshaping the output distribution.
- Every Δ steps, Gambit scores all active traces using a lightweight model probing their hidden states, prunes the K lowest-scoring traces, and immediately branches K new continuations from the K highest-scoring prefixes, keeping the active pool size fixed (zero-sum reallocation).
- New branches inherit the parent's KV-cache via prefix caching, so they continue generation without recomputing earlier reasoning, sharply cutting token and memory cost.
- Measured across Qwen3-4B, DeepSeek-R1-8B, and Phi-4-14B on AIME, HMMT, and GPQA-Diamond benchmarks, Gambit consistently outperformed baselines on accuracy, throughput, and token efficiency at once.
| Method | AIME-25 | AIME-26 | HMMT-24 | HMMT-25 | GPQA | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Tok. (Δ) | Acc | Tok. (Δ) | Acc | Tok. (Δ) | Acc | Tok. (Δ) | Acc | Tok. (Δ) | Acc | |
| Qwen3-4B-Thinking | ||||||||||
| SC@256 | 6.02 | 86.7 | 5.82 | 86.7 | 7.62 | 50.8 | 6.86 | 65.0 | 2.28 | 68.2 |
| Slim-SC | 3.93 (-34.7) | 86.7 | 3.83 (-34.2) | 85.0 | 4.01 (-47.4) | 51.7 | 3.72 (-45.8) | 65.8 | 1.66 (-27.2) | 65.6 |
| DeepConf | 3.27 (-45.7) | 90.0 | 3.19 (-45.2) | 86.7 | 4.28 (-43.8) | 58.3 | 4.15 (-39.5) | 66.7 | 1.52 (-33.3) | 67.6 |
| STEP | 3.96 (-34.2) | 86.7 | 3.51 (-39.7) | 87.5 | 4.02 (-47.2) | 61.7 | 3.88 (-43.4) | 66.7 | 2.09 (-8.3) | 66.9 |
| Gambit (Ours) | 3.07 (-49.0) | 90.0 | 3.45 (-40.7) | 88.3 | 3.00 (-60.6) | 65.0 | 3.49 (-49.1) | 67.5 | 1.83 (-19.7) | 70.2 |
| DeepSeek-R1-8B | ||||||||||
| SC@256 | 6.76 | 83.3 | 6.85 | 83.3 | 8.47 | 55.8 | 7.65 | 70.0 | 2.92 | 67.1 |
| Slim-SC | 5.87 (-13.2) | 83.3 | 6.08 (-11.2) | 83.3 | 7.32 (-13.6) | 55.8 | 6.93 (-9.4) | 70.7 | 2.26 (-22.6) | 67.1 |
| DeepConf | 3.75 (-44.5) | 81.7 | 3.67 (-46.4) | 84.2 | 4.34 (-48.8) | 60.0 | 3.97 (-48.1) | 71.7 | 1.68 (-42.5) | 68.7 |
| STEP | 3.71 (-45.1) | 83.3 | 3.66 (-46.6) | 83.3 | 4.15 (-51.0) | 63.3 | 4.08 (-46.7) | 75.8 | 2.44 (-16.4) | 68.2 |
| Gambit (Ours) | 4.21 (-37.7) | 85.8 | 4.09 (-40.3) | 85.0 | 3.05 (-64.0) | 65.6 | 3.81 (-50.2) | 75.8 | 2.21 (-25.3) | 68.2 |
| Microsoft-Phi | ||||||||||
| SC@256 | 4.24 | 86.7 | 4.20 | 88.5 | 5.43 | 56.7 | 5.56 | 73.3 | 3.05 | 76.3 |
| Slim-SC | 3.43 (-19.1) | 85.0 | 3.50 (-16.7) | 86.7 | 4.72 (-13.1) | 55.7 | 4.48 (-19.4) | 74.2 | 2.24 (-26.6) | 72.3 |
| DeepConf | 2.56 (-39.6) | 85.8 | 2.75 (-34.5) | 86.7 | 2.86 (-47.3) | 57.5 | 3.02 (-45.7) | 74.2 | 1.61 (-47.2) | 74.8 |
| STEP | 2.39 (-43.6) | 87.5 | 2.44 (-41.9) | 90.0 | 2.75 (-49.4) | 56.7 | 2.78 (-50.0) | 75.0 | 2.10 (-31.1) | 76.7 |
| Gambit (Ours) | 1.76 (-58.5) | 88.3 | 1.86 (-55.7) | 90.0 | 1.72 (-68.3) | 58.3 | 1.75 (-68.5) | 75.8 | 1.59 (-47.9) | 77.1 |
| Base Model | System | AIME-25 | AIME-26 | HMMT-24 | HMMT-25 | GPQA |
|---|---|---|---|---|---|---|
| DeepSeek-R1-0528 -Qwen3-8B | STEP + SeqScorer | 83.3 | 84.2 | 61.7 | 75.8 | 66.7 |
| Gambit + SeqScorer | 88.5 (+5.2) | 86.7 (+2.5) | 69.4 (+7.7) | 76.7 (+0.9) | 67.7 (+1.0) | |
| Qwen3-4B -Thinking-2507 | STEP + SeqScorer | 86.7 | 86.7 | 60.0 | 65.0 | 67.1 |
| Gambit + SeqScorer | 90.0 (+3.3) | 87.5 (+0.8) | 61.7 (+1.7) | 65.8 (+0.8) | 68.2 (+1.1) |

| Execution Component | Time (s) | % Wall Clock |
|---|---|---|
| GPU Compute (Forward Pass & Sampling) | 37,851.97 | 99.03% |
| Beam-search Overhead (Scoring & Tree Mgmt) | 370.76 | 0.97% |
| Total Wall Clock | 38,222.73 | 100.00% |
![Figure 4: End-to-end pipeline of Gambit on an AIME problem (capacity C=5, swap size K=2). During warmup, C=5 parallel traces are evaluated (color intensity denotes running score s¯∈[0,1]). Every Δ steps, a tournament ranks the active traces: the K=2 lowest-scoring traces are pruned (×) and replaced by new branches spawned from the highest-scoring prefixes via prefix caching (green arrows). This zero-sum reallocation maintains exactly C active traces throughout generation. Upon completion, answers are aggregated via a score-weighted majority vote, correctly selecting answer 29 (∑s¯=1.78 vs. 1.43).](https://media.metallab.ai/papers/2608.08020/f3.png)
| AIME-25 | AIME-26 | HMMT-24 | HMMT-25 | GPQA | ||
|---|---|---|---|---|---|---|
| Qwen3-4B-Thinking-2507 | ||||||
| Tokens (K) | SC | 6,023 | 5,817 | 7,622 | 6,857 | 2,276 |
| Slim-SC | 3,930 | 3,829 | 4,010 | 3,723 | 1,659 | |
| DeepConf | 3,266 | 3,192 | 4,278 | 4,148 | 1,516 | |
| STEP | 3,960 | 3,506 | 4,023 | 3,884 | 2,089 | |
| Gambit (Ours) | 3,071 | 3,449 | 3,002 | 3,493 | 1,826 | |
| Latency (s) | SC | 3,465 | 3,338 | 5,358 | 4,313 | 593 |
| Slim-SC | 1,905 | 1,841 | 2,412 | 1,995 | 555 | |
| DeepConf | 2,095 | 2,188 | 3,231 | 2,948 | 605 | |
| STEP | 1,390 | 1,232 | 2,016 | 1,507 | 786 | |
| Gambit (Ours) | 1,350 | 1,177 | 1,912 | 2,179 | 527 | |
| DeepSeek-R1-0528-Qwen3-8B | ||||||
| Tokens (K) | SC | 6,764 | 6,849 | 8,465 | 7,652 | 2,919 |
| Slim-SC | 5,874 | 6,080 | 7,323 | 6,933 | 2,256 | |
| DeepConf | 3,753 | 3,666 | 4,337 | 3,972 | 1,679 | |
| STEP | 3,711 | 3,661 | 4,147 | 4,077 | 2,444 | |
| Gambit (Ours) | 4,211 | 4,089 | 3,053 | 3,806 | 2,211 | |
| Latency (s) | SC | 4,078 | 4,107 | 5,640 | 4,873 | 880 |
| Slim-SC | 3,462 | 3,564 | 5,071 | 4,342 | 771 | |
| DeepConf | 2,692 | 2,582 | 3,256 | 2,800 | 744 | |
| STEP | 1,519 | 1,469 | 1,902 | 1,715 | 730 | |
| Gambit (Ours) | 1,571 | 1,842 | 2,014 | 2,169 | 702 | |
| Phi-4 | ||||||
| Tokens (K) | SC | 4,243 | 4,198 | 5,426 | 5,559 | 3,050 |
| Slim-SC | 3,426 | 3,503 | 4,716 | 4,482 | 2,242 | |
| DeepConf | 2,557 | 2,749 | 2,860 | 3,022 | 1,608 | |
| STEP | 2,390 | 2,435 | 2,754 | 2,780 | 2,097 | |
| Gambit (Ours) | 1,756 | 1,855 | 1,717 | 1,752 | 1,590 | |
| Latency (s) | SC | 2,760 | 2,636 | 3,848 | 4,046 | 1,730 |
| Slim-SC | 2,123 | 2,166 | 3,069 | 2,704 | 1,048 |
Findings
- Under identical hardware constraints, Gambit improved accuracy over the pruning-only baseline STEP by up to +6.7 points on HMMT-24 and +3.3 points on AIME-25.
- Relative to standard parallel sampling (Self-Consistency), Gambit reduced total token consumption by up to 68.5% (Phi-4 on HMMT-25: 1.75M vs 5.56M tokens) and delivered more than 2x higher trace-completion throughput (0.216 vs 0.098 on Qwen3-4B).
- On the 4B model, Gambit matched the tightly calibrated DeepConf baseline on AIME-25 (90.0%) while outperforming it on HMMT-24 (+6.7 points) and GPQA (+2.6 points).
- The algorithmic overhead of the beam search mechanism itself was measured at under 1% (0.97%) of total wall-clock execution time, confirming it does not create a systems bottleneck.
- In a case study on one AIME 2025 problem, doubling the sample budget with plain parallel sampling (n=512) still failed to find the correct answer, while Gambit reached it using far fewer generated tokens.
Where it can be used
- Could be applied as an inference-time compute allocation strategy for competition-level math or graduate-level science problems where correct traces are rare and reasoning chains are long.
- Relevant for operators of LLM serving engines like vLLM who want to reduce both KV-cache memory pressure and idle GPU time simultaneously.
- Systems already using lightweight internal scoring signals like STEP or DeepConf could consider replacing pure pruning with active branch reallocation based on this idea.
Limits and open work
- Results were measured only on math/science competition benchmarks (AIME, HMMT, GPQA-Diamond) with specific open-weight models (Qwen3-4B, DeepSeek-R1-8B, Phi-4-14B); generalization to other domains or much larger models is not reported.
- Performance depends on the quality of the scoring function; the paper only compares STEP's off-the-shelf MLP scorer and its own trained sequence scorer.
- Scoring and checkpointing are deliberately withheld until a warmup threshold (w=12K tokens) because early reasoning signals are noisy; whether this threshold generalizes to other problem types is not separately validated.
- Results were measured on a single NVIDIA B300 GPU; reproduction across multi-GPU setups or other hardware generations is not reported in the paper.
Why it matters
The biggest cost of deploying reasoning-heavy AI models is the GPU time and memory spent generating many candidate answers to boost accuracy. Gambit shows a concrete way to get higher accuracy, faster completion, and lower token usage on the same hardware, which matters directly for anyone optimizing inference cost of reasoning models.
Terms in this paper
- Self-Consistency · A technique that samples multiple independent reasoning traces for the same question and picks the final answer by majority vote
- KV-cache · Memory that stores a transformer's previously computed key/value vectors so they can be reused when generating the next tokens
- beam search · A search strategy that keeps only the top-scoring candidate paths at each step; here applied at the level of 'thoughts' rather than individual tokens
- pruning · Terminating a reasoning trace early when it's judged unlikely to succeed, to save compute
- hidden state · An internal representation vector produced by the model's layers, used here as a lightweight signal to score how promising a partial trace is
Original abstract (English)
Test-time compute scaling is a primary driver of performance in large reasoning models (LRMs), but extreme inefficiency bounds current approaches, shifting the critical question from how much compute to spend, to where to allocate it. We formalize test-time reasoning as a constrained compute allocation problem over partial trajectories. Under a fixed hardware budget, existing paradigms fail to actively allocate the compute to the most promising partial progress: traditional parallel sampling treats traces independently and induces severe memory bottlenecks, while subtractive pruning starves hardware and fails to actively and sufficiently shift the output distribution. To overcome this dichotomy, we introduce Gambit, an inference algorithm that executes thought-level beam search. By periodically pruning unpromising trajectories and immediately branching from high-quality prefixes, Gambit dynamically concentrates compute onto the most promising reasoning traces via a light-weight scorer probing hidden states while maintaining continuous high hardware utilization. Extensive evaluations across multiple models and benchmarks demonstrate that Gambit strictly dominates existing baselines. Under identical hardware constraints, our method yields up to a +6.7\% absolute accuracy gain on HMMT-24 and +3.3\% on AIME-25 over pruning baselines, delivers >2times higher throughput on trace completion, and reduces total token consumption by up to 68.5\% relative to standard parallel sampling.
Read on arXivLatest papers
- SWE-bench Science: Can Coding Agents Resolve Engineering Tasks in Science?AI coding agents were tested on fixing real scientific software, and even the best one failed more than half the time
- FlashPrefill V2: Block-Sparse Prefill Attention for Long-Context LLM ServingMaking sparse attention fast enough and accurate enough for real LLM serving, not just papers
- PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM AgentsMaking customer-service AI agents follow the whole procedure, not just avoid one bad action
- EXIMO: VLM Guided Exploration of VLA PoliciesTeaching a robot new chores without human teleoperation, by letting a chatty AI supervise it
- EnvHarness: Awakening Static Worlds for Agent LearningInstead of building new training worlds from scratch, this work adds a plug-in layer that reshapes existing ones around each agent's actual weaknesses
- Bounded Sovereignty and the Control Tax: Pricing AI Oversight When the Deployer Does Not Own the ModelCompanies that rent AI instead of owning it can only do half of AI safety oversight
- Beyond Imitation: Filtering On-Policy Distillation by Reasoning ProgressA fix for AI models that get penalized by their teacher even when they're reasoning correctly
- PersonalBench: Measuring the Authorship Gap in LLM PersonalizationAI can be prompted to write 'like someone,' but its own voice never fully disappears
Latest from METAL MEDIA
Figures: Lijie Yang et al., arXiv:2608.08020, CC BY-SA 4.0