Learning Adaptive LLM Decoding

Huangyuan Su, Zhe Ye, Samuel Tenka, Aidan Z.h. Yang, Soonho Kong, Udaya Ghai

TL;DR

This paper introduces Learned Decoding Adapters, lightweight policies that dynamically adjust an LLM's sampling strategy (like temperature or top-p) for every prompt or even every token. By training these adapters with reinforcement learning to maximize correctness within a fixed compute budget, the authors achieve massive accuracy boosts—up to 10.2% on math tasks—without ever touching the underlying model's weights.

What Problem Does This Paper Address?

When we "talk" to an LLM, the way it chooses the next word is governed by decoding hyperparameters like temperature (randomness) or top-p (filtering). In standard practice, these are "static knobs": we set them once for the whole dataset.

However, not all prompts are created equal. A simple arithmetic question doesn't need the same "creative" exploration as a complex coding challenge. Furthermore, within a single sentence, some tokens are "forking points"—critical junctions where a wrong choice derails the entire logic—while others are trivial.

The authors argue that static decoding is inefficient. It ignores the available compute budget (how many samples or tokens we can afford) and the inherent uncertainty of the task. The challenge is: how do we learn a policy that knows when to be precise and when to explore?

Methods

The researchers propose Decoding Adapters (DAs): small, separate neural networks that sit on top of a frozen LLM. They explore two flavors of adaptation:

  1. Sequence-Level (Contextual Bandit): The adapter looks at the prompt and the total "parallel budget" (how many different versions of the answer we can generate). It then picks one single decoding strategy (e.g., "use top-p=0.9 and temperature=0.7") for the entire response.
  2. Token-Level (POMDP): This is much more granular. At every single step of generation, the adapter looks at the LLM’s internal hidden states and the remaining token budget. It then decides the specific temperature for just that next token.

The Secret Sauce: These adapters are trained using Reinforcement Learning (REINFORCE). Because the tasks are math and code, the "reward" is simple and verifiable: did the model get the right answer? This allows the adapter to learn "tabula rasa" (from scratch) what strategies lead to success.

Datasets

The authors evaluated their approach on high-difficulty reasoning benchmarks:

  • MATH: A standard benchmark for mathematical problem-solving.
  • CodeContests: Competitive programming problems.
  • AIME’25: Used to test how well a MATH-trained adapter generalizes to brand-new, unseen problems.
  • Models: They primarily used the Qwen3 family (4B and 8B versions) and Qwen2.5-Math.

Key Insights and Ideas

  • Budget Awareness is Key: The adapters actually learn to change their behavior based on how much compute is left. If the token budget is high, the policy is more exploratory; as the budget runs out, it becomes more "greedy" and deterministic to ensure it finishes a valid thought.
  • Token-Level Control is Superior: The "aha moment" is that token-level adaptation is significantly more powerful than sequence-level. It allows the model to "think harder" (be more stochastic) at difficult logical junctions and "cruise" through the easy parts.
  • Entropy Isn't Enough: You might think a simple heuristic like "increase temperature when entropy is high" would work. However, an ablation study showed that a policy seeing only entropy performed much worse than one seeing the full hidden states. The adapter is picking up on subtle structural cues in the model's "thought process" that simple statistics miss.
  • Generalization: Surprisingly, an adapter trained only on math problems still provided gains when tested on coding tasks. This suggests the policy is learning a general "uncertainty management" signal that transcends the specific topic.

Key Results

  • MATH Performance: On the MATH benchmark, the token-level adapter improved Pass@1 accuracy by 10.2% over the best static baseline.
  • Coding Gains: On CodeContests, the sequence-level adapter saw relative gains of 15% to 33% in accuracy under constrained parallel sampling budgets.
  • Efficiency: The adapters are incredibly lightweight (often just a two-layer MLP), meaning they add negligible latency to the inference process while providing a massive boost in "intelligence" per token.

Limitations and Future Work

  • Verifiable Rewards: Currently, the system relies on tasks where the answer is objectively right or wrong (math/code). Applying this to "vibes-based" tasks like creative writing would require a learned reward model (like an RM used in RLHF), which introduces its own biases.
  • Discrete Action Space: The adapters currently choose from a pre-selected menu of strategies (e.g., four specific temperatures). Future work could involve "continuous" control, allowing the adapter to dial in the exact hyperparameter values.
  • Frozen vs. Active: The LLM remains frozen here. The authors suggest that joint training—where the LLM and the adapter learn together—could lead to even tighter integration between "what" the model thinks and "how" it samples.

Summary updated

BibTeX
@inproceedings{su2026learning,
  author = {Huangyuan Su and Zhe Ye and Samuel Tenka and Aidan Z.H. Yang and Soonho Kong and Udaya Ghai},
  title = {{Learning Adaptive LLM Decoding}},
  booktitle = {AdaptFM @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=14yhYy9m7S},
}
Figure