Harness Hub
All papers

LEGOSpec: A Composable and Efficient Framework for Speculative Draft Design and Training

Hanzhen Wang, Jiaming Xu, Guohao Dai

Verdict: Incremental

The controlled component study and the training-efficiency engineering are a modest contribution for speculative-decoding practitioners. The SWA/convolution long-context effect is consistent across Tables II and IV. DFlux itself recombines existing components; the Residual Corrector is a small extension of Selector. The headline gains have three weaknesses: - They mix architecture with a much larger training budget. - They may be inflated by evaluating block7 baseline checkpoints at block size 8. - They are backed by matched-data evidence on only two models, with margins that shrink to 0.03 in places. For agent harness builders the paper is only indirectly relevant.

  • Novelty

    2 out of 5
  • Rigor

    2 out of 5
  • Reproducibility

    3 out of 5
  • Relevance to harnesses

    2 out of 5

TL;DR

A modular trainer for block-style speculative-decoding drafts splits a draft into Context, Backbone, Proposal and Objective parts, runs a one-at-a-time component study, and composes a new draft, DFlux. The headline gains compare a 1.4M-sample DFlux against third-party checkpoints trained on other data, some evaluated at a block size they may not have been trained for. Under matched 80K training the margins shrink, in places to 0.03 tokens. The paper has only indirect value for agent harness builders.

Adversarial review by Harness Hub · Nov 27, 2026 · read full text · Suggest a correction

Original abstract (authors’ text, select to expand)

Speculative decoding accelerates large language model (LLM) generation using a lightweight draft. Existing methods evaluate complete recipes under different training configurations, leaving component effects, interactions, and composition benefits unclear. Therefore, we present LEGOSpec, a composable framework for speculative draft design and training. LEGOSpec decomposes draft models into Context, Backbone, Proposal, and Objective components that share a unified training infrastructure. Using LEGOSpec, we systematically vary components and evaluate selected combinations under matched training conditions to isolate their effects and interactions. These experiments reveal three findings: (1) Different workloads favor different backbones, depending on context length and memory budget, with within-block dependency modeling particularly important for long contexts. (2) Proposal design must balance acceptance and latency. (3) The training objective should match token distributions locally and optimize acceptance length across the block. These findings guide workload-aware configurations and DFlux, a balanced general-purpose draft combining a convolution-equipped SWA--GQA hybrid backbone, Residual Corrector, and hierarchical supervision. Across Qwen and Gemma models, DFlux improves acceptance length over the strongest baseline by up to 13.7% on regular benchmarks and 34.7% on long-context workloads. To support efficient training, LEGOSpec integrates metadata-aware scheduling and asynchronous execution, increasing training throughput by up to 79% and accelerating offline supervision preparation by up to $3.11\times$ over SpecForge.

Authors’ note

11 pages. Code and weights are available at the URL in the paper

Filed undermemoryevaluationllm

Summary

LEGOSpec decomposes DFlash-family block drafts into four swappable parts that share one trainer: - Context: target-feature fusion (DFlash vs DFlare). - Backbone: MHA, GQA, SWA, GDN or MLA, optionally with block-local convolution. - Proposal: Parallel, Markov, RNN, Sequential, Selector, or the new Residual Corrector. - Objective: CE, KL, TV, NLA, Mix, D-PACE or D-PAL. Around a Qwen3-4B reference trained on 80K samples, the authors swap one component at a time (Table II). They report three findings: - Dense attention suits short contexts; SWA and convolution suit 32K–64K contexts. - Proposal design must trade acceptance against latency. - The loss should match distributions locally and aggregate across the block with acceptance-aware weights. From these findings they build DFlux: - 4 SWA layers plus 1 GQA layer, with block-local convolution. - A Residual Corrector that applies low-rank predecessor-conditioned corrections to the top-k candidates. - KL + D-PAL 'hierarchical' supervision. DFlux is trained on 1.4M self-generated samples for 6 epochs on 16 H800s. It is compared with released baseline checkpoints on Qwen3-4B, Qwen3.6-35B-A3B and Gemma4-12B-it (Table III). A separate matched-data comparison at 80K samples covers Qwen3-4B and Qwen3.5-9B (Table VII), and SGLang throughput is reported at T=0 (Table V). On the framework side, the paper adds: - Cost-model-based draft scheduling. - Lookahead grouping and packing of target prefill. - An asynchronous pipeline. Against SpecForge it claims 1.77–1.79x faster training and 3.01–3.11x faster offline supervision preparation.

