This paper introduces Recursive State-Augmented Language Models (Recursive SALM), a framework designed to give frozen, pretrained language models a "persistent memory" that lives outside their standard token context window. By maintaining a small, evolving latent state that generates model adaptations (like LoRA weights or soft prompts), the system can perform reasoning on information that has long since been truncated from its active memory.
TL;DR
Recursive SALM enables frozen language models to remember and reason over long sequences by compressing history into a persistent 64-dimensional latent state. This state is used to dynamically adapt the model's behavior, achieving accuracy on complex reasoning tasks comparable to models that have access to the full, uncompressed token history.
What Problem Does This Paper Address?
Autoregressive language models (LLMs) are limited by their finite context window. As a conversation or document grows, the cost of processing every previous token increases quadratically due to the nature of attention mechanisms. Eventually, old information must be truncated to keep the model efficient, which means the LLM "forgets" earlier evidence.
While techniques like retrieval-augmented generation (RAG) or long-context windows exist, they are computationally expensive. Recursive SALM proposes a middle ground: instead of keeping all the raw tokens, can we compress the "essence" of the history into a small, fixed-size vector (a latent state) and use that vector to modify how the LLM processes the current input?
Methods
The authors propose a modular Read–Transition–Write architecture:
- Read: An encoder takes a new observation (e.g., a user's turn in a dialogue) and converts it into a vector representation using the frozen LLM's own internal states.
- Transition: A recurrent unit (like a GRU) combines this new information with the previous latent state to produce an updated state.
- Write: A generator module maps this updated state to a specific adaptation for the frozen LLM.
The paper explores several "Write" interfaces, including:
- Generated/Gated LoRA: The state generates low-rank weight updates for the model.
- Soft Prompts/Prefixes: The state generates continuous embeddings that are prepended to the input.
- Activations (FiLM): The state modulates the model's internal hidden representations.
Crucially, the backbone LLM (GPT-2 small in this study) remains frozen. Only the small Read-Transition-Write modules are trained.
Datasets
The framework was evaluated on two synthetic benchmarks designed to test memory and logic:
- Four-turn Hypothesis Code Memory (HCM): The model receives three logical clues about a hidden two-digit code (e.g., "My code is even," "It is greater than 50") and must identify the code on the fourth turn. The clues are provided one by one and then removed from the token context, forcing the model to rely on its latent state.
- Two-turn Recall: A simpler task testing the model's ability to remember a specific, unseen codeword across turns.
Key Insights and Ideas
- State as Adaptation, Not Just Input: A core "aha moment" is that the latent state shouldn't just be fed back into the model as more tokens. Instead, using the state to adapt the model (via LoRA or FiLM) allows the state to change the very logic the model uses to process the current prompt.
- The Importance of Centering: The author found that raw LLM representations of different sentences are often nearly identical (collinear). To make the latent state move meaningfully, they implemented "centered RMS normalization," which subtracts the mean pooled state of training data.
- Separation of Concerns: By separating state propagation (Transition) from how that state is used (Write), the architecture allows researchers to swap out different adaptation methods without changing the underlying memory mechanism.
Key Results
The experiments, though small-scale, yielded impressive results:
- Parity with Full Context: On the HCM task, the Gated LoRA SALM reached 89.1% accuracy. This is comparable to a "Full-context LoRA" baseline (88.0%) that had access to every single previous token.
- Extreme Compression: SALM achieved these results using only a 64-dimensional state, demonstrating that logical evidence can be highly compressed.
- Proven Dependency: Through "interventions" (zeroing out or shuffling the state), the author proved the model was truly using its memory. As shown in Figure 1, removing the state information causes accuracy to plummet to chance levels (~31%).
Limitations and Future Work
- Scale: The study was limited to GPT-2 small (124M parameters). Whether these findings hold for 70B+ parameter models remains to be seen.
- Generation vs. Ranking: While the model is excellent at ranking the correct answer among candidates, it struggled to generate exact codewords verbatim when they weren't seen during training.
- Stochasticity: The paper provides a mathematical framework for stochastic (probabilistic) states to handle uncertainty, but the experiments only covered the deterministic version.
- Long Horizons: The tasks were only 2-4 turns long. Testing how well the state holds up over hundreds of interactions (and avoiding "memory drift") is a key next step.
Summary updated