YASA: How Sparse Attention Made Kolibri 1.1 up to 14× More Efficient
TL;DR
In Kolibri 1.1, we replaced Kolibri 1’s dense attention with YASA, our new sparse attention mechanism, achieving up to 14× higher decode throughput at 1M context length, with a small impact on base-model quality that is fully recovered, and even exceeded, after post-training.
In this blog post, we first provide a high-level overview of the challenges of dense attention, build an intuition for how sparse attention addresses them, and present our main quality and serving results. We then dive into the technical details, starting with the key attention bottlenecks and explaining how each component of our approach addresses them, significantly reducing compute, memory movement, and memory footprint.
Overview
Models increasingly work with long contexts, for example in agentic tasks, when navigating large codebases, or when working through complex documents over many steps. As the context grows, attention becomes one of the most expensive parts of generating the next token.
In Kolibri 1, we reduced this cost by using sliding-window attention in 40 of its 50 layers, which bounds the cost by attending only to the most recent part of the context. For Kolibri 1.1, we took this a step further and, inspired by recent work, we replaced the remaining 10 dense attention layers with Yet Another Sparse Attention (YASA).
We designed YASA from first principles, starting with the main bottlenecks in long-context attention. Our goal was to reduce both memory movement and the memory needed for each request while simplifying training and maintaining quality. By the end of this post, you’ll understand where YASA improves on existing sparse attention designs, what trade-offs we made, and how those choices affect Kolibri’s serving performance as context length grows.
The rest of this section gives the big picture and walks through sparse attention step by step with an interactive example.
Serving Performance then shows how Kolibri 1.1 compares with Kolibri 1 on prefill latency and decode throughput and how the speedup changes with context length, and Model Quality shows what it costs in quality.
The sections after these go deeper and assume some familiarity with dense attention, prefill and decode, the KV cache, and numerical precision.
Sparse Attention Architecture explains, for each component of YASA, which bottleneck it addresses, what trade-offs it introduces, and how it fits into the full architecture.
In dense attention, the cost of generating a token grows with the length of the context, because the current token is compared with every earlier token. Our sparse attention selects a fixed number of relevant tokens in two inexpensive steps, first by coarse block and then by token, so that the attention step itself no longer depends on the length of the context. The interactive figure walks through these steps on a short example.
Swipe sideways to see the whole drawing →
Dense attention
The current token computes an attention score with every earlier token (a thicker arc is a higher score) and combines all tokens, weighted by their scores, into its output. Only a few tokens get a high score, but every score costs the same.
Serving Performance
When you send Kolibri a prompt, it first reads the prompt, processing its tokens in parallel. This is prefill, and the time it takes for a single request, the prefill latency, is shown on the left. It then writes its answer one token at a time. This is decode, shown on the right. We show decode throughput in tokens per second per GPU.
Kolibri 1
Kolibri 1.1
Prefill latency (lower is better)
seconds to first token
Kolibri 1
Kolibri 1.1
Decode throughput (higher is better)
tokens/s per GPU
Kolibri 1.1
Kolibri 1
Speedup of Kolibri 1.1 over Kolibri 1 above each point.
Measured on four NVIDIA B300 GPUs with vLLM 0.33, expert parallelism (EP4), FlashInfer MoE and 16,384 batched tokens, with prefix caching on, on the released post-trained checkpoints and real text.
Prefill: time to first token of a single request.
Decode: tokens per second per GPU at the largest batch that fits in memory.
In both phases, the advantage of Kolibri 1.1 grows with the context length. During prefill, both models return the first token equally fast at 16k tokens, Kolibri 1.1 is 1.7× faster at 256k, and 4.4× faster at 1M. During decode, Kolibri 1.1 already delivers 1.6× the throughput of Kolibri 1 at 16k tokens, and 14× at 1M.
Selecting which tokens to attend to takes extra work, and during prefill on a short prompt, that selection can cost more than it saves. As we’ll see in the architecture section, longer contexts let the model skip more attention work, so the savings grow faster than the cost of selection.
Model Quality
We evaluate the base models using the eval-framework [1], with OLMES-style prompts [2] where available, following the same setup as the Kolibri tech report [3]. After post-training, Kolibri 1.1 not only matches but outperforms Kolibri 1 on the overall benchmark score of its model card (73.2% vs 66.6%).
While encouraging, this result reflects the overall evolution of the model, including improvements to post-training, rather than the isolated impact of sparse attention. One hypothesis is that YASA’s faster rollout generation may have also contributed to these gains by reducing policy staleness during RL training, keeping rollouts closer to on-policy.
At the base-model stage, however, we observe a small quality gap, with Kolibri 1.1 scoring 1.5 points below Kolibri 1 overall in English and 1.7 points below in German.
Part of this gap may be explained by the adaptation to the new architecture. We initialise Kolibri 1.1 from the Kolibri 1 checkpoint and continue pre-training it to adapt to sparse attention. In particular, the model needs to learn to rely on a small subset of selected tokens rather than attending to the full context. The gap is no longer present after post-training. We discuss the training process and its challenges in more detail in the Training section.
Kolibri 1
Kolibri 1.1
Base models
overall average (%) over knowledge, math and code benchmarks
Post-trained models
overall average (%) over model card benchmarks
Overall benchmark averages of the base and post-trained models. Left: base models; right: post-trained models. The two panels average different benchmarks: for the base models, Overall is the mean of the knowledge, math, and code categories within each language, see details in the appendix; for the post-trained models, it is the mean of each language’s category averages on the Kolibri 1.1 model card. English and German are reported separately because their benchmark sets differ.
We also evaluate long-context capabilities using RULER [4], across context lengths from 4k to 1M tokens. Kolibri 1.1 closely tracks Kolibri 1, reaching nearly identical scores up to 16k tokens and at 128k, and performing slightly worse at 32k, 64k and from 256k to 1M. Both models were trained on sequences up to 256k tokens, so the results at 512k and 1M also measure their ability to generalise beyond the training context length.
Kolibri 1
Kolibri 1.1
RULER
score (%)
Kolibri 1
Kolibri 1.1
RULER scores of the base models across context lengths. Each point reports the mean score across needle retrieval, variable tracking, word extraction, and question answering tasks, in percent.
We evaluate on 100 samples per task and context length, generated with the RULER code, adapted to reach 1M tokens.
Attention Bottlenecks
In the overview, we sketched how attention costs scale with context length. Now, let’s go a bit deeper into the bottlenecks that can limit training and inference performance, before exploring how each component of our sparse attention method is built.
Performance can be limited by either compute throughput or memory bandwidth. Which one becomes the bottleneck depends on how many FLOPs your workload performs per byte of data moved, i.e., its arithmetic intensity, and on the hardware you’re running on. During deployment, memory capacity introduces another bottleneck, as it can limit how many requests you can serve concurrently.
Now, let’s look at these three dimensions—compute, memory movement, and memory footprint—for dense attention.
Compute. In dense attention, every token attends to all previous tokens, so the total attention compute for a sequence grows quadratically with its length. The main effects are on long-context training and on prefill, where it delays the first generated token. A single decode step only adds one new token, so its compute grows linearly with the context, but it still has to read the keys and values of all previous tokens from the KV cache. This leads us to our next bottleneck.
KV Cache Memory Movement. During decoding, as the context grows, both the computation and the amount of KV cache data read for each generated token increase linearly, keeping the arithmetic intensity roughly constant. However, on modern GPUs, this arithmetic intensity is typically too low to fully utilise the available compute throughput, making memory bandwidth the main bottleneck for decode attention. The time per generated token is therefore set by how much of the KV cache has to be read, which grows linearly with the context.
Note that the KV cache is not the only data we move from memory. When decoding with small batch sizes, the bottleneck is often still memory bandwidth from reading the model weights. If you want to go deeper, we wrote a dedicated post on inference performance from first principles.
KV Cache Size. The size of the KV cache also limits how long a context can fit in GPU memory and how many sequences you can serve concurrently, potentially reducing total throughput. Fewer requests in flight mean that the cost of reading the model weights is shared across fewer tokens, making each generated token more expensive.
YASA addresses all three. Each of its components targets one or more of these bottlenecks, sometimes at the expense of making another worse, but taken together they deliver the speedups shown in the overview. In the following section, we explain the motivation behind our design choices and the trade-offs of each component.
Sparse Attention Architecture
Sparse attention has to find the most relevant tokens that minimise the error compared to dense attention for a given query as efficiently as possible.
We select the most relevant tokens with a two-step hierarchical indexer and then apply standard softmax attention to the selected subset.
Instead of being separately trained, the indexer is tied to the attention and reuses one of its key-value heads.
We combine this with a low-precision fp4 key-value cache and share the cache across layers.
All layers that produce a cache sit in the first 30 of the 50 layers, so prefill only has to run these 30 layers, with 1.87 billion of the 3.44 billion active parameters, over the full sequence. The remaining 20 layers only process the last few thousand tokens.
At a context of 1M tokens, this improves on all three bottlenecks of Kolibri 1, with the computed attention FLOPs per token dropping from 129G to 1.9G, the cache read per decode step from 10.8 GB to 0.09 GB and the KV cache of a sequence from 10.8 GB to 2.8 GB, as shown in the attention cost figure.
The resulting prefill latency and decode throughput are shown in the benchmark figure.
Kolibri 1.1
DeepSeek V4.1-Flash
Qwen3.8-Flash-Next
Qwen3-Next 80B-A3B
Kolibri 1
Attention FLOPs per token
forward FLOPs of the QK and AV products
Kolibri 1
Qwen3-Next 80B-A3B
DeepSeek V4.1-Flash
Qwen3.8-Flash-Next
Kolibri 1.1
KV cache per sequence
GB at the served precision
Qwen3.8-Flash-Next
Qwen3-Next 80B-A3B
Kolibri 1
Kolibri 1.1
DeepSeek V4.1-Flash
Cache read per decode step
GB at the served precision
Qwen3-Next 80B-A3B
Kolibri 1
Qwen3.8-Flash-Next
DeepSeek V4.1-Flash
Kolibri 1.1
Theoretical attention cost against context length.
Attention FLOPs per token, KV cache of a sequence and cache read per decode step for Kolibri 1, Kolibri 1.1, DeepSeek V4.1-Flash [5], Qwen3.8-Flash-Next [6] and Qwen3-Next 80B-A3B [7].
All values are computed theoretically with the accounting of our Designing Kolibri post, which counts the forward FLOPs of the query-key and attention-value products, and for Kolibri 1.1 also the indexer’s query-key scoring, at 2 FLOPs per multiply-add, averaged over all positions of a sequence of the given length.
The query, key, value and output projections are not included, as they do not depend on the context length.
Cache sizes use the precision at which each model is served by its recommended vLLM command on Blackwell GPUs.
Below, we describe each component of a sparse layer and how the layers are combined in the final model.
The Sparse Attention Layer
The sparse layer figure follows a single query through one sparse attention layer.
Pick a step, or switch between an indexer and a reindexer layer.
Swipe sideways to see the whole drawing →
value over key of one key-value head
8 sink tokens
128 most recent tokens
selected tokens
used by the tied indexer: group-0 queries, head-0 keys
token position in the pool or the selection
what a step reads
One query’s view of a sparse attention layer.
We have four key-value heads and use key-value head 0 and the 12 query heads of its group for indexing (the tied indexer).
We select in two steps: first a coarse selection of blocks of 16 tokens, each scored by one compressed key, the mean of the block’s 16 keys, and then a fine selection of tokens from the pool that these blocks form.
In both steps, the indexer score of a key is the mean over the 12 query heads of ReLU(qh⋅kj), where the key is the compressed key of a block in the coarse step and the key of a single token in the fine step.
The selected keys and values are then gathered and combined with the first 8 tokens, which act as an attention sink, and the 128 most recent tokens.
We then run softmax attention over this sequence.
A reindexer takes the pool of the previous indexer.
For readability, the figure draws 8 tokens for each block of 16 and 4 of the 8 sinks.
Tied Indexer
A good proxy for the tokens that minimise the error compared to dense attention is the set of keys with the largest query-key logits for that query.
Most sparse attention architectures assume that this selection of key-value entries generalises across heads, so we can select once cheaply and use the result for all of them.
DeepSeek Sparse Attention has a single key-value head and shares one token selection among all query heads [8].
Native Sparse Attention [9], MiniMax Sparse Attention [10] and InfLLM-V2 [11] have several key-value heads and share one block selection among the query heads that read the same key-value head.
In both cases, each selected key-value entry is loaded once for all the query heads that use it.
Often, the indexer has separate, smaller query and key matrices and its own cache [6][8][10][12].
Since selection is not differentiable, the indexer is trained to mirror an aggregate of the attention distribution of the main attention heads using a Kullback-Leibler (KL) divergence loss, adding kernel complexity, a two-stage training schedule, and an auxiliary objective.
Other approaches run dense attention indexers (as in HySparse2 [13]), but this doubles the cost of each indexer compared to scoring with the query-key product alone.
It also sums values whose weight we already know to be low, which we expect to add little accuracy.
We do not use separate indexer weights.
Instead, we use the first of our four key-value heads for indexing.
We call this a tied indexer.
Each key-value head is shared by a group of 12 of the 48 query heads.
This has the benefit that the query and key projections of this group get a training signal directly through the backward pass of the softmax attention itself.
Compared to running a dense attention indexer, this halves the cost of the indexer, because we can omit the weighted sum over the values, and it simplifies the kernels, because ranking needs no normalisation across keys and a ReLU on the logits is enough.
The trade-off is that the queries and keys of this group serve two purposes at once, selection and attention, and that the selection of one group is used by all four.
The indexer score of a key is the mean, over the H=12 query heads of this group, of the ReLU of the query-key logit:
sj=H1h=1∑HReLU(qh⋅kj)
where kj is the key of token j in key-value head 0 and qh is the query head h in the key-value head’s group.
The same score is used in both steps of the hierarchical selection, with the compressed key of a block in place of kj in the coarse step.
Selecting with the queries and keys of the main attention has precedents.
MoBA [14] scores each block by the query-key product with the mean of the block’s keys and adds no parameters.
InfLLM-V2 [11] also scores averaged keys with the weights of the main attention, computes one selection per key-value head from the scores of the query heads that share it, and adapts a dense model to long contexts by continued training, as we do.
Unlike InfLLM-V2, our indexer computes a single selection, from the first group, and all four groups use it.
Its score is the mean of the ReLU of the logits rather than a sum of per-head softmax scores, so it needs no normalisation across keys, and its fine selection step picks single tokens, where InfLLM-V2 selects whole blocks.
Hierarchical Selection
As outlined in Attention Bottlenecks, the core bottlenecks that are addressed by selection are compute and cache reads, which both grow linearly with the context in every decode step, and therefore quadratically over a whole sequence.
Selection does not reduce the third bottleneck, the size of the cache, as different queries retrieve different parts of the cache, so every token has to stay cached.
While we do not reduce the complexity class of the attention, we want to minimise the cost of the quadratic component as much as possible.
We do this in two ways.
First, the indexer is cheaper than the attention itself, as it only computes the query-key product for 12 of the 48 query heads against the keys of a single key-value head and needs no sum over the values.
On the same tokens, this takes one eighth of the FLOPs and one eighth of the cache read of the main attention, a factor of four from scoring with one of the four head groups and a factor of two from leaving out the values.
Second, to get the cost down further, we select hierarchically, as shown in the sparse layer figure, with a coarse step that first selects 1,024 blocks of 16 tokens. A related hierarchical indexing scheme is described in HISA [15].
Each block is scored by one compressed key, which we implement as the mean of its 16 keys.
These compressed keys are cached too, so the coarse step adds a small cache rather than reducing it.
These blocks form the pool of 16,384 tokens for fine selection.
In the fine selection step, we then select the 2,048 most relevant tokens for the current query.
The coarse selection step is the only one whose cost grows with the context, and it operates on a sequence that is 16 times shorter than the context.
The fine selection step operates on a fixed sequence length, which bounds its compute and memory read.
The key compression figure shows the improvement from compressing the keys of the coarse selection.
The compression reduces the selection time of an indexer layer at a context of 1M tokens from 784 µs to 128 µs per decode step, measured on one NVIDIA B200 at a batch size of 64.
No compression
Keys compressed 8×
Keys compressed 16×
Selection time of one indexer layer
µs per decode step at batch 64
No compression
Keys compressed 8×
Keys compressed 16×
Selection time of an indexer layer with and without key compression.
Measured time of the coarse and fine selection per decode step, at a batch size of 64 on one NVIDIA B200.
The numbers above the points give the time without compression relative to the 16× compression.
With the hypothesis that the pool from the coarse selection step also generalises across layers, later layers can take the pool of an earlier layer and skip the coarse selection step, giving a further speedup.
A layer that reuses the pool of an earlier layer in this way is called a reindexer [5].
It still runs the fine selection on this pool with its own queries, so the selected tokens differ per layer.
This asks less than reusing the selection itself: the pool holds 16,384 tokens, eight times the 2,048 selected, so it only has to contain the tokens that a later layer needs.
Selections of nearby layers overlap: in DeepSeek Sparse Attention models, adjacent layers share 70–100% of their selected tokens [16].
One selection reused unchanged over many layers reduces quality [17], while re-selecting within a shared pool keeps most of the recall of selecting from the whole context [18].
Kolibri 1.1 is trained with its reindexers in place, so each later layer learns to select within the pool it receives.
The reindexer is also shown in the sparse layer figure.
Softmax Attention
Finally, we gather the full keys and values of the 2,048 selected tokens and combine them with the first 8 tokens, which act as an attention sink [19], and the 128 most recent tokens, which ensure that the model always has some local context.
We then run softmax attention over this sequence of 2,184 tokens.
The softmax attention step operates on a fixed sequence length, which bounds its compute and memory read.
In the measured kernel time of a decode step, shown by part in the decode time breakdown, only the coarse selection grows with the context.
Attention time per decode step
ms, summed over all layers
Coarse selection
Fine selection
Softmax attention over selected tokens
Sliding-window attention
Attention time of a decode step by component.
Measured kernel times summed over all 50 layers, at a batch size of 64 on one NVIDIA B200.
Up to 16k tokens the pool holds the whole context, so there is no coarse selection.
Beyond that, the coarse selection step is the only component that grows with sequence length.
Notably, due to the efficient sparse attention, sliding-window attention is now a significant part of decode time.
Indexer and Reindexer Placement
As noted in Hierarchical Selection, the coarse selection step in an indexer still exhibits compute that grows quadratically with the sequence length and memory movement that grows linearly in every decode step.
A reindexer layer, in contrast, selects from a bounded pool, so its compute and memory movement stay roughly constant.
We therefore want to minimise the number of indexers in favour of cheaper reindexers, as illustrated in the indexer cost figure.
Indexer: coarse and fine selection
Reindexer: fine selection only
Softmax attention of the same layer, for scale
Selection time of one sparse layer
µs per decode step at batch 64
Indexer: coarse and fine selection
Softmax attention of the same layer, for scale
Reindexer: fine selection only
Selection time of an indexer and a reindexer layer.
Measured kernel time of the selection in one sparse layer per decode step, at a batch size of 64 on one NVIDIA B200.
An indexer runs the coarse selection over the whole context and the fine selection over the pool, while a reindexer only runs the fine selection.
The numbers above the points give the time of an indexer relative to a reindexer, which reaches 3.8× at 1M tokens.
The gray line shows the softmax attention over the selected tokens of the same layer for scale.
Kolibri 1 has a dense attention layer on every fifth of its 50 layers.
In Kolibri 1.1 these ten layers become sparse attention layers, with indexers on layers 5, 15, 20 and 30 and reindexers on the remaining six, each of which takes the pool of the previous indexer, as shown in the architecture figure.
Compared to running indexers in all layers, this reduces the selection cost per decode step at a context of 1M tokens from 1.29 ms to 0.72 ms.
Swipe sideways to see the whole drawing →
sliding window (513 tokens, BF16)
indexer
reindexer
pool
producer (all tokens, NVFP4)
consumer
cache read by a consumer
Hover or tap a sparse layer to see its group and its cache source.
Kolibri 1.1 sparse architecture.
Each block of four sliding-window layers ends in a sparse attention layer (indexer or reindexer).
Indexers (layers 5, 15, 20, 30) select a pool of 16,384 tokens per query, from which the reindexers of their group select with their own queries.
The KV cache is shared between producer and consumer layers: producers 5, 20, 25 and 30 keep a full-length NVFP4 cache, and the other six sparse layers are consumers that read one producer’s cache (dashed).
Consumers keep their own query and output matrices.
KV Cache Size
As highlighted in Attention Bottlenecks, the size of the KV cache determines the number of parallel requests that we can serve for a given model.
We reduce it using two strategies: reducing the precision and sharing caches across layers with cross-layer attention [20].
Placing the full-length KV cache producing layers in the first thirty layers allows us to execute the remaining layers at reduced sequence length during prefill, similar to the idea behind YOCO [21] and described in Prefill Exit.
Precision.
Compared to Kolibri 1, we reduce the cache precision of the full-length caches from FP8 to NVFP4, reducing both memory usage and memory movement in the sparse attention layers.
We use NVFP4 over MXFP4 for the added precision of its finer block scales.
We omit the global scale of NVFP4, as the observed values are well within the range covered by the block scales.
Sliding-window attention layers maintain a BF16 cache as this cache is bounded and becomes negligible compared to the full-length cache at long sequences, and in the sliding-window kernels we use, we do not observe a speedup from FP8 or FP4.
The reduction in cache size at different sequence lengths is visualised in the cache size figure.
While the cache is stored and loaded in NVFP4, we dequantise it in the kernels and run attention in BF16.
The indexer runs its matrix multiplications in NVFP4.
We run quantisation-aware training (QAT) to adapt the model to the reduced cache precision, see Continued Pre-Training.
Sharing.
We further reduce the KV cache size by sharing the full-length caches across layers. Cross-layer KV sharing has been studied in Cross-Layer Attention [20] and appears in recent models such as DeepSeek V4.1 Flash [5] and HySparse2 [13].
Of the ten sparse attention layers, only layers 5, 20, 25 and 30 produce a KV cache, as shown in the architecture figure, while all sliding-window layers maintain their own.
The remaining six sparse attention layers consume the cache of a producing layer but keep their own query and output matrices, so each of them may still attend to different tokens and writes its own update to the residual stream.
Each consumer reads the cache of the closest preceding producing layer, except for layer 50, which reads the cache of layer 5. This gave a slight quality improvement, possibly because it gives the last layer access to lower-level representations of the context.
Every sparse attention layer still reads the same amount of cache in every decode step, so sharing does not change the kernel execution time.
The smaller cache instead allows us to serve more requests in parallel, which improves total throughput.
Together with the reduced precision, the KV cache of a sequence of 1M tokens shrinks from 10.8 GB in Kolibri 1 to 2.8 GB, as shown in the cache size figure.
Since the consumers were trained with their own keys and values in Kolibri 1, simply giving them the cache of their producer degrades the model.
We therefore initialise the shared keys and values from all layers of a sharing group instead of copying the producer’s.
For the keys, each layer rotates its keys and queries so that the keys of the group align as closely as possible, which leaves its own logits unchanged, and the aligned keys are averaged.
For the values, we pick the shared value matrix that preserves as much as possible of the group’s values and absorb the remaining difference into each layer’s output matrix.
Before any training, this reduces the loss increase caused by sharing from 2.31 to 0.62 bits per byte.
The derivation can be found in the appendix.
Full-length caches and indexer keys
Sliding-window cache
16k tokens
GB per sequence
128k tokens
GB per sequence
1M tokens
GB per sequence
KV cache size per sequence at three context lengths.
We shrink the full-length caches of the sparse attention layers in two steps, first by lowering the precision from FP8 to NVFP4 and then by sharing caches across layers, which takes the ten caches of Kolibri 1 down to the four shared caches of Kolibri 1.1.
The sliding-window cache is kept in BF16 and bounded by the length of the sliding window.
It is a significant part of the cache at 16k tokens but becomes negligible at 1M tokens.
Prefill Exit.
Since all full-length KV caches are produced within the first thirty layers, prefill only has to run these layers over the full sequence, similar to the idea behind the decoder-decoder architecture of YOCO [21].
The remaining twenty layers only run on the last 8,193 tokens, the receptive field of their sliding-window layers1, which reduces the active parameters that process the full sequence from 3.44 to 1.87 billion.
Continued Pre-Training
We want to apply YASA to Kolibri 1. However, just changing the attention architecture degrades model quality. To let the model adapt to the new architecture, we perform continued pre-training, first on an updated mid-training mix, then on Kolibri 1’s long-context mix. Additionally, we apply quantisation-aware training (QAT) to reduce the rounding mismatch between training and inference. The training loss figure shows the loss during the continued pre-training of Kolibri 1.1.
Continued mid-training, phase 1, batch 100.7M tokens, context 64k
Continued mid-training, phase 2, batch 100.7M tokens, context 192k
Training loss of continued mid-training and the long-context stage.
Thin lines: loss of each step.
Thick lines: moving average over roughly 5B tokens (corresponding to 51 steps in mid-training and 25 in the long-context stage).
Phase 2 continues phase 1 at 192k instead of 64k context with the same tokens per step.
The long-context stage starts from the last checkpoint of phase 2 with 256k context and twice the tokens per step.
We continue mid-training from around the checkpoint where Kolibri 1 branches off for its long-context stage. We mid-train in two phases, which differ only in sequence length: phase 1 trains on 64k sequences and phase 2 on 192k sequences, with the same number of tokens per step. YASA theoretically supports training on longer contexts at lower cost, and the mid-training mix contains some data with sequences longer than 64k tokens. Therefore, we increase the training sequence length to 192k, which fits most of these documents whole.
We start with new optimiser states, so we warm up the learning rate for 50 steps in phase 1. After this, there is no further warm-up until the end of the long-context stage. Like Kolibri 1, we keep the learning rate constant and merge checkpoints instead of using learning rate decay [3].
We use an updated mid-training mix for both phases of continued mid-training. It draws on the same Kolibri 1 mid-training and pre-training data, reweighted towards natural-language web and document data, especially German.
Our continued mid-training is 805B tokens, about a quarter of Kolibri 1’s 3.4T mid-training. For the long-context stage, we reuse the same data mix and training duration as Kolibri 1.
The final checkpoint is a linear merge of 40 checkpoints with equal weights. It includes all 32 checkpoints of mid-training and all 8 checkpoints of the long-context stage.
YASA stores the KV cache of the sparse layers in NVFP4. This adds more rounding error than BF16, the format we train in. A model trained only in BF16 has never seen this error, thus if we quantise the KV cache of such a model after training, quality drops. Therefore, we apply the rounding during training. In the forward pass, we round the keys and values of the sparse layers to NVFP4 and back (fake quantisation). The model then sees cache with the same rounding as encountered later during inference. Rounding has no useful gradient, so in the backward pass the gradient passes through unchanged. The indexer also runs on NVFP4 quantised queries and keys. This is important because the indexer selects the top tokens by score, and small rounding differences can change which tokens are selected. With QAT, the model learns to select on the same scores as during inference. The attention itself is computed in BF16. The sliding-window layers keep their cache in BF16, thus we train them without quantisation.
Appendix
Initialisation for KV Sharing
This section derives the initialisation of the shared key and value matrices summarised in KV Cache Size.
To make key-value sharing across layers work in the continued pre-training setting, we start from an initialisation that merges the existing key and value matrices of producers and consumers and adjusts query and output matrices to compensate for the change.
To understand the initialisation we look at one attention head of a layer and at a single query.
Let xq be the normalised layer input at the position of the query and xj the input at token j of its context.
The head computes the query q=Qxq, the keys kj=Kxj and the values vj=Vxj with its query, key and value matrices Q, K and V.
Its logits and attention weights are
ℓj=q⊤kj=xq⊤(Q⊤K)xj,α=softmax(ℓ)
and through the output matrix O it writes
Oj∑αjvj=(OV)j∑αjxj
to the residual stream.
The matrices enter only through the two products Q⊤K and OV.
This omits the normalisation of queries and keys before the dot product and the normalisation of the attention output for simplicity.
We account for it in the real initialisation.
Shared Keys.
Sharing replaces the Km and Vm of every member m of a group M, a producer and its consumers, with shared matrices Kˉ and Vˉ.
We start with the keys.
We notice that the attention logits are invariant under a shared rotation R of the query and key matrices:
Q⊤K=Q⊤R⊤RK=(RQ)⊤(RK)
As long as we also rotate the queries, a member can therefore use any rotated version RKm of its key matrix2.
We choose the shared matrix Kˉ so that it is as close as possible to a rotated version of the key matrix of every member.
For a given Kˉ, the best rotation3 for member m is
Rm=argR⊤R=Imin∥RKm−Kˉ∥F
Starting from the producer’s own matrix, Kˉ=Kp, we alternate between computing the optimal rotations for the current Kˉ and updating Kˉ:
Kˉ←∣M∣1m∈M∑RmKm
The key matrix of the producer is then replaced by Kˉ and all consumers use the same keys.
Note that this ignores the effect that the input state changes between layers and merely aligns the matrices.
Aligned Queries.
Every member, the producer included, now uses Kˉ≈RmKm instead of its own key matrix.
To keep its logits we apply the same rotation to its queries:
Qm⊤Km=(RmQm)⊤(RmKm)≈(new QmRmQm)⊤Kˉ
We do this for each of the 12 query heads that share the key head.
The key sharing figure follows one query in each of three layers, a producer and two consumers, through these steps.
logit in layer m
=x⊤Qm⊤Kmx′
=x⊤(RmQm)⊤(RmKm)x′
≈x⊤(RmQm)⊤Kˉx′
Swipe sideways to see the whole drawing →
Step 1 of 3: original
Before sharing: the keys of five tokens and one query in the key space of each layer, with the logits of that query below.
Aligning keys before sharing them.
To share keys across layers with minimal change to the logits, we use the fact that logits are invariant under a shared rotation of queries and keys.
Every layer rotates its keys and its queries together such that the keys of a sharing group are as aligned as possible (Rotate), which leaves its logits unchanged.
The rotated keys are then averaged into one shared key matrix (Share).
Shared Values.
For the values, we notice that the output of a head does not change if we replace its value matrix V by any matrix V′ that reproduces it through a linear map, V=CV′, and absorb C into the output matrix:
OV=O(CV′)=(OC)V′
Such a C exists exactly when the row space of V lies in the row space of V′4.
A shared matrix Vˉ has n rows, the head dimension, so its row space has at most n dimensions, while the multiple value matrices of the members of a sharing group together can span more, as the head dimension is much smaller than the hidden dimension.
From a given Vˉ, a member can therefore only reproduce the part of its value matrix that lies in the row space of Vˉ.
This part is VmP, with the orthogonal projection P onto the row space of Vˉ, and the rest, Vm(I−P), is lost.
The loss depends on Vˉ only through its row space, so what we choose is the projection P.
What a head writes to the residual stream is the product OV and not the value matrix alone, so we measure the loss on this product, which weights every lost direction by how strongly the output matrices use it.
Each value head is read by 12 query heads h with their own output matrices Om,h, and we take the P for which the products Om,hVm of all members lose the least:
Unlike for the keys, this needs no iteration, because stacking the products Om,hVm of all members and heads into one matrix A turns the sum into ∥A−AP∥F2, the error of approximating A by a matrix of rank at most n.
By the Eckart–Young theorem it is minimised by the P that projects onto the n right singular vectors of A with the largest singular values5.
Any matrix whose rows span this space can serve as Vˉ, and we take the singular vectors as its rows, each scaled by its singular value.
The value matrix of the producer is then replaced by Vˉ and all consumers use the same values.
Aligned Outputs.
Every member, the producer included, now uses Vˉ instead of its own value matrix.
The map that best reproduces its own value matrix from the shared one is the least-squares solution
Cm=argCmin∥Vm−CVˉ∥F=VmVˉ⊤(VˉVˉ⊤)−1
which gives CmVˉ=VmP.
To keep its output we absorb this map into its output matrices:
Om,hVm≈Om,h(CmVˉ)=(new Om,hOm,hCm)Vˉ
We do this for each of the 12 query heads that share the value head.
The value sharing figure follows the values of five tokens in the same three layers.
output of layer m for a token
=OmVmx
≈Om(CmVˉ)x
=(OmCm)Vˉx
Swipe sideways to see the whole drawing →
Step 1 of 3: original
Before sharing: the values of five tokens in the value space of each layer. The grid is the basis in which the layer’s output matrix reads them, and every layer fills a cache of its own.
Sharing values and absorbing the difference in the output matrix.
To share values across layers with minimal change to the outputs, we use the fact that the output of a head does not change when a linear map moves from its value matrix into its output matrix.
We choose one shared value matrix whose row space keeps as much as possible of the value matrices of a sharing group, and write the values of every layer as a linear map of the shared values (Approximate).
Every layer then absorbs its map into its output matrix (Absorb), so that all layers read exactly the same values from the cache.
The output of a layer only changes by the part of its values outside the shared row space.
Tokens 2 and 4 have inputs that differ only in such a direction and therefore get the same shared value.
Reference Correction. The alignment above matches matrices, which keeps the output of a member only if the shared values are computed from its own layer input.
A consumer c, however, now reads values that the producer computed from the producer’s layer input, and the residual stream changes between the two layers.
We do not correct this per token and only remove the part that is common to all tokens.
Since attention weights sum to one, we can split any fixed vector vˉ off the values:
Ocj∑αjvj=Ocvˉ+Ocj∑αj(vj−vˉ)
The first term does not depend on the attention weights, so the head adds it to every output.
We choose vˉ as the value of an average input, so that the first term is the response of the head to an average input and the second holds what is specific to the tokens.
Before sharing, vˉ is the consumer’s own average value vˉc.
After sharing it is the average value vˉp that the consumer gets from the cache, which the producer computed from its own input6.
Every output of the consumer is therefore shifted by Oc(vˉp−vˉc).
We remove this shift with a rank-one update of the consumer’s output matrix that corrects its response to vˉp.
We measure the effect of each step without any training, as the increase of the loss over the model without sharing on our long-context evaluation set.
A naive copy of the producer’s keys and values increases the loss by 2.31 bits per byte.
Aligning keys and values reduces the increase to 1.15, and the reference correction to 0.62.
The remaining increase is left to continued pre-training.
Full Benchmark Results
Base and post-trained models are evaluated on different benchmarks: the base models on knowledge, math, and code tasks, with the setup described in Model Quality, and the post-trained models on the reasoning, agentic, and retrieval tasks of the Kolibri 1.1 model card. Their Overall scores are therefore not comparable with each other. Open a category to see its benchmarks.
↓ Lower is better; these rates count as 100 − rate in the averages. Full setup, translation scores, and comparisons with other models are on the Kolibri 1.1 model card.
Citation
If you find this work useful, please cite it:
@misc{neitemeier2026yasa, title = {{YASA}: How Sparse Attention Made {Kolibri} 1.1 up to 14$\times$ More Efficient}, author = {Pit Neitemeier and Fabien C. Y. Benureau and Alessio Serra and Eric Schreiber and Volker Stampa and Steffen Hirschmann}, year = {2026}, howpublished = {Aleph Alpha Research Blog}, url = {https://aleph-alpha.com/en/blog/sparse-attention-in-kolibri-1-1/}}
Aleph Alpha Research, Kolibri: A Sovereign European Model on the Pareto Frontier, technical report, 2026.
C.-P. Hsieh, S. Sun, S. Kriman, S. Acharya, D. Rekesh, F. Jia, B. Ginsburg, RULER: What’s the Real Context Size of Your Long-Context Language Models?, COLM 2024, OpenReview.
DeepSeek-AI, DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression, arXiv:2609.19969, September 2026.
Z. Qiu et al., On the Design of Qwen3.8-Next Architecture: Evaluation, Efficiency, and Training Stability, arXiv:2608.30320, August 2026.
Qwen Team, Qwen3-Next: Towards Ultimate Training & Inference Efficiency, model card, September 2025.
DeepSeek-AI, DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models, arXiv:2512.02556, December 2025.
J. Yuan et al., Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention, arXiv:2502.11089, February 2025.
X. Lai et al., MiniMax Sparse Attention, arXiv:2606.13392, June 2026.
W. Zhao et al., InfLLM-V2: Dense-Sparse Switchable Attention for Seamless Short-to-Long Adaptation, arXiv:2509.24663, September 2025.
DeepSeek-AI, DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence, arXiv:2606.19348, June 2026.
J. Wei et al., HySparse2: Hybrid Sparse Attention with Two-Level KV Sharing, arXiv:2609.26368, September 2026.
E. Lu et al., MoBA: Mixture of Block Attention for Long-Context LLMs, arXiv:2502.13189, February 2025.
Y. Xu, F. Meng, F. Jiang et al., HISA: Efficient Hierarchical Indexing for Fine-Grained Sparse Attention, CoLM 2026, arXiv:2603.28458.
Y. Bai et al., IndexCache: Accelerating Sparse Attention via Cross-Layer Index Reuse, arXiv:2603.12201, March 2026.
L. Yang, Z. Zhang, Z. Chen, Z. Li, Z. Jia, TidalDecode: Fast and Accurate LLM Decoding with Position Persistent Sparse Attention, arXiv:2410.05076, October 2024.
Z. Wang, Z. Pan, F. Meng, M. Zhang, LatentIndex: Cross-Layer Sharing with Layer-Specific Selection for Sparse Attention, arXiv:2610.04635, October 2026.
G. Xiao, Y. Tian, B. Chen, S. Han, M. Lewis, Efficient Streaming Language Models with Attention Sinks, ICLR 2024, arXiv:2309.17453.
W. Brandon, M. Mishra, A. Nrusimha, R. Panda, J. Ragan-Kelley, Reducing Transformer Key-Value Cache Size with Cross-Layer Attention, NeurIPS 2024, arXiv:2405.12981.
Y. Sun, L. Dong et al., You Only Cache Once: Decoder-Decoder Architectures for Language Models, NeurIPS 2024, arXiv:2405.05254.
D. Hendrycks, C. Burns, S. Basart, A. Zou, M. Mazeika, D. Song, J. Steinhardt, Measuring Massive Multitask Language Understanding, ICLR 2021, OpenReview.
D. Hendrycks, C. Burns, S. Basart, A. Critch, J. Li, D. Song, J. Steinhardt, Aligning AI With Shared Human Values, ICLR 2021, OpenReview.
S. Singh, A. Romanou, C. Fourrier et al., Global MMLU: Understanding and Addressing Cultural and Linguistic Biases in Multilingual Evaluation, ACL 2025.
P. Clark, I. Cowhey, O. Etzioni, T. Khot, A. Sabharwal, C. Schoenick, O. Tafjord, Think You Have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge, arXiv:1803.05457, 2018.
Y. Bisk, R. Zellers, R. Le Bras, J. Gao, Y. Choi, PIQA: Reasoning about Physical Commonsense in Natural Language, AAAI 2020.
R. Zellers, A. Holtzman, Y. Bisk, A. Farhadi, Y. Choi, HellaSwag: Can a Machine Really Finish Your Sentence?, ACL 2019, ACL Anthology.
Y. Wang, X. Ma, G. Zhang et al., MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark, NeurIPS 2024, OpenReview.
W. Xuan, R. Yang, H. Qi et al., MMLU-ProX: A Multilingual Benchmark for Advanced Large Language Model Evaluation, arXiv:2503.10497, 2025.
M. Joshi, E. Choi, D. S. Weld, L. Zettlemoyer, TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension, ACL 2017, ACL Anthology.
K. Cobbe, V. Kosaraju, M. Bavarian et al., Training Verifiers to Solve Math Word Problems, arXiv:2110.14168, 2021.
J. Vendrow, E. Vendrow, S. Beery, A. Madry, Do Large Language Model Benchmarks Test Reliability?, arXiv:2502.03461, 2025.
ellamind, GSM8K Platinum Multilingual: Translated Elementary Math Word Problems, Hugging Face, 2026.
D. Hendrycks, C. Burns, S. Kadavath, A. Arora, S. Basart, E. Tang, D. Song, J. Steinhardt, Measuring Mathematical Problem Solving with the MATH Dataset, NeurIPS 2021 Datasets and Benchmarks Track, OpenReview.
M. Chen, J. Tworek, H. Jun et al., Evaluating Large Language Models Trained on Code, arXiv:2107.03374, 2021.
J. Austin, A. Odena, M. Nye et al., Program Synthesis with Large Language Models, arXiv:2108.07732, 2021.