Qwen3.5-9B-SPECTRA-Flash
SPECTRA-Flash params for Qwen/Qwen3.5-9B: the attention KV cache 6.9Γ smaller at 99.6% of dense on LongBench at 32K, and 4.4Γ (32K) to 6.2Γ (128K) dense decode throughput in vLLM on one H100.
This repo is a delta. It holds only the SPECTRA-Flash record maps (params.safetensors, 0.11 GB) and their config.
The base model weights come from Qwen and are not changed.
Code: github.com/nokia-applied-research/SPECTRA Β· Paper: arXiv:2608.07915
What it is
Qwen3.5-9B keeps keys and values in only 8 of its 32 layers; the other 24 are Gated DeltaNet layers with a fixed-size state, which stay unchanged. Each of the 8 full-attention layers keeps one record per token in the layout that FlashMLA reads natively (512 latent + 64 RoPE dims, fp8): 4.6 KiB per token instead of 32 KiB at 32K. The record maps start from SPECTRA's closed-form fit and are refined by block-wise distillation on calibration text (WikiText-2 train + Python code), 0.3 H100 GPU hours. The record is read with the layer's exact normalized query (after QK-norm). At decode, attention reads the fp8 record through FlashMLA plus a small exact window (the first 4 and the latest 123 tokens), merges the two in one softmax, and applies the model's output gate. Nothing is reconstructed.
Usage
git clone https://github.com/nokia-applied-research/SPECTRA.git && pip install -e 'SPECTRA[flash]'
# SPECTRA-Flash kernels (FlashMLA, via vLLM 0.29); needs a Hopper GPU (H100 / H200)
vLLM 0.29 (text only, exact prefill: the evaluated setting)
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True vllm serve Qwen/Qwen3.5-9B --language-model-only \
--block-size 540 --max-model-len 131072 \
--no-enable-prefix-caching --no-enable-chunked-prefill --max-num-batched-tokens 131072 \
--hf-overrides '{"spectra_flash": "morriszjm/Qwen3.5-9B-SPECTRA-Flash"}'
--block-size 540 lets the Flash pages tile vLLM's page for the Gated DeltaNet state; the expandable-segments
allocator keeps 128K-token prefills from fragmenting GPU memory.
Results
LongBench Protocol-B at 32K (11 tasks, the 2,065 prompts of the 32K protocol with the Qwen3.5 tokenizer, greedy), per-task score as % of dense in the same harness:
| Qasper | MFQA | HotpotQA | MuSiQue | NrtvQA | GovRep | QMSum | PsgRet | LCC | RepoP | 2Wiki | Avg | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Dense (score) | 48.37 | 54.92 | 62.79 | 47.27 | 28.97 | 31.23 | 21.93 | 100.0 | 67.86 | 62.52 | 59.28 | |
| SPECTRA-Flash, 6.92Γ | 99.3 | 99.3 | 100.1 | 103.0 | 98.4 | 98.7 | 98.8 | 100.0 | 99.5 | 99.5 | 99.2 | 99.6 |
Scored with the reference decode in π€ Transformers (exact prefill, the record's query in fp32). The vLLM plugin also rounds that query to fp8; it was checked against dense vLLM on a 28K-token needle and four LongBench prompts, not on the full set.
Speed in vLLM 0.29, one H100 NVL, gpu_memory_utilization 0.9, dense = stock vLLM:
| Dense | SPECTRA-Flash | vs dense | |
|---|---|---|---|
| Requests of 32K tokens the KV cache holds | 58 | 290 | 5.0Γ |
| Decode step at batch 1, 32K / 128K context | 6.67 / 8.11 ms | 6.86 / 7.17 ms | 0.97Γ / 1.13Γ |
| Decode throughput, 32K context | 1,315 tok/s (batch 48) | 5,730 tok/s (batch 256) | 4.4Γ |
| Decode throughput, 128K context | 308 tok/s (batch 12) | 1,915 tok/s (batch 48) | 6.2Γ |
Serving (all requests submitted at once at one memory budget), output throughput vs dense: 1.13Γ (256 Γ 32K prompts + 256 output tokens), 1.65Γ (512 Γ 8K + 2K), 1.65Γ (96 Γ 128K + 2K) and 2.75Γ (256 Γ 32K + 8K). The gain grows with the share of decode: prefill costs the same in both, and dense Qwen3.5 already holds many requests.
Reproduce:
python tests/check_flash_qwen35.py --params morriszjm/Qwen3.5-9B-SPECTRA-Flash
spectra-flash bench vllm-decode --model Qwen/Qwen3.5-9B --params morriszjm/Qwen3.5-9B-SPECTRA-Flash \
--ctx 32000 --batches 1,48 --flash-batches 1,48,128,256 --gpus 0,1
spectra-flash bench serve --model Qwen/Qwen3.5-9B --params morriszjm/Qwen3.5-9B-SPECTRA-Flash \
--input-len 32000 --output-len 8192 --num-prompts 256 --max-num-seqs 512 --gpus 0,1
Limits
- Qwen3.5-9B, text only; vLLM 0.29 only (no π€ Transformers path for Qwen3.5); bfloat16; one GPU (tensor parallel size 1); Hopper GPUs.
- vLLM: no prefix caching, no speculative decoding, no KV connectors.
License
These params are derived from Qwen3.5-9B and are distributed under the Apache License 2.0, as is the base model. The SPECTRA code is MIT.
Citation
@misc{zhang2026spectrapushingkvcache,
title={SPECTRA: Pushing the KV Cache Beyond the 2-Bit Cliff via Spectral Transform Coding},
author={Jiamu Zhang and Liang Wu and Kelly Wan and Hanjie Chen and Liangjie Hong},
year={2026},
eprint={2608.07915},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2608.07915},
}