Sequence Compression: A New Stackable Primitive for LLM Efficiency

Inserting a normalized projection module between the embedding layer and Transformer backbone pretrains an LLM that natively supports compressed sequences.
The study proposes a native sequence compression method: inserting a normalized projection module between the embedding layer and the Transformer backbone lets a decoder-only LLM support compressed sequences (including generated tokens) during pretraining without modifying the backbone or inference kernels. A training construction ensures each autoregressive decoding state is covered exactly once, eliminating train-inference mismatch, with only the compression factor X as a hyperparameter. At 79M-537M parameters, 2× compression approaches the uncompressed baseline; compression accelerates prefill, decoding, and training, stacks multiplicatively with GQA, and approaches X² prefill speedup at 1M context. Treating sequence length as a trainable property, this stackable primitive offers a new path for LLM efficiency, though larger-scale quality needs validation.
LLM efficiency optimization has long focused on reducing the per-token cost of attention—shrinking KV caches, limiting receptive fields, or replacing attention operators. But these methods do not reduce the number of tokens flowing through the network; the computation of feed-forward networks (FFNs) and per-token projections still scales with the full sequence length, and in most cases attention costs remain high. Existing approaches to shortening sequences often require restructuring the generation pipeline, introducing a separate decoder, or post-hoc compression of frozen models. A new study proposes a different approach: inserting a normalized projection module between the embedding layer and the Transformer backbone to pretrain a decoder-only LLM that natively supports compressed sequences (including generated tokens).

