WhoBuilt

Going beyond RAG: Extended Mind Transformers

Sep 11, 2024· 16 min· 17K views·Watch on YouTube

Speaker

Phoebe Klett, a machine learning engineer at Normal Computing, presents Extended Mind Transformers at an AI Engineer event.

Why long context and RAG fall short

Klett says application-specific information is essential, but long context can be costly to support and can distract models with irrelevant material. RAG selects context before generation, using representations that may not match how the model reasons. Neither approach lets the model retrieve more information mid-generation when it is uncertain.

How Extended Mind Attention retrieves information

Extended Mind Attention saves key-value representations of memory tokens, then lets each query token retrieve and attend to similar tokens during generation. Klett says relative position methods such as RoPE and ALiBi let the approach work without further fine-tuning. The main change is to the Transformer’s attention mechanism.

Benchmark results on long-context retrieval

Klett describes a counterfactual benchmark with query-answer contexts ranging from about 2,000 to 16,000 tokens. To test whether models use information supplied at inference, the benchmark replaces a known answer, Lee Hazlewood, with the plausible but incorrect Terry Allen. In the reported experiments, Extended Mind models remain competitive with fine-tuned models up to 16K tokens, and a setup combining RAG with internal retrieval outperforms GPT-4.

Citations and uncertainty-guided retrieval

RAG citations may show that a fact appeared in the input, but do not establish that the model used it to generate its answer. Extended Mind Transformers can identify memory tokens attended to when producing a token; Klett gives an example where the model retrieves “1971” to answer when Alexander Grothendieck received French citizenship. When the model is uncertain, it can regenerate a token while retrieving more memory, correcting an example answer from 1993 to 1971.

Parameters for practical use

A smaller memory stride can improve token representations but requires more computation. Top K controls how many memories each query token can retrieve and should grow with memory length. Similarity masking can filter low-similarity results, while removing unknown tokens can help prevent noisy matches, especially with RoPE models.

Takeaways

  • Use Extended Mind retrieval when a model needs to draw from large memories during generation, rather than selecting all context in advance.
  • Evaluate retrieval with counterfactual facts to check whether the model follows supplied information over memorized answers.
  • Inspect attended memory tokens to understand which evidence contributed to generated answers.
  • Consider retrieving more memory when token uncertainty is high, then regenerate the uncertain output.
  • Tune stride, Top K, similarity thresholds, and unknown-token filtering to balance retrieval quality, compute, and noise.

Mentioned in this talk

Search inside this talk

What was claimed 12

Show all 12 facts

Related talks