A single norm-projection module before the transformer trunk lets a decoder-only LLM pretrain and generate natively on a compressed sequence. At 537M parameters with 2× compression, quality approaches parity; speedups stack multiplicatively with GQA.
Going deeper
Sequence length compression at inference with compression factor X=2. Four tokens are grouped into two consecutive blocks of two tokens each. The first block contains the real tokens the and cat; the second block contains the real token sat and a placeholder embedding varnothing, which pads the input to the nearest block boundary. Each block is processed by an identical compressor module, producing a single compressed embedding e1 and e2 respectively. All four input embeddings of dimension h are passed through a RMSNorm, each pair is concatenated to 2h, projected back to h by a learned linear layer, and passed through a second RMSNorm. The two compressed embeddings are then passed to the transformer trunk.
Training construction for X=2 sequence compression. The input sequence of six tokens is split into two parallel sequences: a full-block sequence (blue) where each block contains two real tokens, and a partial-block sequence (red) where each block contains one real token and one placeholder varnothing. Both sequences are compressed and processed through the transformer trunk. In the attention layer, the full-block sequence uses standard causal masking. The partial-block sequence computes attention using its own queries against the full-block keys and values, with diagonal blocks additionally masked out, removing the self-position contribution. A cheap dot-product correction then adds back the self-block attention using the partial-block sequence’s own keys and values, combined with the FlashAttention LSE output via numerically stable merging. Together the two sequences predict all six original token positions exactly once, covering the complete training signal with total attention compute O(T2/X), strictly less than uncompressed training.
Imagine a very long conveyor belt of letters. Every machine on the factory floor reads every letter as it passes. If you could glue pairs of adjacent letters into single tiles before the belt enters the factory, every machine would see half as many items, and the whole line would run faster, but the tiles had better carry enough information that the product comes out right.
That is what this paper does for a language model. Right after looking up each word's vector, it glues X consecutive vectors into one, then feeds the shorter belt to the standard transformer, which is not changed at all. At generation time, the last tile is partly empty and gets padded with a blank; once the tile fills up, the belt advances one position. A special training scheme makes sure the model practises every possible state of a partly filled tile.
At the smallest scale the glue loses information and quality drops, but as the model grows the gap shrinks: at 537M parameters with tiles of two, quality nearly matches the unglued belt. The speed gain is real and compounds with other tricks that shrink the per-letter cost, because this one reduces how many letters there are in the first place.
The abstract, word for word, with the seven densest phrases unpacked.
The efficiency of decoder-only LLMs is routinely improved by making attention cheaper per token: reducing KV-cache size, restricting the receptive field, or replacing the attention operator. All of these leave the number of tokens flowing through the network unchanged, so the FFNs and the token-wise projections continue to scale with full sequence length, and in most cases the attention cost does as well. Existing approaches that do shorten the sequence pay for it elsewhere, through restructured generation, separate decoders, or compression applied post hoc to a frozen model. We show that neither is necessary: a single normalization-projection module between the embedding layer and an otherwise unchanged transformer trunk1 suffices to pretrain a decoder-only LLM that operates natively on a compressed sequence, including the tokens it generates. A training construction that covers every autoregressive decoding state exactly once2 eliminates train-inference mismatch and requires no hyperparameters beyond the compression factor X. In controlled experiments at 79M–537M scale, with throughput measured up to 7B parameters3, quality approaches parity with the uncompressed baseline as models grow4 (near parity at 2× compression and 537M parameters), while sequence length compression accelerates prefill, decode, and training simultaneously, and stacks multiplicatively with GQA5, with prefill speedups approaching X2 at 1M context6, all without requiring new inference kernels7. Sequence length is therefore a trainable property of the model: compressing it shortens every part of the network and composes with existing efficiency methods.
Two lines of work converge: making attention cheaper per token, and reducing the token count itself.
Read five parts of it, in this order.
Skip Appendices A–F if you trust the numbers; they document hyperparameters, raw throughputs, and FLOP derivations.
If the quality-at-scale trend does not continue, or the training construction has a gap, these places matter most.
The X sequences cannot simply be run as independent forward passes: in a partial sequence, every block would then attend over preceding partial blocks, whereas during decoding a partial block is always preceded by completed blocks. We therefore share computation across the sequences, exploiting the fact that completed blocks are identical in every configuration. The full-block sequence is processed with standard causal attention, and its keys and values provide the shared context for all other sequences. Each partial-block sequence then attends with its own queries against these shared full-block keys and values, with the diagonal blocks masked out, since the key-value pair at a query’s own compressed position is derived from the full block and therefore does not match the partial content that the query encodes. The missing self-block contribution is computed separately, using each query against its own block’s keys and values, and merged with the first part through the numerically stable log-sum-exp combination that FlashAttention uses for split KV inputs.
Every reported number comes from a single training run per configuration. Data order is fully deterministic and shared, and learning rate and token budget are matched. This supports the relative-comparison claims this paper makes; however, absolute numbers carry seed variance that we do not quantify. In particular, orderings between nearby points, such as adjacent configurations in Fig. 6, should be read with this in mind, while the cross-scale dominance gaps are far larger than any plausible seed noise.
Nothing on this page was recomputed. Every claim points to the paper so you can check it.
More latest news
Read all