Sequence Compression: From "Cheaper per Token" to "Fewer Tokens"
The essence of current mainstream efficiency optimization is making attention cheaper per token, but the sequence length itself is unchanged. This means the computational burden of FFNs and projection layers still scales with sequence length. Sequence length compression directly reduces the number of tokens flowing through the network, thereby lowering the cost of attention, FFNs, and projections simultaneously. Research shows that this compression can be natively integrated during pretraining, without modifying the Transformer backbone or requiring new inference kernels.
Computational burden of feed-forward networks (FFNs): The FFN in a Transformer typically consists of two linear transformations, applied independently to each token in the sequence, and often accounts for more than two-thirds of the model's total parameters. Its computation is O(sequence length × hidden dimension × intermediate dimension), unlike attention's O(sequence length² × dimension)—FFN cost grows linearly with sequence length, while attention cost grows quadratically. Thus even if attention is fully optimized, the linear overhead of the FFN remains. Sequence compression directly reduces the token count, lowering the computation of FFNs and per-token projections proportionally—a benefit that the "cheaper per token" route cannot achieve.
KV cache and receptive field limitations: The KV cache stores key-value pairs of historical tokens to avoid redundant computation, and its memory footprint grows linearly with sequence length; limiting the receptive field (e.g., sliding window attention) lets each token attend only to local context. Both reduce the unit cost of attention, but the total number of tokens in the sequence is unchanged, and subsequent FFNs still must process all tokens. Sequence compression is orthogonal to these methods and can be stacked with them.
Training Construction: Eliminating Train-Inference Mismatch
The key challenge in achieving native compressed-sequence training is the mismatch between training and inference. The researchers designed a training construction that ensures each autoregressive decoding state is covered exactly once, thereby eliminating the mismatch problem. The method requires only the compression factor X as a hyperparameter, with no additional tuning. In controlled experiments with 79M to 537M parameters, model quality approaches the uncompressed baseline as scale grows—nearly on par at 2× compression and 537M parameters. Meanwhile, sequence length compression accelerates prefill, decoding, and training, and stacks multiplicatively with GQA (grouped-query attention). At 1M context, the prefill speedup approaches X², with no need for new inference kernels.
Train-inference mismatch: In standard autoregressive training, every position participates in the loss as a prediction target; at inference, the model generates token by token, and the hidden states of already-generated tokens must be retained and used in subsequent computation. If training simply downsamples the sequence (e.g., keeping one out of every X tokens), some decoding states never appear during training yet are needed at inference, causing distribution shift. The study's training construction carefully designs the sampling pattern to ensure that every autoregressive decoding state that may arise at inference is covered exactly once during training, so that a model trained on compressed sequences can be used directly for generation without modifying the decoding pipeline.
Compression factor X: X denotes the factor by which the sequence is compressed; for example, X=2 merges every two tokens into a single representation. Larger X yields higher efficiency gains but also greater information loss. This method is native pretraining: compression occurs immediately after the embedding layer, and the sequence length seen by the Transformer backbone is already reduced to 1/X of the original.
Comparison with Existing Methods: The Advantage of Stackability
Unlike methods that require restructuring the generation pipeline or post-hoc compression, sequence compression, as a stackable primitive, can work in concert with existing techniques such as GQA. The researchers validated its speedup in throughput measurements up to 7B parameters. This means sequence length is no longer a fixed property but a trainable characteristic of the model—compressing sequence length shortens every part of the network and combines with existing efficiency methods, offering a new path for LLM training and inference.
GQA (grouped-query attention): GQA lets multiple query heads share the same set of key-value heads, reducing KV cache size and attention computation, and is a standard optimization adopted by models such as LLaMA 2. It operates on the head dimension within attention, while sequence compression operates on the token dimension; since they act on different dimensions, their speedups multiply: total computation drops to approximately 1/X (sequence compression) × the GQA reduction ratio. The "multiplicative stacking" mentioned in the original text refers to this relationship.
Prefill and decoding: The prefill stage processes the entire prompt sequence in parallel, and its computation is dominated by sequence length; after compression the length drops to 1/X, giving a theoretical speedup close to X, while the attention part, due to its quadratic dependence on length, can achieve higher speedup, with the combined effect approaching X² at 1M context. The decoding stage generates token by token, and the history length that must be processed at each step is likewise shortened, so it also benefits from speedup.
Key Insights and Limitations
The core contribution of this research is treating sequence length as a trainable property and achieving native compression through a single module. However, quality evaluation was conducted at scales up to 537M parameters (throughput measured up to 7B), and quality at larger scales still needs further validation. In addition, the choice of compression factor X requires careful consideration of the quality-efficiency trade-off in practical applications.
According to the research data, sequence compression approaches the uncompressed baseline in quality at 2× compression, and when stacked with GQA, prefill speedup is significant. This offers a new direction for LLM efficiency optimization: rather than optimizing only the per-token cost, directly reduce the number of tokens.
One-line Summary
Inserting a normalized projection module between the embedding layer and the Transformer backbone pretrains an LLM that natively supports compressed sequences.
Paragraph Summary
This study proposes a native sequence compression method: inserting a normalized projection module between the embedding layer and the Transformer backbone enables a decoder-only LLM to support compressed sequences (including generated tokens) already during pretraining, without modifying the backbone or inference kernels. The key is a training construction that ensures each autoregressive decoding state is covered exactly once, eliminating train-inference mismatch, with only the compression factor X as a hyperparameter. In experiments with 79M to 537M parameters, quality at 2× compression approaches the uncompressed baseline; sequence compression simultaneously accelerates prefill, decoding, and training, and stacks multiplicatively with GQA, with prefill speedup approaching X² at 1M context. The method treats sequence length as a trainable property and, as a stackable primitive, works in concert with existing techniques, offering a new path for LLM efficiency optimization, though quality at larger scales still needs validation.
Related articles

RCD: Making Large Models Smaller and Stronger with Reasoning Circuit Distillation
The paper proposes Model-Intrinsic Reasoning Circuit Distillation (RCD), which uses edge attribution patching to identify key Transformer circuits and transfers reasoning ability by matching logit changes caused by circuit attenuation, outperforming existing KD methods on mathematical reasoning and code generation.

PreLat: Efficient Cross-Model-Family Communication Using Prefill States
PreLat proposes a cross-model-family communication interface that builds latent messages from the sender's prefill states, enabling efficient information transfer without decoding text, with over 8× lower latency and minimal cost for new models.

Don't Rush to Code with AI: A Practical Method for Using Doubao Work to Find Paid Projects
Vibe Coding series episode one: don't rush to code with AI. Use Doubao Work to analyze tech news and find demand, then use "free permission learning images" to hand finished products to e-commerce merchants for free, validating willingness to pay through real feedback—let customers, not AI, judge the market.