Blog

We built cross-model KV cache transfer for Qwen3.8-27B that beats OneTriangle’s

Qwen3.5-4B reads the prompt and Qwen3.8-27B answers from a mapped cache, 3.02× sooner than native at 32K against OneTriangle’s 2.8×, ahead or level on every long-document and coding benchmark both of us ran.

Magni9 min read

In early November, OneTriangle described a way to let a small model do a big model’s reading. The small model reads a long prompt once, a learned mapper translates its KV cache into the cache the big model would have built, and the big model answers from that translated cache without paying for its own prefill. On November 13 they released benchmark data for Qwen3.5-4B reading for Qwen3.8-27B, but no code or weights, so we built our own version of the idea from scratch and ran it against their numbers.

Our transfer gets Qwen3.8-27B to its first token 3.02× sooner than native at 32K, against 2.8× for OneTriangle, and 2.86× at 16K against their 2.7×. It scores level with or ahead of OneTriangle on every long-document and coding benchmark both of us ran, with ContractNLI at 0.757 against their 0.61 and LongHealth at 0.845 against 0.76, and time per output token is the same as native.

On a long prompt, most of the time before the first token is prefill, the forward pass over every prompt token that fills the model’s cache. Qwen3.5-4B has about a seventh of Qwen3.8-27B’s parameters, so its prefill costs a fraction of the 27B’s, and the 27B still writes every output token.

3.02× faster time to first token at 32K, against OneTriangle’s 2.8×. Qwen3.5-4B → Qwen3.8-27B in BF16 on one H100, median of six runs. Level with or ahead of OneTriangle on every long-document and coding benchmark both of us ran.

  • 3.02×faster time to first token than native Qwen3.8-27B at 32K, against OneTriangle’s 2.8×
  • 1.9×the requests served within a 5 s time to first token under load
Qwen3.5-4B → Qwen3.8-27B in BF16. Time to first token on one H100, median of six runs. Serving on one H200 with Poisson arrivals and prompts of 8K to 32K tokens.

Time to first token, speedup over each side’s own native 27B

Speedup over native prefill, higher is better

  • Ours
  • OneTriangle, as published
  • 8K
    • Ours: 2.67×
    • OneTriangle, as published: 2.60×
  • 16K
    • Ours: 2.86×
    • OneTriangle, as published: 2.70×
  • 32K
    • Ours: 3.02×
    • OneTriangle, as published: 2.80×
Ours is the median of six runs on one H100, batch 1, native and transfer on the same engine and GPU. The six runs span 2.44–2.76× at 8K, 2.80–2.99× at 16K and 2.95–3.11× at 32K.

Why can’t the 27B just use the 4B’s cache?

Qwen3.5-4B and Qwen3.8-27B have different numbers of layers, different widths and different heads, so the 27B can’t read the 4B’s cache directly. OneTriangle’s method learns a mapper for this, a set of functions that predicts, from what the small model computed, what the big model would have cached for the same tokens.

Both models are hybrids, and only one of every four layers is ordinary attention with a KV cache. The other three are Gated DeltaNet layers, a kind of linear-attention RNN that keeps a fixed-size 128×128 state per head instead of a cache that grows with the prompt, so most of what the 27B carries from its prompt is recurrent state rather than keys and values. A transfer that only maps KV leaves three quarters of the model with nothing to read.

How do you turn a 4B’s reading into a 27B’s cache?

The 4B reads the prompt first, and we keep only its normalized residual stream, the running representation each layer passes to the next. For every layer of the 27B, a linear map from depth-matched 4B layers predicts what that layer needs. Attention layers get each token’s key and value, predicted from several 4B layers plus the token embedding, with the 27B’s own rotary position encoding applied afterwards so positions come out exact.

For the DeltaNet layers, predicting a 128×128 state directly would mean predicting the end result of thousands of recurrent updates, so we predict the inputs of each update, the per-token keys, values and gate inputs, and run them through the 27B’s own causal convolution and gated delta-rule scan. The recurrent state comes out of the 27B’s own arithmetic, in the form it expects.

The maps start as closed-form ridge regressions fitted on 1M calibration tokens, then are fine-tuned end to end on the KL divergence between the native 27B’s next-token distribution and the transferred one, with gradients flowing through the frozen 27B. At the end, the 27B reads the last part of the prompt itself on top of the mapped cache, 512 tokens for prompts up to 4K, tapering to 128 at 8K and above, and emits the first token.

Where did exact recall go?

