Harvard Teaches Frozen LLMs to Pick Their Own Sampling Strategy per Token
Researchers from Harvard, UC Berkeley, and Amazon introduce RL-trained decoding adapters that dynamically switch sampling strategies mid-generation, boosting math accuracy by over 10% without touching model weights.
ProTakeaways
- Researchers from Harvard, UC Berkeley, and Amazon publish a method paper introducing Learned Decoding Adapters -- small RL-trained policies that dynamically select sampling strategies for frozen LLMs.
- Two adapter types: a sequence-level adapter (one strategy per prompt) and a token-level adapter (one strategy per token), both trained with REINFORCE using only task-correctness rewards.
- Token-level adapter achieves +10.2% Pass@1 on the MATH benchmark over the best static decoding baseline under a fixed token budget.
- Sequence-level adapter yields up to +33% relative improvement on CodeContests with mixed CoT prompting and budget conditioning.
- Neither adapter modifies the base LLM; they are tiny 3-layer MLPs reading from frozen model hidden states, making them cheap to train and deploy.
- No code or weights released; experiments use Qwen3-4B as the primary model with additional results on Qwen3-8B and Qwen2.5-Math-1.5B.
Every time an LLM generates a token, it draws from a probability distribution shaped by a handful of fixed knobs: temperature, top-p, top-k, min-p. Those knobs are set once, before generation starts, and held constant for the entire response. A new paper from researchers at Harvard, UC Berkeley, and Amazon argues that this is a fundamental mismatch -- and proposes a learned system to fix it.
The work, titled "Learning Adaptive LLM Decoding", introduces Learned Decoding Adapters: small, lightweight policies trained with reinforcement learning that sit on top of a frozen language model and dynamically choose which sampling strategy to use -- either once per prompt, or at every single token step.
The blunt-instrument problem
In current practice, decoding relies on fixed sampling hyperparameters such as temperature, top-k, and top-p, chosen statically for an entire model or dataset -- ignoring the substantial heterogeneity across prompts, reasoning styles, and even individual tokens. This matters more than it might seem. Recent research has identified so-called "forking tokens" in reasoning chains: a small number of high-entropy decision points that disproportionately determine whether a multi-step solution succeeds or fails. Applying the same sampling strategy to a routine arithmetic step and a pivotal logical branch is wasteful at best, and harmful at worst.
In widely used open-source RLVR frameworks, decoding hyperparameters such as temperature, top-k, and top-p are typically treated as fixed generation settings rather than learnable or adaptive components of the policy. In practice, these hyperparameters are often adjusted post hoc at inference time to trade off accuracy, diversity, and computational cost. The result is a train-test mismatch: models are optimized under one decoding regime and deployed under another.
Two adapters, two levels of control
The paper introduces two complementary adapter designs that operate at different granularities:
- Sequence-level adapter: Picks one decoding strategy for the entire generation. Framed as a contextual bandit problem -- a setting where a policy picks a single action per context and receives a reward at the end, with no intermediate feedback. The adapter reads the prompt embedding and the available parallel sampling budget, then selects from a small set of pre-screened decoding configurations (combinations of temperature, top-k, top-p, and min-p).
- Token-level adapter: Picks a decoding strategy at every single token step. Framed as a partially observable Markov decision process (POMDP) -- the adapter can't see the full generation state, only a compressed view of the model's internal hidden states and the remaining token budget. It can switch between greedy decoding and various temperature settings dynamically within a single response.

Crucially, neither adapter modifies the underlying language model. The LLM is completely frozen. The adapters are tiny MLPs (3-layer networks with SiLU activations) that read features from the frozen model and output a probability distribution over decoding strategies.
Training with nothing but task rewards
Both adapters are trained using REINFORCE, a classic policy-gradient algorithm. Rather than fine-tuning the language model itself, the approach introduces lightweight decoding adapters trained with reinforcement learning and verifiable terminal rewards -- such as correctness on math and coding tasks. There are no learned reward models, no human preference labels, and no hand-designed heuristics. The only signal is: did the final answer come out right?
The action space isn't arbitrary. The team starts with a pool of 180 candidate decoding configurations (a grid over temperature, top-k, top-p, and min-p values) and uses a greedy coverage-based selection procedure to pick a small, diverse subset. The goal is to find strategies that complement each other -- succeeding on different subsets of inputs -- rather than picking the top-N strategies by average performance, which tend to be redundant.
One key training stability trick for the token-level adapter: the team masks tokens whose next-token distribution is already highly concentrated (max probability above 0.95). These tokens contribute little learning signal but add a lot of gradient noise. Without this, token-level training was unstable.
The numbers
The token-level adapter substantially outperforms all static decoding strategies on the MATH benchmark. Specifically:
- Token-level adapter with budget conditioning: +10.2% Pass@1 over the best static baseline on MATH
- Token-level adapter without budget conditioning: still +6.7% Pass@1
- Sequence-level adapter on MATH: +2-3% gains under fixed parallel sampling
- Sequence-level adapter on CodeContests: up to +33% relative improvement in Pass@1 with mixed CoT prompting and budget conditioning

The team also tested out-of-domain generalization: a sequence-level adapter trained on MATH was evaluated on AIME 2025 (a harder math competition dataset) without any additional tuning. Results show the MATH-trained sequence-level adapter remains competitive and can improve over reported baselines, supporting the view that the learned strategy-selection policy captures transferable signals beyond the training distribution.
What the adapter actually learns
One natural hypothesis is that the token-level adapter is just learning a simple entropy heuristic: be greedy when the model is confident, explore when it's uncertain. The team tested this directly by training an ablation where the adapter only sees token entropy, not the full hidden-state representation. This entropy-only policy reaches a validation reward of 72.03, comparable to static decoding baselines but far below the full token-level adapter, which exceeds 80% Pass@1. So entropy is correlated with the right behavior, but it's not sufficient -- the adapter is learning something richer from the model's internal representations.
Qualitatively, the learned policy tends to collapse low-entropy tokens to near-deterministic behavior more often, while preserving stochasticity on high-entropy tokens. But the researchers are careful to note they couldn't find a simple rule that fully explains the policy's behavior -- the gains come from context-sensitive deviations that don't reduce to a clean heuristic.
Where it fits and where it doesn't
This approach is most useful when:
- You're running inference under a fixed compute budget (token budget or parallel sampling budget) and want to squeeze more accuracy out of it
- You're working with reasoning-heavy tasks like math or competitive programming where uncertainty is unevenly distributed across a response
- You want to improve a frozen model without any fine-tuning
It's less suited for:
- Tasks where the base model is already near-ceiling -- the adapter improves the accuracy-budget tradeoff, not raw capability
- Settings where you need a single universal adapter across very different domains; the paper shows mixed-domain training yields smaller gains than single-domain training
- Continuous or very large action spaces -- the framework currently requires a finite, pre-selected set of decoding strategies
The bigger picture
Despite progress in LLM capabilities, inference remains a major computational bottleneck. A key source of inefficiency lies in decoding, the process by which a model samples output tokens from its predictive distribution. Most of the recent effort to improve reasoning has gone into training better models or generating more samples at test time. This paper carves out a third axis: learning how to sample, not just how much.
No code or model weights have been released alongside the paper. The adapter architecture is straightforward enough to reimplement -- a small MLP reading from the frozen LLM's hidden states -- and the paper includes full pseudocode for both the sequence-level and token-level training loops. The experiments use Qwen3-4B as the primary base model, with additional results on Qwen3-8B and Qwen2.5-Math-1.5B.