Manuscript Offprint

arXiv:2611.05345

Adversarial Speculative Reasoning Improves Long Horizon Agents

Hongyin Luo, Wei Fang, Lijie Yang, Owen Stepan, Daniel Suit, Jeff Krapf, Dana Wensberg, Jack O'Brien

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Speculative decoding has been treated purely as a systems optimization that speeds up large language model decoding without changing the model behavior. Under this view, the growing effort to train better draft models has been focused solely on acceptance rate. We argue that this view does not hold true for long-horizon agent reasoning. Measuring frontier open-weight models on complex agentic tasks with different speculative decoding approaches, we found that numerical noise grows within verification windows, and the draft acceptance results of the thinking process can change the output distribution of the model after 30 steps, thus noticeably influencing the reasoning accuracy of long-horizon agents in random directions. In this work, we improve the reasoning capability of target models by controlling such noise. While we cannot change the overall token distribution verified by the target model, we can encode critical reasoning with highest precision by training the draft model to be rejected. We identify these points in agent traces and train the draft model to favor adversarial preference. At inference the trained draft and the target part ways precisely at these decision points, verification restarts, so that critical thinking tokens are sampled from the target model and encoded under its least noisy conditions. This approach makes critical reasoning better indexed and more durable over a long horizon. On complex agentic coding benchmarks, our approach raises end-to-end success rate with no change to the target model or its output distribution. Our results recast the speculative decoding mechanism from a pure accelerator into an active allocator for context precision that improves the accuracy of long-horizon agents by training 0.06% to 0.28% of hosted parameters.

(a) Precision inside a verify block

Figure

(b) Where the decision is committed decision point

(c) Long-horizon coding tasks

Figure

1 INTRODUCTION

Speculative decoding has become a popular way to serve large language models (Leviathan et al., 2023; Chen et al., 2023; Cheng et al., 2026). A small draft model proposes a block of tokens, the large target model scores the whole block in one forward pass, and a rejection-sampling rule accepts a prefix of the block. When a draft token is rejected, the rule resamples that position from a residual distribution.

The output is guaranteed to follow the target model's distribution. Because of this constraint, speculative decoding is treated as an optimization solely for decoding speed, and earlier studies on better drafts, from EAGLE-style feature drafters (Li et al., 2024) to block-parallel drafters (Chen et al., 2026b; Cheng et al., 2026), measure success by a single number: how many tokens the target accepts per verification step.

However, the theoretical guarantee is stated for an idealized target, a fixed function from a prefix to a distribution. Frontier models are not hosted that way. They are served with low-precision weights, quantized key-value (KV) caches and sparse attention, and their inference outputs are not bitwise-reproducible. In this regime, the target's logits are a noisy quantity depending on how the computation is laid out, and is relevant to the draft acceptance length. We measure this directly by rerunning the same forward pass on an identical prefix and compare the top-k log-probabilities. On GLM-5.3 (GLM-5-Team et al., 2026) with an 8-token DFlash verification block, the first slot of the block is exactly as noisy as single-token decoding. Beyond the first slot, the noise increases with each position in the block, by roughly 4% per slot, and large deviations grow faster still: by the last slot, log-probability shifts of more than 2 natural-log units (nats) are nearly twice as common as at the first. DeepSeek-V4.1-Flash-1017 (Xu et al. 2026; referred to in this study as DeepSeek-V4.1-Flash) with a 6-token DSPARK block shows the same pattern. Its absolute noise is about half that of GLM-5.3, but it grows at the same relative rate of roughly 4% per slot. Speculative verification is therefore lossless in distribution but not neutral in precision: where a token sits in a verification block determines how precisely the target encodes it.

This matters most for long-horizon agents. A software-engineering agent runs for dozens to hundreds of turns over thousands to millions of tokens. Every token it generates is encoded and committed to the KV cache and read back by everything that follows. Most of these tokens can carry higher noises without hurting future reasoning, but some are not, especially for those critical phrases in the thinking process where the model frames a decision in its thinking, for example, as a matter of principle and evidence, as a guess about what is likely or risky, or settling a confusion by guessing, reading, or running tests. In our audit of agentic coding traces, principle-, evidence-framed, or actual test-driven decisions took the correct side about twice higher than likelihood- or risk-guided reasoning. It is worth noting that these decisions are not necessarily persistent across the lifespan of the entire agentic task. Some wrong decisions can be flipped according to environmental feedback signals, while correct ones could be ignored in long-horizon tasks.

These observations suggest a lever that the lossless view hides. We cannot change the distribution the target verifies, and we do not want to. However, we can decide where each token comes from to re-allocate context precision by training the draft model to be rejected. An accepted draft token is committed with the precision of whichever slot verified it. A rejected token is resampled by the target, its entry is written at the head of a fresh verification block, and the verification of everything after it restarts from the least noisy slot. A draft that is rejected exactly at critical

reasoning phrases therefore routes the decisions that matter through the target's most precise path. It leaves the routine thinking tokens to ordinary acceleration.

We call this approach Adversarial Speculative Reasoning. We locate critical thinking in agent traces and build preference pairs between alternative decision framings. We then train the draft with direct preference optimization (DPO; Rafailov et al., 2023) in the reverse direction: the draft learns to prefer the framing the target should avoid. At inference, the draft and the target diverge precisely at these points, so the target's own choice is committed through residual sampling and encoded precisely in the KV cache. The target model is unchanged, and so is the verification rule and its exactness guarantee. Only the draft model is changed and context precision is re-allocated. With this approach, we significantly improve long-horizon agent reasoning accuracy without hurting inference efficiency. For example, on DeepSWE (Huang & Jiang, 2026), a benchmark of complex software-engineering tasks, Adversarial Speculative Reasoning raises the end-to-end success rate of GLM-5.3-nvfp4 from 60.6% to 67.6% (+7.0 points). It raises DeepSeek-V4.1-Flash from 67.8% to 71.8% (+4.0 points) with the standard evaluation harness and environments. Overall, we make the following contributions:

  1. We show that speculative verification is lossless in distribution but not uniform in numerical precision. Noise grows with slot position inside a verification block, appearing in two frontier models with different draft architectures.

  2. We recast the draft model from an accelerator into an allocator of context precision. Draft acceptance decides which tokens are committed through low-noise residual sampling, a degree of freedom that is traditionally treated as irrelevant.

  3. We introduce reverse-direction preference training of the draft at decision points, so that the target model writes the decisions that shape a long-horizon trajectory.

  4. We improve end-to-end success on long-horizon software-engineering agentic tasks for two frontier models, with no change to the target model or to the exactness of verification.

References (25)