The first maps scored well on next-token agreement but lost needle-style recall, where the answer is one exact string buried in a long prompt. To find which part of the cache was losing it, we swapped in pieces of the native 27B’s own cache. With the native attention KV swapped into a transferred cache, RULER went from 0.72 to 1.00 and MRCR from 0.30 to 0.97, while swapping in the native DeltaNet states instead gave 0.69 and 0.26. So the recurrent states were fine, and the attention keys and values were where exact strings got blurred.

The final maps add a dedicated attention-KV map trained for fidelity, and an optional recall mode lets the 4B’s attention pick the parts of the prompt that matter for the question, which the 27B then re-encodes natively in one batched pass. Our first recall mode picked scattered 64-token blocks, and on MRCR it scored below no repair at all, 0.40 against 0.54, because the 27B received fragments of several candidate answers. Re-encoding whole chat messages instead, a matching request together with the answer that follows it, took MRCR to 0.681 on 120 held-out items.

Recall mode is off by default because it costs speed. With a Qwen3.5-2B source, RULER and LongBench v2 use it at 2.0–3.6× time to first token and MRCR at 1.4–2.8×, against 3.9–4.9× in the default fast mode.

How fast is it?

Every timing runs native and transfer on the same engine and the same GPU, so the comparable figure is each side’s speedup over its own native 27B. Absolute times also reflect the engine and the hardware, and OneTriangle’s 32K numbers come from 2×H100.

Time to first token at batch 1, native Qwen3.8-27B against our transfer. Higher speedup is better.
PromptNative 27BOursSpeedup, median of 6OneTriangle speedup
8K0.90–0.93 s0.33–0.38 s2.67×2.6×
16K1.89–1.94 s0.63–0.68 s2.86×2.7×
32K4.14–4.25 s1.33–1.43 s3.02×2.8×

Most of the transfer’s time is the 4B’s own prefill plus the maps, and the 27B’s 128-token tail takes about 50 ms at every length because it runs as a CUDA graph. That graph is captured once per prompt length, which suits a benchmark that repeats lengths, while a serving mix where every request has a new length should turn it off with XKV_NO_GRAPH_TAIL=1.

Past 32K the 4B reads through an 8K sliding window, which makes long prompts very fast, 5.0× at 128K and 21.5× at 1M tokens (873 s down to 40.7 s), but exact recall doesn’t survive the window, so RULER at 64K scores 0.55 against native’s 0.92. Those lengths are a speed result, and everything we compare on quality stays at 32K and below.

The transferred cache has the same shape as the native one, so time per output token matched native at every batch size we measured, from 1 to 32 at 2K context and 1 to 12 at 32K. Under serving load on one H200, with Poisson arrivals and prompts drawn from 8K, 16K and 32K tokens, the transfer served 1.9× the requests native did within a 5 s time to first token.

Does the 27B still give the same answers?

OneTriangle’s prompts and scorers aren’t public, so we reimplemented every benchmark and ran the native 27B through the same harness as the reference. Their native column shows where the two harnesses disagree, as on LongHealth, where their transfer scores above their own native.

Transfer quality against OneTriangle

Score, higher is better

  • Ours
  • OneTriangle, as published
  • ContractNLI
    • Ours: 0.757
    • OneTriangle, as published: 0.610
  • LongHealth
    • Ours: 0.845
    • OneTriangle, as published: 0.760
  • QuALITY
    • Ours: 0.790
    • OneTriangle, as published: 0.710
  • ZebraLogic
    • Ours: 0.750
    • OneTriangle, as published: 0.660
  • RULER
    • Ours: 0.905
    • OneTriangle, as published: 0.800
  • MRCR
    • Ours: 0.681
    • OneTriangle, as published: 0.660
  • BAMBOO PaperQA
    • Ours: 0.881
    • OneTriangle, as published: 0.890
  • ARC-Chat
    • Ours: 0.970
    • OneTriangle, as published: 0.970
  • HumanEval
    • Ours: 0.927
    • OneTriangle, as published: 0.910
  • MBPP
    • Ours: 0.875
    • OneTriangle, as published: 0.880
  • BigCodeBench
    • Ours: 0.560
    • OneTriangle, as published: 0.550
