Forgetting Curve: A Reliable Method for Evaluating Memorization Capability for Long-Context Models

Xinyu Liu, Runsong Zhao, Pengcheng Huang, Chunyang Xiao, Bei Li, Jingang Wang, Tong Xiao, JingBo Zhu

Abstract

Numerous recent works target to extend effective context length for language models and various methods, tasks and benchmarks exist to measure model’s effective memory length. However, through thorough investigations, we find limitations for currently existing evaluations on model’s memory. We provide an extensive survey for limitations in this work and propose a new method called forgetting curve to measure the memorization capability of long-context models. We show that forgetting curve has the advantage of being robust to the tested corpus and the experimental settings, of not relying on prompt and can be applied to any model size. We apply our forgetting curve to a large variety of models involving both transformer and RNN/SSM based architectures. Our measurement provides empirical evidence for the effectiveness of transformer extension techniques while raises questions for the effective length of RNN/SSM based models. We also examine the difference between our measurement and existing benchmarks as well as popular metrics for various models.

Introduction

As the "context window war" pushes Large Language Model (LLM) limits from 32k to 1M tokens and beyond, evaluating these models has become a moving target. Standard metrics like Perplexity (PPL) can be misleading; a model may exhibit low perplexity by predicting next tokens well based on local patterns while failing to retrieve specific information from tens of thousands of tokens prior.

Popular benchmarks like "Needle in a Haystack" are often highly sensitive to specific prompts and measure instruction-following rather than raw memory capacity. Other evaluations rely on toy tasks that models may overfit during training. To address these gaps, we introduce the Forgetting Curve, a prompt-free, robust metric designed to measure a model's actual memorization capability as context grows.

Methodology

The Forgetting Curve utilizes two primary tests conducted via teacher forcing to isolate pure memorization from general language knowledge:

  1. Copy Accuracy Curve: The model is presented with a sequence $S$ and then asked to replicate $S$ again. This tests the emergent ability to "copy" from history without explicit instructions.
  2. LM Accuracy Curve: The model is given an irrelevant prefix of the same length, followed by the first half of $S$, and asked to predict the second half. This establishes a baseline of how well the model can "guess" tokens based on general linguistic patterns.
Figure 2: Illustration of the copying task versus the language modeling baseline task.

By plotting these two curves against sequence length, we identify three distinct phases of memory:

  • Fine-grained Memory: The model achieves near-perfect recall (>99% copy accuracy).
  • Coarse-grained Memory: Copy accuracy is below 99% but remains significantly higher than the LM baseline, indicating the model retains some information but loses precision.
  • Amnesia: Copy accuracy drops to the level of the LM baseline, signifying a total loss of memory for the prefix.
Figure 1: The Forgetting Curve showing the transition from Fine-grained to Coarse-grained memory and finally to Amnesia.

Key Insights and Results

Our evaluation across datasets like PG-19 (English books) and Ruozhiba (Chinese) revealed several critical findings:

  • The Perplexity Paradox: Low perplexity does not guarantee long-term memory. We observed models where PPL continued to improve with longer context even as actual memorization hit a wall.
  • RNN/SSM Bottleneck: While architectures like Mamba and RWKV theoretically support infinite context, they exhibit almost zero fine-grained memory. Their fixed-size state compression prevents the exact token replication possible in Transformers.
  • Effective vs. Claimed Length: Most models enter the Coarse-grained or Amnesia phases long before reaching their claimed context limits. For instance, Llama-2-7B begins losing fine-grained memory almost immediately despite its 4k limit.
  • Llama-3's Advancement: We noted a massive improvement in fine-grained memory from Llama-2 (0 tokens) to Llama-3 (4k tokens), likely due to superior training regimes rather than architectural changes.

Conclusion

The Forgetting Curve provides a quantifiable way to rank models by "Fine Length" and "Coarse Length," offering a clearer picture of reliability than a single context window number. While it currently measures memorization rather than complex reasoning, it serves as a foundational tool for validating long-context architecture extensions like RoPE scaling. Future work will expand this scope to a wider variety of emerging architectures and explore the relationship between memory and synthesis.

Summary updated

BibTeX
@inproceedings{liu2024forgetting,
  author = {Xinyu Liu and Runsong Zhao and Pengcheng Huang and Chunyang Xiao and Bei Li and Jingang Wang and Tong Xiao and JingBo Zhu},
  title = {{Forgetting Curve: A Reliable Method for Evaluating Memorization Capability for Long-Context Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=iqyjt3tPAh},
}
Figure