Key findings

  • Table III: on Qwen3-4B SWE prompts, DFlux mean acceptance length is 4.08 versus 3.03 for DLite, the strongest baseline. This single cell is the source of the 34.7% headline.
  • Table III: the 19.7% regular-benchmark headline is also a single cell. On Qwen3.6-35B-A3B Alpaca, DFlux scores 4.13 versus 3.45 for DFlash2. The Alpaca margin is smaller on Qwen3-4B (4.03 vs 3.57 for DSpark) and on Gemma4-12B-it (4.12 vs 3.72 for DFlash2).
  • Table VII, matched 80K training: the margins shrink. On Qwen3.5-9B Alpaca, DFlux scores 3.09 versus 3.06 for DSpark and 3.05 for DFlash2. On Qwen3.5-9B LCB it scores 4.01 versus 3.86.
  • Table II, against the GQA reference (Regular 4.472, Long 2.450): SWA reaches Long 3.023 and GQA+Conv reaches Long 2.950. SWA drops slightly on Regular (4.422).
  • Table IV, Qwen3-4B: the Hybrid backbone gives most of the Long gain (2.450 to 3.051). Proposal and objective changes add more on Regular (4.480 to 4.618) than on Long (3.051 to 3.123).
  • Table I: DFlare shows no consistent advantage over DFlash; at 80K samples its Long acceptance is 1.623 vs 2.450. It is marginally ahead in two cells: Long 2.496 vs 2.493 at 400K, and Regular 5.082 vs 5.072 at 1M.
  • Table V (T=0, SGLang, three short-context tasks): DFlux speedups over AR are 1.57x–5.62x, and throughput is 4.7–24.2% above the strongest speculative baseline. DLite and DFlash are not included.
  • Section VI-F: training is 1.77–1.79x faster than SpecForge, with 17.1–17.6% lower peak memory. Offline supervision preparation for 400K samples is 3.01x faster on Qwen3-4B and 3.11x faster on Qwen3.5-9B.

The paper at a glance

01Target modelprefill(lookahead-grouped,packed) produceshidden states02Context componentfuses selectedtarget layers03Backbone (4x SWA +1x GQA withblock-local conv)processes the draftblock04Residual Correctorappliespredecessor-conditionedcorrections totop-k candidates…05Objective: aux KLon base logits +D-PAL on finallogits06Cost-modelscheduling andasync pipelinebalance draftworkers07Deployed in SGLangwithrejection-samplingverification
  1. Target model prefill (lookahead-grouped, packed) produces hidden states
  2. Context component fuses selected target layers
  3. Backbone (4x SWA + 1x GQA with block-local conv) processes the draft block
  4. Residual Corrector applies predecessor-conditioned corrections to top-k candidates over full-vocab base logits
  5. Objective: aux KL on base logits + D-PAL on final logits
  6. Cost-model scheduling and async pipeline balance draft workers
  7. Deployed in SGLang with rejection-sampling verification
Fig. 1 — How the paper works, step by step (arXiv:2611.33004).
DFlash1.58 tokensDSpark2.24 tokensDFlash22.96 tokensDLite3.03 tokensDFlux (this paper)4.08 tokens
Fig. 2 — Mean acceptance length on SWE-bench long-coding prompts, Qwen3-4B, T=1, higher is better. Source: Table III, Qwen3-4B row group, SWE column, arXiv:2611.33004.
Data table
Mean acceptance length on SWE-bench long-coding prompts, Qwen3-4B, T=1
Methodtokens
DFlash1.58 tokens
DSpark2.24 tokens
DFlash22.96 tokens
DLite3.03 tokens
DFlux (this paper)4.08 tokens

Why it matters