Qwen3.8-27B answering from a mapped cache. QuALITY, ZebraLogic (thinking on), RULER and MRCR use a Qwen3.5-2B source, RULER and MRCR in recall mode. 84–300 items per benchmark on our side, OneTriangle’s figures as published.
Transfer quality against OneTriangle, Qwen3.8-27B answering. Higher is better.
BenchmarkItemsNative 27B, oursOursOneTriangle (their native)
ContractNLI3000.800.7570.61 (0.79)
LongHealth2000.8950.8450.76 (0.72)
BAMBOO PaperQA840.8690.8810.89 (0.88)
ARC-Chat3000.970.970.97 (0.97)
HumanEval1640.9330.9270.91 (0.93)
MBPP2570.8750.8750.88 (0.87)
BigCodeBench1000.560.560.55 (0.60)
QuALITY, 2B source1000.910.790.71 (0.94)
ZebraLogic, thinking on, 2B source1000.950.750.66 (0.91)
RULER 4–16K, 2B source, recall mode900.970.9050.80 (1.00)
MRCR 4–32K, 2B source, recall mode, held-out1200.9720.681up to 0.66

ContractNLI and LongHealth, the two clear wins, are the benchmarks with real documents in the prompt. ContractNLI prompts run up to 8K tokens with a median of 2K, so about three quarters of a typical prompt is mapped, and LongHealth’s documents are longer still. There we lose 4–5 points against our own native 27B, while OneTriangle loses 18 on ContractNLI against theirs. Every other row is level, which on the code benchmarks partly reflects how short their prompts are, since a median of 70–170 tokens means fast mode runs them almost entirely natively.1

On τ2 retail, with the official user simulator and judges, and with the tool schemas and the last three messages computed natively (58% of a retail prompt), the transfer scores 0.78 against OneTriangle’s 0.41, keeping 93% of our native’s 0.84.2 On Terminal-Bench 2.0 we’re level with them at 0.10.3

How do we know we didn’t just tune to the test?

The maps, the tail length and the recall sizes were developed while looking at subsets of these benchmarks, so the table above is a development-set result. Two checks use data that tuning never saw. The MRCR recall result was fixed on 60 items and then run once on 120 items never used for tuning, which gave 0.681. A held-out gate also compares the maps on data none of them was selected on, FineWeb-Edu text and five multiple-choice sets, and the final maps stay within ±0.02 of the earlier ones on every row, so the gains on the targeted benchmarks didn’t cost general fidelity.

With a short, knowledge-heavy MMLU question almost entirely mapped, the transfer scores 0.67 against 0.74 for the 4B alone. Fast mode runs prompts that short natively, so it never shows up in the results above, but the maps carry long documents better than dense facts in a few tokens.

Where it stands

We built cross-model cache transfer for a hybrid model whose cache is mostly recurrent state. On OneTriangle’s benchmark pair it reaches the first token sooner than theirs from 16K up, scores level with or ahead of theirs on every long-document and coding benchmark both of us ran, and wins τ2 retail, while decoding as fast as the native 27B.

The repository has the engine, the maps’ training code, the benchmark harnesses and every result file behind this article, which follows commit 42f5b66. The full results hold every table with its sample size, its mode and its source file.

Notes

  1. OneTriangle is barely ahead on three rows, BAMBOO PaperQA at 0.89 against 0.881, MBPP at 0.88 against 0.875 and MATH-500 with thinking on at 0.94 against 0.93, all well inside the noise of those samples. ↑

  2. On τ2 telecom and airline, in the same setting, we score 0.22 and 0.50 against OneTriangle’s 0.47 and 0.59. Both sides lose about 40 points on telecom against their own native, 0.68 to 0.22 for us and 0.86 to 0.47 for them, and their page doesn’t say how much of each agent prompt they compute natively, a choice that moves τ2 scores by more than the gap between us. Computing most of the prompt natively takes our telecom and airline to 0.68 against their 0.47 and 0.59, though that setting is slower than native. Their τ2 cells hold 17 tasks each, about ±0.23, and ours 50. On retail, where 58% of the prompt is computed natively anyway, neither of our settings reaches its first token sooner than native. ↑

  3. OneTriangle publishes no native score for Terminal-Bench. Our native 27B solves 7 of 10 tasks with the same harness, while the transfer, which re-maps prompts of up to 75K tokens on every turn, solves 1 and hits the time limit on all 10. ↑

We push AI inference closer to the physical limit of GPUs, within days, on any model and any hardware.

Post on XShare on LinkedIn

Read next

  1. 16 min read

    We made vLLM beat Backboard’s Gemma 4 engine

    On Gemma 4 12B and one RTX PRO 6000, vLLM 0.33.0 with a tuned config and five patches serves 5.4% more output tokens per second than Backboard’s published engine over 8 workloads, with p90 TTFT 1.09× faster. On the same GPU that is 1.07–1.33× the article’s vLLM recipe.

All posts