Draft Models for Sparse Attention and Long-Context Decoding
This article explains how draft models can speed up autoregressive decoding when attention is sparse and contexts are long. It covers mask alignment, positional encoding, KV cache layout, training data, capacity choices, evaluation, and inference integration.
Why a Draft Model Is Needed
During autoregressive decoding, a large language model runs a full forward pass at every step. As context grows and attention becomes sparse, the cost of each step rises quickly: more tokens remain effective, the KV cache expands, and bandwidth becomes the bottleneck. A draft model addresses this by using a smaller, faster network to propose several candidate tokens, which the target model then verifies in one pass. Multiple expensive step-by-step decodes are compressed into a smaller mix of drafting and verification.
For sparse attention—especially dynamic sparsity, block sparsity, or routing-based attention—the draft path and the verification path must follow the same mask logic. Otherwise the draft may treat tokens as visible that verification treats as invisible. Acceptance then drops, and generation quality can drift. The problem is sharper in long contexts: if window boundaries, sliding blocks, or the visibility rules for global and local tokens fall out of alignment, the speedup is repeatedly lost to rollbacks.
A draft model for sparse attention and long context is therefore not just a smaller parameter count. It must stay isomorphic to the target model in attention pattern, positional encoding, KV layout, and training objective.
Consistency Constraints Under Sparse Attention
Sparse attention restricts the full attention matrix to a computable set of blocks or indices. Common forms include a fixed local window, periodic global tokens, and content-dependent dynamic selection. If the draft model uses dense attention, it sees extra dependencies in training and inference and learns shortcuts that verification cannot reproduce.
In practice:
- Shared masks. Draft and target forwards should use the same sparse-pattern generator, including block size, window radius, and whether cross-document boundaries are allowed.
- Aligned positional encoding. Base frequencies, scaling, and extrapolation for RoPE or similar rotary encodings should match, so long sequences do not drift in phase and bias the draft.
- Consistent KV cache layout. Blocked, paged, or layer-compressed cache formats should share indexes between draft and target, reducing reorder cost at verification time.
Consistency matters more than how strong the draft network is. In practice, a smaller draft with the same structure often accepts more tokens than a larger draft with a different structure.
Training and Data Issues from Long Context
Long-context training is not just truncating sequences and concatenating them. The draft model must learn to predict the next token under visibility that is dense nearby and sparse far away. On the data side:
- Length curriculum. Increase effective context from short to long. Stabilize local syntax first, then introduce distant reference and cross-segment constraints.
- Document boundary signals. Use clear separators or special tokens so unrelated documents are not treated as one continuous context.
- Reproduced sparse sampling. Sample attention during training with the same sparse rules used at inference. Do not train dense and infer sparse.
- Hard-example weighting. Raise the sampling rate of low-acceptance patterns—code, tables, and long dialogue turns—so short sentences are not accepted far more often than long reasoning.
Beyond standard next-token prediction, auxiliary losses tied to verification can help. Examples include distillation toward the target model’s top-k distribution and a penalty on tokens that will be rejected. The draft should approach the target’s decision boundary, not only the corpus marginal distribution.
Principles for Architecture and Capacity
The draft model must be clearly smaller than the target model, or there is no speedup. Depth, hidden size, and attention-head count are best scaled down proportionally rather than by dropping layers arbitrarily. Under sparse attention, head count interacts with block layout: too few heads may fail to cover multiple sparse patterns, while too many waste bandwidth.
Neutral design points to consider:
- Share the vocabulary and tokenizer so draft and target token spaces stay aligned.
- Optionally share part of the shallow embeddings and keep deeper layers separate, balancing alignment with flexibility.
- Use the same segmentation or recurrent compression strategy as the target on very long sequences, rather than truncating only on the draft side.
Do not invent a specific speedup ratio. Acceptance rate, average accepted length, and end-to-end latency must be measured on the target hardware and real workloads. Gains are usually nonlinear across sparsity and sequence length: on short sequences, draft overhead can erase the benefit; on very long sequences, memory bandwidth dominates.
Engineering Points in the Training Pipeline
A full training path typically includes data cleaning and length bucketing, a sparse-mask implementation aligned with the target model, mixed precision and gradient checkpointing, and activation offloading by layer or by block. The draft model itself is relatively cheap, but it must be compared repeatedly against the target model’s logits, so the verification side can become the training bottleneck. Target forwards can start as an offline cache or a low-frequency sync, then move gradually to online distillation.
Evaluation should cover:
- Acceptance rate on short and long contexts
- Quality metrics at different sparsity levels, matching the target model’s output distribution rather than standalone perplexity alone
- Tail latency after rejection and rollback
- Compatibility with batching and continuous batch decoding
Quality alignment comes before extreme compression. If the draft systematically favors high-frequency words or cuts reasoning chains short, acceptance can look high while users still see logical jumps.
Inference Integration and Operations
The decode loop can be abstracted as: the draft rolls out k candidate tokens, the target model verifies them in parallel, the longest common prefix is accepted, and generation rolls back from the divergence point. The choice of k should follow the sparse attention compute graph. Too large a k amplifies wasted compute; too small a k fails to amortize verification startup cost.
On the operations side, watch KV cache hits, CPU cost of generating sparse indexes, and whether the draft and target share a device or are placed in a pipeline. Monitoring should separate draft latency, verification latency, and the distribution of accepted lengths, so average QPS does not hide the tail.
Summary
A draft model for sparse attention and long context is essentially an isomorphic accelerator: a smaller network that reproduces the target model’s next-step decision under the same visibility constraints. Align masks, positions, and KV layout; raise acceptance with a length curriculum and distribution distillation; then tune draft depth and verification width on real workloads. That is what turns a theoretical speedup into a stable serving experience. These principles can be applied in your own training code and weight-release process as a reproducible, measurable, and iterable approach, without tying the design to one specific product form.