This is an inference-serving paper about training draft models for speculative decoding, not about agent harnesses. Harness builders who call hosted APIs will never train a drafter, and for them the paper is irrelevant. It matters only to teams that self-host a target model on SGLang to run coding agents with long repository context. For those teams the relevant observation is the long-context one. At 32K–64K tokens, dense-attention drafts accept far fewer tokens: the Table II reference is 2.450 on Long versus 4.472 on Regular. SWA or a SWA–GQA hybrid with convolution recovers part of that gap (Long 3.023 for SWA, 3.051 for the hybrid). However, the paper reports no throughput or latency numbers on long-context or SWE prompts, so the decode-cost benefit for agent loops is inferred rather than measured. The headline DFlux margins are confounded by training-data and evaluation-setup differences. The controlled component study is the more trustworthy part.

Issues (10)

  • High severity

    The headline comparison is confounded by training data and compute. DFlux is trained on 1.4M self-generated samples for 6 epochs on 16 H800s, while the baselines are third-party checkpoints with other data and recipes. The paper's own Fig. 1 states that changing the optimizer or growing the data from 80K to 400K 'can match or exceed the gains from adding a Markov head'. The paper therefore documents the confound and then relies on it for the 13.7%/19.7%/34.7% claims. The matched 80K comparison (Section VI-C, Table VII) has three limits: - It shrinks some margins to near zero (Qwen3.5-9B Alpaca: 3.09 vs 3.06). - It omits DLite, Qwen3.6-35B-A3B and Gemma4-12B-it. - It uses 'shared training hyperparameters' whose provenance is not stated and may be DFlux-tuned. No matched run at 1.4M samples exists.

  • High severity

    The block-size setting may disadvantage the baselines. The evaluation protocol uses block size 8 for all models except the Qwen3-4B DFlash2 checkpoint. Several baseline checkpoints are named block7: deepseek-ai/dflash_qwen3_4b_block7, dspark_qwen3_4b_block7, dflash_gemma4_12b_block7 and dspark_gemma4_12b_block7. If these were trained for a block size of 7, evaluating them at 8 can lower their acceptance and inflate DFlux's Table III margins. The paper does not address this.

  • Medium severity

    The headline numbers are inconsistent and selected from single cells. - The supplied abstract says 'up to 13.7% on regular benchmarks', while the arXiv v2 abstract, introduction and conclusion say 19.7%. - The 19.7% figure is one cell: Qwen3.6-35B-A3B Alpaca, 4.13 vs 3.45. - The 34.7% figure is one cell: Qwen3-4B SWE, 4.08 vs 3.03. Typical margins are smaller; for example, Qwen3.6-35B-A3B SD-QA is 3.58 vs 3.34.

  • Medium severity

    The component study reports a single training run per arm with no variance. Several conclusions rest on small gaps, for example MHA 4.459 vs GQA 4.472, and KL 4.422 vs NLA 4.421. The 'five random seeds' in Table III vary only evaluation sampling, not training, and no spread is reported. Without training-seed variance, the ordering of close components is not established.

  • Medium severity

    Tuning is asymmetric in the 'matched' study. Only MLA received a 10x learning-rate reduction after degraded results; every other arm kept the defaults (Muon 0.01, Adam 6e-4). GDN (Regular 4.226) and the objective variants may be similarly under-tuned, which weakens the backbone and objective rankings.

  • Medium severity

    Contamination is not addressed. The training prompts come from Open-PerfectBlend, Nemotron-Post-Training-Dataset-v2 and WildChat, and the evaluation uses GSM8K, MATH-500, MBPP, Alpaca and MT-Bench. Overlap between training prompts and test prompts would raise acceptance, and could do so unevenly across methods with different training data. No deduplication is reported.

  • Medium severity

    Throughput coverage is partial: - Throughput is measured at T=0, while the acceptance claims are at T=1. - It covers only two target models and three short-context tasks. - There is no long-context or SWE throughput, even though that is where the largest acceptance gain is claimed. - DLite and DFlash are absent. The SpecForge training-speed comparison does not state which draft recipe or SpecForge configuration was run.

  • Low severity

    The DFlare result contradicts DFlare's published results. The authors explain it with a channel-mixing argument rather than validating their reimplementation against the original. A reimplementation gap would also bear on the Context conclusions.

  • Low severity

    The Gemma4-12B-it DFlash2 baseline was trained by the authors, with no reported data or hyperparameters. This adds further uncertainty about baseline quality.

  • Low severity

    There are editorial errors that hinder verification: - Section VI-C and Appendix D cite Table VIII for the matched results, which are actually in Table VII. - Table VII labels a domain 'DHU' where Table III uses SD-QA. - The Table V caption says 'backbend'.

