Qwen Sparse Attention Ported to Qwen3.8-27B: 2.9x Prefill, 1.8x Decode Speedup

A Japanese developer implemented Qwen Sparse Attention (QSA) on Qwen3.8-27B, achieving 2.92x faster prefill and 1.79x faster decode at 261K tokens while maintaining perplexity and DocVQA scores; a quantized version further reaches 2375 tok/s prefill and 115 tok/s decode with 22.8 GiB VRAM.

SmartApe AI
SmartApe AI
SmartApe AI
Qwen Sparse Attention Ported to Qwen3.8-27B: 2.9x Prefill, 1.8x Decode Speedup

Background: Long-Context Inference Bottleneck

In long code repositories, complex document analysis, and extended agent tasks, models can accommodate many tokens but inference speed degrades significantly as context grows.

Solution: Qwen Sparse Attention (QSA)

QSA introduces a lightweight learned indexer that compresses historical context into fine-grained information blocks, selects relevant blocks by relevance, and computes attention only on tokens within the chosen blocks. This reduces computational overhead in long-context scenarios.

Implementation Details

Base model: Qwen3.8-27B (original architecture includes full-attention layers and Gated DeltaNet layers).

QSA indexers added to 16 full-attention layers.

Selection unit: 4 tokens per block.

Fixed selection budget: 2048 tokens.

The remaining 48 Gated DeltaNet layers stay unchanged.

The adapted model is named Qwen3.8-27B-QSA . The developer (Ryu) released the llama.cpp inference engine on GitHub and model files on Hugging Face.

Benchmark Results (Cold Start, ~261K Input Tokens)

Metric                Original Qwen3.8-27B   Qwen3.8-27B-QSA   Speedup
Prefill throughput    366.84 tok/s           1071.53 tok/s       2.92x
Decode throughput     22.91 tok/s            41.07 tok/s         1.79x
Prefill speed comparison chart
Prefill speed comparison chart
Decode speed comparison chart
Decode speed comparison chart

Model Quality Verification

Perplexity at 32,766 tokens: original 7.072960 vs QSA 7.071384 (virtually identical).

DocVQA score: both versions achieve 50/50.

Perplexity and DocVQA comparison
Perplexity and DocVQA comparison

Community Quantized Version

Developer PentaCoxian created a quantized variant of Qwen3.8-27B-QSA and reported:

Context length: ~255K tokens.

Cold-start prefill: 2375 tok/s.

Decode speed: ~115 tok/s.

Peak VRAM usage: 22.8 GiB.

Quantized version benchmark chart
Quantized version benchmark chart

Significance

QSA is a technology slated for the upcoming Qwen4 release. This community port demonstrates that the core speed improvements can be realized on existing open-weight models, and the open-source ecosystem is already iterating with quantization for even higher throughput and lower memory footprint.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Inference OptimizationQwenLong ContextModel QuantizationSparse Attentionllama.cppCommunity DevelopmentQSA
SmartApe AI
Written by

SmartApe AI

SmartApe's AI technology content account, focusing on cutting-edge AI developments and open-source frontlines.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.