Gradient LabSign up free

Trending › Paper

Jet-QSparse: find what matters in 4 bits, then do the maths properly

Jet-QSparse stores the KV cache in 4-bit numbers, uses those cheap numbers to find the blocks of context that matter, and does the real attention maths only on them. The authors report up to 1.94× faster generation at 128K context with no training needed.

Watch it move. This is an animated lesson on Gradient Lab.

Start the animated lesson

Step by step

Problem

Long context makes each new token slow

When a model writes a token, attention compares it with every earlier token, reading the whole KV cache from memory. At 128,000 tokens of context, that reading is the bottleneck: the GPU waits on memory, not maths.

Every block of the cache is read in full for every new token.

Build

Store the cache in 4 bits

Jet-QSparse keeps the cache in NVFP4, a 4-bit number format that recent NVIDIA GPUs can do maths on directly, grouped into blocks of 128 tokens. The paper reports the packed cache takes about 29% of the bytes of the usual 16-bit cache, so about 2.6–2.8× more tokens fit in the same memory.

Same blocks, about a third of the height: 4-bit storage.

Key idea

Use the rough numbers to pick blocks

The new token’s query is scored against every block using the cheap 4-bit keys. That gives an estimate of how much attention each block would get. For each head, only the top N blocks (the paper’s default is 64) are kept, plus the current block.

Bars: estimated attention per block. Bright ones are kept.

Build

Precise maths on the few that matter

Only the chosen blocks go into the final weighted sum, done in 16-bit with 32-bit accumulation to keep accuracy. The first block and the current block also keep full-precision copies, because they matter a lot and small errors there hurt. No retraining is needed.

Four blocks get the careful treatment; the rest are skipped.

Insight

The reported result

On one NVIDIA GB300 at 128K context and batch 16, the authors report a 1.94× faster time per output token for Qwen3.8-27B and 1.57× for Qwen3.6-35B-A3B. With N = 64 they found no significant accuracy loss on the Qwen models, and one small loss on Nemotron 3 Nano. They note the settings were tuned on the same benchmarks used to evaluate them.

Bar heights to scale: decoding speed relative to the usual 16-bit attention.

Quick check: What are the 4-bit keys mainly used for in Jet-QSparse?

Pseudocode

# decoding one new token at long context
# dense: read every cached key and value in 16-bit
out = attention(q, K_all, V_all)

# Jet-QSparse (training-free)
blocks = split(cache, size=128)              # cache stored in 4-bit NVFP4
score = [estimate(q, b.keys_fp4) for b in blocks]   # cheap FP4 maths
keep = top(score, N=64) + [current_block]
out = attention_fp16(q, keep)                # precise maths on 64 blocks only

Go deeper

Sources

  1. Tang, Kang, Lu et al. (2026), Jet-QSparse: Accelerating Agentic LLM Inference with 4-Bit Sparse Attention (arXiv 2611.01022)