Questions for the authors

  • Were the block7 baseline checkpoints trained with block size 7, and what are their acceptance lengths when evaluated at their native block size?
  • What is DFlux's margin over DFlash2, DSpark and DLite when all are trained on the same 1.4M-sample, 6-epoch recipe?
  • How were the 'shared training hyperparameters' in Section VI-C chosen, and were they tuned on DFlux?
  • What is the variance across training seeds for the Table II comparisons, especially for gaps under 0.05 acceptance length?
  • Was a learning-rate sweep run for any arm other than MLA?
  • Was the training data deduplicated against GSM8K, MATH-500, MBPP, Alpaca, MT-Bench and LCB prompts?
  • What end-to-end throughput does DFlux achieve on the 32K–64K SWE-bench and LongBench-v2 prompts?
  • Which SpecForge version and draft recipe were used for the 1.79x training-speed comparison?
  • Why does the supplied abstract report 13.7% while the paper body reports 19.7%?

Related in the directory

Open-source projects

SWE-bench issue prompts of 32K–64K tokens are the long-coding workload behind the 34.7% acceptance-length claim.

To avoid the quadratic cost of dense attention over long contexts, models such as DeepSeek-V4 and Hy4 have turned natively sparse, and speculative decoding, which matters most where decoding is slowest, increasingly runs on them. Their drafters, however, still keep a context cache of their own, over the whole prompt or a sliding window. Beyond memory, such a cache costs prefill time, prefix-cache hits and decode concurrency. Drafters that read the target's cache avoid one of their own, but settle only which cache, not which positions, and still read everything or a recent window. Neither rule is made for the query at hand, and computing a selection per query in the drafter would cost more as the context grows. Yet a natively sparse target already picks positions for each query, over a cache it keeps anyway. Both of the drafter's choices are therefore already made, and paid for, by the target: its cache and its selection. We measure how far one selection carries: made a step early, it still covers close to nine tenths of what each later token selects on DS-V4.1-Flash. We present DFly2, a block-parallel drafter that shares the target's sparsity. Each draft layer reads the KV its paired target layer cached (KV sharing), at the positions that layer's indexer selected, a fixed number anywhere in the context (Index sharing). DFly2 thus runs no scoring pass and keeps no cache of its own. On DS-V4.1-Flash, GLM-5.3-Flash and Hy4~flash, whose sparse attention and architecture differ, it accepts more tokens per step than DFlash and DSpark trained on the same recipe, over general, long-context and agentic benchmarks. Its margin over the stronger baseline widens from 3.9%-10.5% on general workloads to 10.0%-31.5% on long-context and agentic ones. At high concurrency on DS-V4.1-Flash, at matched per-user decode speed, its throughput is 62% and 81% higher on two 64K sets.

Hong Liu, Rui Cen +11

Although multimodal large language models translate single screenshots into static HTML, generating interactive functional websites from design specifications still struggles with multi-page routing and stateful widget transitions. Examining existing training pipelines reveals two bottlenecks: (1) in forward data synthesis (X -> Y), writing the specification X before code execution leaves unimplemented or altered requirements in X as supervision noise; and (2) in reinforcement learning, scalar rewards discard the rich state transitions observed during replay. Based on these findings, we introduce WebVibe and Interactive-SDPO to train InteractiveCoder. WebVibe reverses synthesis into Y -> X by verifying cross-page and in-page interactions in the browser before deriving multimodal inputs from replay-confirmed states to build the 31,542-site WebVibe-32K corpus with reusable execution contracts. Interactive-SDPO then conditions a weight-sharing self-teacher on the replay trace and a 2x2 state-transition montage to provide token-level supervision at zero inference-time overhead. On the public Vision2Web L2, one-shot InteractiveCoder-9B nearly 3x its base model's functional score (20.2 to 55.2 FS) and matches a 1T-parameter coding agent in a single pass with 111x fewer total parameters and 78x fewer tokens. On our WebVibeBench, InteractiveCoder-4B and 9B further outperform all evaluated baselines by over 23 points.

Tianxiang Jiang, Sheng Xia +9

