Back

Beyond the Token Wall: How REFORM Redefines Long-Context AI Inference

Correspondence to daniel@aerlabs.tech · shubham@aerlabs.tech
cite ↓
TL;DR
Outline
  1. The Bottleneck: Why Long Context is Hard — the quadratic-attention, memory, and context-limit problems, and the trade-off between existing solutions.
  2. Introducing REFORM: Efficiency Meets Retrieval — the Compress, Gather, and Recompute stages that unite recurrent compression with random access.
  3. Exceptional Results Across the Board — Needle in a Haystack, 1M-token accuracy, efficiency gains, and advantages over RAG.
  4. Conclusion — why REFORM points toward scalable, resource-efficient long-context AI.
  5. Talk Resources — slides, recording, related research, and how to reach the speaker.

The recent surge in large language models (LLMs) has opened up vast possibilities for various AI services, from sophisticated chatbots to advanced coding assistants. However, a key capability required for these applications—handling exceptionally long input texts, often referred to as "long context" or "long text processing"—remains a significant hurdle.

Whether dealing with a massive code repository, a history of chat interactions, or token-heavy multi-modal inputs (like high-resolution images or videos), the ability to process long inputs is becoming increasingly critical.

This post dives into REFORM (Recurrent Encoding with RecoMputation), a groundbreaking new method developed by Woomin Song and his colleagues at KAIST, designed to overcome the efficiency and performance issues associated with long context inference.

1: The Bottleneck: Why Long Context is Hard

The core challenge lies primarily in the architecture of the Transformer model and its attention mechanism.

  1. The N2 Problem: Transformer attention requires every token to interact with every other token. If the number of tokens is N, the computational cost scales quadratically (N2). As context length increases, the required computation rapidly becomes prohibitive.
  2. Memory Overload: Storing the Key-Value (KV) cache, essential for efficient decoding in Transformers, also increases proportionally with the context length, putting significant strain on GPU memory.
  3. Context Limitations: LLMs trained on a specific context limit (e.g., 2K tokens) often experience a dramatic performance drop if that limit is slightly exceeded during inference.

Existing Solutions: A Trade-off

To address these limitations, existing inference-time algorithms generally fall into two camps:

Reform Streaming
Figure 1. Recurrent compression streams the long input chunk by chunk, compressing or discarding older KV-cache entries to bound memory.

2: Introducing REFORM: Efficiency Meets Retrieval

The REFORM method seeks to combine the efficiency of recurrent compression with the crucial ability of random access. The technique is built on three core stages: Compress, Gather, and Recompute.

1. Compress Stage: Encoding and Early Exit

In the initial stage, the long input is broken down into manageable chunks.

2. Gather Stage: Searching for the Needle

When a final query is presented, the Gather stage identifies which parts of the previously encoded context are essential for generating the correct answer.

3. Recompute Stage: RecoMputation

The final stage takes the identified tokens and uses them to construct the final output.

Reform Concept
Figure 2. The REFORM pipeline: Compress encodes chunks with early exit, Gather retrieves the critical tokens via cosine similarity, and Recompute rebuilds their KV cache for decoding.

3: Exceptional Results Across the Board

REFORM was rigorously evaluated across synthetic and realistic benchmarks, consistently demonstrating superior performance.

On foundational benchmarks like Needle in a Haystack (where a key fact is hidden randomly within a very long document), REFORM showed dramatic advantages:

Efficiency Gains

One of REFORM's strongest features is its efficiency advantage. It showed both lower inference time and lower memory usage compared to baseline methods. This efficiency is directly attributable to the Early Exit strategy used in the Compress stage, which reduces the computational load needed to create the embeddings.

Architecting Beyond RAG

REFORM offers distinct advantages over typical Retrieval-Augmented Generation (RAG) systems:

  1. Context Preservation: While RAG often suffers from fragmentation (losing context at chunk boundaries), REFORM’s recurrent encoding, conditioned on the previous chunk's KV cache, ensures better contextual understanding during the initial embedding process.
  2. Internal Solution: RAG relies on external retrieval models (like BM25 or dedicated neural retrievers), which must be separately trained and maintained for specific domains (e.g., code, medical). REFORM, however, is an architecture-level solution. It functions solely using the base LLM, meaning it naturally handles any domain that the underlying LM is trained on, without the need for an external retrieval component.
REFORM Performance
Figure 3. Performance comparison of REFORM vs. baselines.

4: Conclusion

REFORM successfully bridges the gap between efficient sequential processing and crucial random access capabilities. By selectively storing key QKB states and employing targeted retrieval via Cosine Similarity and recomputation, it proves that long-context AI can be both powerful and resource-efficient. It’s an approach that looks set to become a foundational component in the next generation of scalable and intelligent LLM applications.

5: Talk Resources

About This Talk

This talk was presented by Woomin Song and hosted by Daniel Kang as part of AER Labs' technical discussion series.

Blog summary written by Shubham Agrawal. Original speaker owns the rights to the content.

Presentation Slides

Slides. Download Full Presentation (PDF) → Please give appropriate credits to the speaker if you are using this presentation.

Watch the Talk

Recording. Watch on YouTube →

Connect with the Speaker

Interested in discussing AI? Connect with us at daniel@aerlabs.tech or shubham@aerlabs.tech.

References

  1. Woomin Song et al., "REFORM: Recurrent Encoding with RecoMputation for efficient long-context inference," arXiv:2506.01215.

Cite this work

@article{song2025reform,
  title  = {REFORM: Recurrent Encoding with RecoMputation for Efficient Long-Context Inference},
  author = {Song, Woomin and others},
  year   = {2025},
  eprint = {2506.01215},
  archivePrefix = {arXiv}
}