The Surprising Soupability of Documents in State Space Models

Yasaman Jafari, Zixian Wang, Leon Bergen, Taylor Berg-Kirkpatrick · DOI

Abstract

Structured State Space Models (SSMs), such as Mamba2, exhibit a remarkable property known as "soupability." This allows individual documents to be encoded independently and their resulting hidden states merged—or "souped"—into a single context using simple commutative operations like averaging. This modular approach facilitates complex multi-document reasoning with significant inference speedups (up to 14.6x) and the ability to scale to hundreds of documents without the need for costly re-encoding.

Introduction: The Monolithic Bottleneck

Current Large Language Models (LLMs) typically operate as monolithic processors. To perform multi-document reasoning, all relevant texts must be concatenated into a single sequence. This approach suffers from two primary limitations:

  1. Computational Inefficiency: Processing massive contexts is expensive. Even with linear-time models, the overhead is significant; in Transformers, the $O(L^2)$ attention cost is prohibitive.
  2. Inflexibility: Any update to the document collection—adding, removing, or modifying a single entry—requires a full re-encoding of the entire sequence from scratch.

This research explores whether document representations can be treated modularly: encoded once, cached, and combined dynamically to support downstream reasoning tasks.

Methodology: Corpus Encoding via State Souping

The proposed method, Corpus Encoding via State Souping, involves three distinct phases:

  1. Independent Encoding: Each document in a corpus is processed by a shared SSM encoder (specifically Mamba2) to generate a fixed-size hidden state.
  2. State Souping: These individual states are merged using a commutative pooling operator. While averaging, summation, and max-pooling were tested, element-wise averaging proved most effective.
  3. Conditioned Decoding: The "souped" state serves as the initial state for the decoder, which then processes the user's query to generate an answer.
Comparison between traditional Concatenation Encoding and the proposed Soup Encoding.

Crucially, the authors found that "soupability" is not an inherent zero-shot property of pretrained models. It requires full encoder-decoder finetuning with activation checkpointing to teach the model how to interpret these merged representations.

Key Insights

SSMs vs. Transformers

Unlike Transformers, which utilize a KV cache that scales with input length, SSMs compress information into a fixed-size state. Because SSMs are based on linear recurrence, linear operations (like averaging) on their hidden states are mathematically grounded. Experiments with Llama-3 (a Transformer) using a similar "cache souping" approach resulted in total performance collapse.

The Superiority of Averaging

Simple element-wise averaging of states is more robust than summation. Summation causes activation magnitudes to explode as more documents are added, whereas averaging maintains representations within a numerical range familiar to the model.

Modular Retrieval-Augmented Generation (RAG)

This discovery enables a more efficient RAG workflow. Documents can be pre-encoded and cached. Upon receiving a query, the system averages the states of the top-k retrieved documents. If a document is updated, only that specific document needs re-encoding.

Results and Performance

The souping method demonstrates competitive performance and exceptional scalability. On HotpotQA, souped Mamba2-8B achieved an Exact Match (EM) score of 47.8, closely trailing the 49.0 EM of the traditional concatenation approach.

Performance comparison (EM / F1) of Concatenation vs. Soup Encoding across varying numbers of distractor documents.

Key performance metrics include:

  • Inference Speedup: For a 32k token context, souping provides a 14.6x speedup by bypassing document re-processing during the query phase.
  • Scalability: Models trained on 64 document segments generalized effectively to 256 documents at test time, provided they received additional finetuning on larger sets.
  • Benchmark Superiority: On RACE and QuALITY, the souping method substantially outperformed traditional concatenation-based finetuning.

Limitations and Future Directions

While promising, the method has limitations. It currently requires task-specific finetuning rather than being a zero-shot emergent property. Additionally, there is likely a theoretical "saturation point" where a fixed-size state can no longer resolve conflicting or overly dense information. Future research will investigate whether hybrid architectures (e.g., Jamba) can retain these soupable properties.

Summary updated

BibTeX
@inproceedings{jafari2026surprising,
  author = {Yasaman Jafari and Zixian Wang and Leon Bergen and Taylor Berg-Kirkpatrick},
  title = {{The Surprising Soupability of Documents in State Space Models}},
  booktitle = {COLM},
  year = {2026},
  url = {https://openreview.net/forum?id=3YtIdxXzhi},
}
Figure