Lookahead decoding makes a language model look before it leaps. At each step it tries several candidate next tokens, writes a short imagined continuation for each, scores those continuations with a reward or constraint checker, and only then commits a token. This repairs many failures of plain greedy generation, such as missed keywords, broken format slots, and unsafe completions. The cost is high. The number of model forward passes grows with sequence length times the number of candidates times the lookahead depth, and decoding-time alignment of this kind is reported to run 2 to 5 times slower than greedy decoding (DeAL). Every existing method pays this cost at every token, even though the imagined futures computed at step $t$ already contain a plan for steps $t+1, \dots, t+D$, and that plan usually remains correct.
We propose treating lookahead decoding the way time-varying optimization treats a moving target. In that field, prediction-correction methods do not re-solve from scratch at every sampling instant. They push the current solution forward along its predicted path, apply a cheap correction, and, in the self-triggered variant, decide when to resample by checking a bound on how fast the error can grow (Self-Triggered Time-Varying Convex Optimization). Transferred to decoding, a full lookahead produces a short plan. The decoder then commits that plan's tokens for free while running only cheap checks. It replans only when an online estimate of how quickly the winning plan's advantage erodes says the plan can no longer be trusted. The main claim is a measurable one: at matched constraint satisfaction, this rule needs substantially fewer forward passes than every-step lookahead. It should also beat the obvious cheaper schedules, namely replanning every $m$ tokens or replanning when the model is uncertain, on the same compute budget.
Core Claim and Mechanism
A full lookahead at step $t_k$ produces, for each of $B$ candidate tokens, a rollout of $D$ future tokens and a score $s(c)$. The rollout of the winning candidate is a $D$-token plan. Its tokens were already generated during the rollout, along with the model's full next-token distributions at each of those positions. Committing them therefore costs no extra forward passes. The only question is how far into the plan to commit before replanning. This is the analogue of the predictor step in prediction-correction methods (Prediction-Correction Methods for Time-Varying Convex Optimization): the winning rollout is the feedforward guess of where the optimal path is going.
The correction step uses only signals that are already cached or nearly free. These are the model's own distribution at each committed position, including its entropy and the gap between the planned token and the runner-up, and the constraint or reward check on the committed prefix. For lexical constraints that check is a string match. For a reward model it is one scoring pass on a short prefix.
The trigger decides when to stop trusting the plan. Let $m_k = s(c^{(1)}) - s(c^{(2)})$ be the margin between the best and second-best candidate scores at the last full lookahead. Let $\hat{L}$ be an estimate of how much a candidate's score changes per committed token. We replan at the first step $t > t_k$ where
$$ m_k - 2\hat{L}\,(t - t_k) - \gamma\, u_t \le \epsilon, $$
Here $u_t$ is the local uncertainty at the current committed position, measured by the cached entropy. The parameter $\gamma$ weights that uncertainty, and $\epsilon$ is the user's tolerance. The factor 2 is there because the leading and trailing scores can each drift toward the other.
This is the structure of the triggering function in Self-Triggered Time-Varying Convex Optimization, with one important change. That paper requires Lipschitz and derivative bounds known in advance, which the file lists as an open problem for black-box settings. We do not have such bounds for a transformer, so we estimate $\hat{L}$ online. Each replan reveals how far scores actually moved since the last one. Because reward-model scores are noisy, a raw difference would make the trigger erratic. We therefore smooth these observations with a moving average, following Maity et al.. They show that naive finite differences of noisy time-varying signals blow up as intervals shrink, and that moving averages restore a useful bias-variance balance.
We make no claim to carry over convergence guarantees. Those results assume strong convexity and smoothness, and decoding has neither. Our claim is empirical. Lookahead scores along a generation trajectory drift slowly and predictably enough that a drift-aware trigger allocates replanning better than uniform or uncertainty-only schedules. A direct measurement makes this falsifiable. We define tracking error as the fraction of committed tokens that differ from what full every-step lookahead would have chosen from the same prefix. The method succeeds if $\epsilon$ actually controls this quantity.
Relation to Prior Work
The work that motivates the proposal establishes both the value and the cost of lookahead. DeAL expands top-$k$ tokens with short rollouts scored by modular rewards. It reaches a 1.00 harmlessness score on HarmfulQ and keeps 73% harmlessness under continuation attacks, where safety prompting falls to 20%, at the 2 to 5 times slowdown noted above. NeuroLogic A*esque Decoding adds future-cost heuristics to beam search for lexical constraints and finds that a single greedy rollout is the best cost-quality trade-off. Tree-search variants guided by discriminators or value models (MCTS-guided constrained generation, value-guided MCTS with PPO, KCTS) are more expensive still. All of these re-run lookahead at every token and throw away the previous step's rollouts. We keep their scoring functions unchanged and change only when lookahead is run.
Two lines of work constrain the design. Best-First Beam Search cuts model calls by 58% with outputs identical to beam search. Its savings depend on scores that decrease monotonically with length, which reward-guided lookahead lacks. We therefore give up exactness and measure the error we accept instead. Select to Think shows that small models usually have the right token in their top-8 (95% for 1.5B models) and spend extra compute only at "divergence points" chosen by a trained classifier. Its trigger is the closest existing selective-compute mechanism. It differs from ours in three ways: it re-ranks with zero lookahead depth, it needs a trained detector per model, and it has no notion of drift since the last evaluation. We include a version of it as a baseline.
Finally, DeRa is a reminder that decoding-time control often doubles cost by itself. It runs two models per token. It is orthogonal to our method rather than a competitor.
Research Program
The first phase is diagnostic and decides whether the project should continue. We run full every-step lookahead in the style of DeAL on CommonGen, E2ENLG and HarmfulQ, and log every candidate's score at every step. From these logs we measure three things. The first is how often the winning plan from step $t$ still contains the token full lookahead would pick at $t+1, t+2, \dots$. The second is the distribution of per-token score drift. The third is whether drift is predictable from the margin and from local entropy. If plans go stale after one or two tokens for most positions, the opportunity is small and we stop.
The second phase builds the decoder. It has three parts: plan commitment from cached rollouts, cheap per-token corrections, and the trigger above with the moving-average drift estimate. It runs as a wrapper around an existing lookahead implementation, so the scoring functions are reused unchanged.
The third phase compares the method against the alternatives on compute-matched curves of quality against forward passes. It also tests whether tracking error responds to $\epsilon$ in a controlled way. Base models are an open small instruction model and a mid-sized one. The lookahead width $B$ and depth $D$ are fixed to the values used by the full-lookahead reference.
Baselines
The naive reference point is greedy decoding. It costs one forward pass per token and sets the floor on constraint satisfaction. On E2ENLG, standard search reaches only 73.6% few-shot constraint coverage, against 100% for NeuroLogic* (NeuroLogic A*esque Decoding). This shows how much lookahead is buying.
The strongest existing method is full every-step lookahead. On HarmfulQ and HH-RLHF we use DeAL's top-$k$ rollout scheme with its reward functions. On CommonGen, E2ENLG and WMT17 terminology we use NeuroLogic* with greedy lookahead. The reported figures are 1.00 harmlessness on HarmfulQ and 73% under continuation attacks (DeAL), METEOR 29.6 on unsupervised CommonGen, 100% few-shot coverage on E2ENLG, and 96.5% terminology use on WMT17 (NeuroLogic A*esque Decoding). Those numbers come from those papers' own models. We therefore re-run both methods on our base models with identical $B$, $D$, reward models and prompts. The re-run quality becomes the target, and its forward-pass count is the cost to beat. Beating this baseline means staying within one point of its constraint coverage, or within 0.02 harmlessness, while using at most half its forward passes. That would bring the 2 to 5 times overhead most of the way back toward greedy cost.
Two cheaper schedules isolate the trigger. Fixed-stride replanning runs full lookahead every $m$ tokens and commits the winning plan between replans. It is the periodic-sampling scheme that the self-triggered literature argues against. Entropy-triggered replanning runs lookahead only when the model's next-token entropy exceeds a threshold. As a stand-in for Select to Think's divergence trigger, we also train a small classifier to predict, from hidden states, the steps where full lookahead disagrees with greedy. For each baseline we sweep its single knob ($m$, the entropy threshold, or the classifier threshold) across the same range of forward-pass budgets as our $\epsilon$ sweep. We give every method the same number of tuning runs on a held-out split. Comparison is at matched budget along the whole curve.
Three ablations isolate the key ingredient. The first drops the drift term ($\hat{L} = 0$), leaving margin plus entropy. The second replaces the moving average with a raw last-interval difference, testing the noise argument of Maity et al.. The third removes the cheap per-token correction, leaving trigger-only.
Why not just…?
Why not just replan every few tokens? This is the most serious threat. If score drift is roughly uniform across a generation, a well-chosen fixed stride will match any adaptive rule. The self-triggered optimization results show adaptive sampling beating periodic sampling by large factors, but only for continuous trajectories with known bounds (Self-Triggered Time-Varying Convex Optimization), so they do not settle the question for text. The phase-one drift logs will show whether drift is bursty, for example concentrated near clause boundaries or where constraints are satisfied. The compute-matched curves settle the question directly. If fixed stride lies on our curve, we will report that the simple schedule suffices and that the useful finding is plan reuse itself.
Why not just trigger on the model's uncertainty? Entropy is free, and Select to Think shows that selective invocation at divergence points works well for reasoning. But entropy measures the model's local doubt, not whether the reward ranking is about to flip. A confident model can walk confidently into a constraint violation, which is exactly the failure that lookahead exists to catch. Our trigger includes entropy as one term. The ablation that removes the margin and drift terms measures what they add. If entropy alone matches the full trigger, the drift machinery is unnecessary, and we will say so.
Why not just train a value head to replace rollouts entirely? A learned value model removes rollouts, as in value-guided MCTS. It has to be trained for each reward and constraint family, however, and that gives up the plug-in modularity that makes DeAL attractive. The value-guided MCTS work also reports that compute remains high despite caching. Our method needs no training and is complementary: it could equally decide when to query a value head.
Why not just shrink the beam or the depth? Lower $B$ or $D$ cuts cost uniformly and loses foresight uniformly. NeuroLogic* already found that one greedy rollout is the cheapest configuration that still works well. We include reduced-$D$ full lookahead as an additional point on the compute-quality plot so the comparison is visible.
Decisive Checks
The project succeeds if three things hold together. On at least two of CommonGen, E2ENLG and HarmfulQ, the self-triggered decoder must strictly dominate fixed-stride, entropy-triggered and classifier-triggered schedules along the compute-matched curve, rather than at a single hand-picked point. Tracking error against full lookahead must rise monotonically and predictably as $\epsilon$ is loosened. And the moving-average ablation must show a real gain on the noisy reward-model tasks (HarmfulQ, HH-RLHF) but not on the exact lexical-constraint tasks. That last pattern is what the noise explanation predicts, and seeing it would confirm that the borrowed mechanism, rather than tuning luck, is doing the work. Failure of the phase-one diagnostic, meaning plans going stale within one or two tokens, would end the project early and cheaply.
References
- DeAL: Decoding-time Alignment for Large Language Models
- Self-triggered time-varying convex optimization
- A Class of Prediction-Correction Methods for Time-Varying Convex Optimization
- Predictor-corrector algorithms for stochastic optimization under gradual distribution shift
- NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristics
- Décodage guidé par un discriminateur avec le Monte Carlo Tree Search pour la génération de texte contrainte (Discriminator-guided decoding with Monte Carlo Tree Search for constrained text generation )
- Don't throw away your value model! Generating more preferable text with Value-Guided Monte-Carlo Tree Search decoding
- KCTS: Knowledge-Constrained Tree Search Decoding with Token-Level Hallucination Detection
- Best-First Beam Search
- Select to Think: Unlocking SLM Potential with Local Sufficiency
- Decoding-time Realignment of Language Models