Large language models (LLMs) can generate parallel programs, but their correctness and performance depend strongly on the instructions that guide generation. We present \textsc{MetaFORGE}, an execution-grounded meta-learning framework that iteratively optimizes persistent natural-language skill specifications for MPI C code generation. \textsc{MetaFORGE} combines correctness testing, compiler diagnostics, static-analysis findings, runtime measurements, and rank-level load-imbalance profiles into a scalar reward that drives textual-gradient refinement, while an external memory distills and retrieves reward-supported optimization knowledge across runs. Across six MPI tasks and three workload sizes, \textsc{MetaFORGE} improves static-analysis quality, runtime, and load balance relative to zero-shot generation and generally exceeds the evaluated \textsc{TextGrad} iterative baseline. A model-matched refinement ablation shows that the MetaFORGE advantage persists when its refinement model is reduced to \texttt{gpt-4o}. An expanded retrieval ablation across all 18 task--workload configurations shows consistent runtime benefit and broad static-analysis and load-balance benefit from retrieved context. Leakage-controlled held-out and zero-update experiments further provide evidence that optimization knowledge persists in both the transferred skill and external memory under the evaluated protocol.

Scott Piersall, Yang Gao +2

Large language model (LLM)-driven agent scaffold evolution improves agent workflows through iterative candidate generation and evaluation. Evaluation both guides subsequent search and determines the final scaffold, but evaluating every candidate on the full task set incurs substantial execution costs. We investigate how evaluation budgets can be allocated across these two roles. Our experiments show that sparse feedback can sustain productive evolution, while additional targeted evaluation improves final selection. Replay analyses further show that shared informative items and a common scoring reference support comparisons among closely matched candidates. Motivated by these findings, we propose \method, an evaluation allocation framework that combines sparse search-time feedback with targeted final confirmation. A short fully evaluated warm-up establishes a shared informative core and calibrates a response model whose item parameters remain fixed during search. After search, \method refits the model and applies paired successive halving, reusing accumulated observations and executing only missing evaluations. Across four benchmarks and two evolution frameworks, \method achieves higher mean performance than full evaluation in most settings while using approximately half as many evaluation cells.

Sichun Luo, Yi Huang +8

We explore how to build performant large language model (LLM) tool-use agents that complete complex, multi-step tasks. Specifically, we study how data composition in synthetically generated tool-use environments affects the training of such agents. To do so, we propose the SynthAPI pipeline, which explicitly controls the diversity of generated environments along the axes of tools, tasks, and the databases on which the tools operate. By systematically varying SynthAPI's generation controls in 458,752 tasks across 849 trained models of four different sizes, we derive a scaling law that predicts downstream tool-use agent generalization based on the scale and composition of the synthesized environments. These predictable relationships reveal several lessons for scaling tool-use agent data. As data budgets grow, scaling tool and database diversity becomes more effective than increasing the number of tasks, and increasing data complexity yields larger gains. Scaling according to these findings yields agents that outperform models trained on data from prior work in large-scale tool-use agent and synthetic environment generation across four evaluation benchmarks.

Andrew Szot, Samira Abnar +6

We present ExtractBench Pro, a schema-guided document extraction benchmark that tests six challenging modes of extraction underrepresented in existing datasets. It is created following a framework for synthetic document generation, in which deterministic document generators assemble challenging components into documents that are designed to be difficult at a level calibrated for frontier systems. We synthesize 100 realistic documents spanning a diverse range of styles. On this data, we evaluate ten coding agents and eight extraction API configurations for accuracy, grounding, and their ability to perfectly extract documents. No extraction system extracts more than 61% of documents error-free. The strongest general-purpose coding agents, Claude Code Opus 5.5 and Codex GPT-6 Astra, outperform specialized extraction APIs on both perfect-document rate and Value F1, but at a higher cost per page. Among specialized extraction APIs, LlamaExtract spans the lower-cost frontier, with Agentic Plus Max Effort approaching the strongest coding agent on both perfect-document rate and Value F1 at lower cost per page. Our analysis of coding agent traces identifies intelligent image processing and programmatic reasoning, but also failures in applying document-specific definitions and recovering relationships from diagrams. We release ExtractBench Pro and these evaluation results as resources for the future development of improved frontier extraction systems.

Boyang Zhang, Justin Xu +3

The Harness Hub newsletter

New harness companies, projects, releases and the monthly State of Harness report, in your inbox.