TL;DR
Instead of concatenating an entire corpus into a massive context window, document souping encodes documents independently using Structured State Space Models (SSMs) and merges their layerwise hidden states via simple averaging. When properly finetuned, Mamba2 models using souped representations match or outperform traditional monolithic concatenation on multi-hop QA and long-narrative comprehension—while enabling offline caching that yields up to a 14.6× inference speedup.
What Problem Does This Paper Address?
Standard long-context language modeling relies on a monolithic strategy: concatenating all retrieved documents and the query into a single long prompt. This creates severe bottlenecks:
- Computational waste: Modifying or adding a single document requires re-encoding the entire sequence from scratch.
- Inflexible reuse: In retrieval-augmented generation (RAG), unique document combinations cannot reuse pre-computed context representations.
- Transformer inefficiency: Transformers face $O(L^2)$ attention scaling and dynamically sized key-value (KV) caches proportional to sequence length, making post-hoc aggregation unnatural.
Structured State Space Models (SSMs) compress sequences into fixed-size hidden states using linear recurrences. The authors explore whether these fixed-size hidden states can be pooled post-hoc (like "model souping," but for internal representations) to achieve modular, dynamic multi-document reasoning.
Methods
- State Souping: Each document $d_i$ is encoded independently by a shared SSM encoder ($\text{SSM}_\theta$), producing layerwise hidden states $\{h_i^{(l)}\}_{l=1}^L$.
-
Commutative Pooling: Hidden states across documents are pooled at each layer using simple commutative operators: $$h_{\text{soup}}^{(l)} = \frac{1}{k} \sum_{i=1}^k h_i^{(l)}$$ (The authors also ablate summation and max-pooling, alongside pre- and post-pooling unit normalization).
-
Conditioned Decoding: The pooled states $\{h_{\text{soup}}^{(l)}\}$ are injected across all decoder layers as recurrent context to predict answer $y$ given query $q$.
- Training Strategy: The authors show that full encoder-decoder finetuning (with document-level activation checkpointing to maintain constant memory) trains the encoder to produce representations designed to be blended.
Datasets
The authors evaluated Mamba2 (2.7B and 8B parameters) across diverse reasoning setups:
- HotpotQA: Multi-hop question answering requiring multi-document evidence synthesis across Wikipedia paragraphs.
- RACE & QuALITY: Long-document reading comprehension. Models were trained on shorter RACE passages and evaluated zero-shot on QuALITY's complex, multi-thousand-word narratives.
- RULER (QA_1): Single-hop question answering requiring localized signal extraction within large distractor sets.
- RULER (NIAH multikey-2): "Needle In A Haystack" sparse key-value retrieval testing memorization across dense, independent segments.
Key Insights and Ideas
- SSMs vs. Transformers: An analogous "KV cache souping" baseline on LLaMA-3 8B collapsed completely (dropping from 48.50 EM down to 0.53 EM on HotpotQA). SSMs succeed because their linear recurrence maintains a fixed-size state, making linear state blending mathematically and structurally sound.
- Finetuning is Essential: Off-the-shelf, pretrained Mamba2 models cannot parse souped states (yielding just 2.6 EM on 5 documents). Decoder-only tuning recovers performance to 38.8 EM, but full encoder-decoder tuning reaches 47.8 EM because the encoder learns to emit representations that compose cleanly.
- Simple Averaging Beats Complex Normalization: Elementwise averaging without normalization proved the most robust. Summation suffered from unbounded activation magnitude growth, while unit normalization destroyed relative magnitude differences between informative documents and distractors.
- Zero-Shot Transfer on Long Documents: On QuALITY, segmenting long stories and averaging their states significantly outperformed feeding the full text into the model at once.
Key Results
- Long-Document QA (Table 4): On RACE, 4-segment souping scored 66.02% accuracy versus 56.01% for standard concatenation. On QuALITY, souping scored 51.15%, vastly outperforming the concatenated baseline (32.69%).
- Multi-Hop QA (HotpotQA, Table 1 & 2): Souping matched concatenated baselines closely (e.g., 55.8 / 69.8 EM/F1 vs. 57.1 / 71.3 for concat on 2 documents; 47.8 / 61.3 on 5 documents).
- Scalability to 256 Documents (Table 8): In NIAH stress-tests, finetuning on 128 segments allowed the model to maintain 37.25% EM when scaling to 256 segments, outperforming the concatenated 8k baseline (35.55%).
- Inference Latency (Table 6): Because document states are cached offline, querying a cached 32k context took only 65.8 ms compared to 963.2 ms for full concatenation—a 14.6× speedup.
Limitations and Future Work
- Extrapolation Mismatch: Models finetuned on small soup sizes (e.g., 2–4 segments) degrade when suddenly tested on much wider contexts (e.g., 16–32 segments). Generalization requires exposing the model to wider segment counts during training.
- Signal Dilution in Needle Tasks: On extreme distractor single-hop tasks (RULER QA_1), excessive chunking diluted relevant signals into background noise, leading to reduced performance when segment counts grew too high.
- Architecture Scope: Experiments focused exclusively on Mamba2 (a non-hybrid SSM). Validating the approach on hybrid SSM-attention architectures or recurrent linear RNNs remains open for future research.
Summary updated