Grafy News
Try Grafy free

LinearSpec enables faster long-context vision-language decoding

Researchers have introduced LinearSpec, a new speculative decoding method that uses a target model's existing memory to speed up vision-language processing.

Illustration for the news story: LinearSpec enables faster long-context vision-language decodingSource: Grafy Research Lab

Researchers have developed a new method to accelerate the inference of vision-language models (VLMs) by allowing a small "drafter" model to reuse the memory already held by the larger target model. This approach, called LinearSpec, addresses the significant memory and computational overhead typically associated with processing long-context documents and videos.

Why does speculative decoding struggle with long contexts?

Speculative decoding is a technique used to speed up large models by having a smaller, faster model (the drafter) propose a sequence of tokens that the larger model (the target) then verifies in a single pass. While efficient, traditional block drafters like DFlash face scaling issues when dealing with long inputs. According to the research by Haiyu Wang, Sai Qian Zhang, and Steven Li, these drafters must maintain their own separate key-value (KV) cache for the entire prompt.

This requirement creates two primary problems. First, it consumes significant GPU memory, competing with the target model's own cache. Second, the "acceptance length" (the number of tokens the target model actually accepts from the drafter) tends to drop as the document size increases. For example, the researchers noted that DFlash's acceptance length was 31% lower at 128,000 tokens compared to its performance at 8,000 tokens when processing multi-page images.

How does the LinearSpec method work?

LinearSpec changes the relationship between the drafter and the target model by eliminating the need for a separate draft KV cache. Instead of building its own memory from scratch, the drafter reads the target model's memory "in place."

Hybrid VLMs, such as the Qwen3.5 series, utilize a combination of Gated DeltaNet (GDN) layers—which compress context into fixed-size states—and full-attention layers that maintain exact KV caches. LinearSpec is designed to inherit the target model's top four layers (three GDN layers and the final attention layer). Figure 1 shows how the drafter inherits these layers and reads the GDN states and the layer-31 KV cache directly. By using an entry projection to estimate the input for these layers, the drafter can continue the target's existing memory state without the heavy prefill computation required by previous methods.

Figure 1: LinearSpec drafts from the memory a hybrid VLM already keeps, and decodes long page-image documents faster. (a) The drafter inherits the target’s top four layer…
Figure 1. LinearSpec drafts from the memory a hybrid VLM already keeps, and decodes long page-image documents faster. (a) The drafter inherits the target’s top four layers (blue box) and reads its GDN states and the KV cache of its last attention layer. (b) Relative decode speed of LinearSpec over each baseline on 128K-token page-image documents. (c) Acceptance length (AL) on multi-page documents, whose pro… Figure 1 of “LinearSpec: Drafting from the Target's Memory for Long-Context Speculative Decoding in Hybrid Vision-Language Models” by Haiyu Wang, Sai Qian Zhang, Steven Li (arXiv.org), CC BY 4.0.

What are the performance gains of LinearSpec?

In experiments conducted on the Qwen3.5-4B model, LinearSpec demonstrated superior efficiency on long-form inputs. When processing 128,000-token page-image documents, LinearSpec was 17.1% faster than DFlash and 8.6% faster than DSpark. These gains were particularly evident in tasks involving complex visual data, such as answering questions about tables, charts, or figures within a document.

Figure 3 illustrates that the performance advantage of LinearSpec is most pronounced when dealing with "far-dependent" tokens—tokens that require information located deep within the long context. The researchers found that the drafter's inherited layers effectively attend to the specific pages or visual evidence needed to generate correct answers. While LinearSpec matches the speed of other drafters on short prompts, its ability to maintain a higher acceptance length as context grows makes it significantly more effective for long-document analysis.

Figure 3: The gain concentrates on far-dependent tokens, and inherited layer 31 attends to the far answer page. (a) Relative AL of LinearSpec over DFlash on far-dependent…
Figure 3. The gain concentrates on far-dependent tokens, and inherited layer 31 attends to the far answer page. (a) Relative AL of LinearSpec over DFlash on far-dependent and other tokens, drafters before the multimodal phase; Video-MME + subs.: 128-frame quote-summary set. (b) Attention on a 97K-token prompt of the 128K document-QA set, drafters after the multimodal phase. Top: attention per page, averaged… Figure 3 of “LinearSpec: Drafting from the Target's Memory for Long-Context Speculative Decoding in Hybrid Vision-Language Models” by Haiyu Wang, Sai Qian Zhang, Steven Li (arXiv.org), CC BY 4.0.

Can LinearSpec handle different model sizes?

The benefits of the LinearSpec architecture are not limited to a single model scale. The researchers tested the method on Qwen3.5 models with 2 billion, 4 billion, and 9 billion parameters. Across these different sizes, the pattern remained consistent: LinearSpec matched the performance of existing drafters on short text but provided substantial speedups on long-context inputs.

Beyond raw speed, the method also improves serving efficiency. Because LinearSpec does not require a separate draft KV cache, it reduces the overall memory footprint per request. This allows for higher concurrency, meaning more simultaneous requests can be processed on the same GPU hardware without running out of memory.

How can researchers apply these findings?

For developers working on large-scale multimodal applications, this research highlights the importance of memory-efficient drafting architectures. As VLMs move toward processing entire books or long-form video, the ability to leverage existing model states rather than duplicating them will be critical for maintaining low latency and high throughput.

While LinearSpec is a specialized architectural optimization for inference engines, researchers interested in exploring how modern VLMs handle complex, long-form documents can use Reader to interact with academic papers and technical PDFs. This allows for a hands-on investigation into how different models manage and retrieve information from extensive context windows.

Frequently asked questions

Does LinearSpec change the output of the target model?

No, LinearSpec does not change the final output. It uses speculative decoding, a method where the small drafter proposes tokens that the larger target model must verify. If the target model finds the proposals incorrect, it corrects them, ensuring the final result is identical to what the target model would have produced through standard decoding.

Does LinearSpec require its own KV cache?

No, LinearSpec is designed to function without its own draft KV cache. Instead of duplicating the prompt's memory, it reads the target model's existing Gated DeltaNet (GDN) states and attention KV caches in place. This reduction in memory usage allows for faster processing and the ability to handle more concurrent requests on a GPU.

Is LinearSpec faster on short prompts than other drafters?

LinearSpec is generally comparable to existing block drafters like DFlash on short prompts, but it does not necessarily outperform them in that specific scenario. Its primary strength and speed advantage emerge as the context length increases, particularly when dealing with long documents, complex images, or far-dependent information in a large dataset.


Source: Grafy Research Lab — LinearSpec: Drafting from the Target's Memory for Long-Context Speculative Decoding in Hybrid Vision-Language Models