[Paper Review] Unbounded cache model for online language modeling with open vocabulary
This paper proposes an unbounded cache model that enhances pre-trained language models by dynamically adapting to new data distributions using a non-parametric memory of past hidden activations. By leveraging approximate nearest neighbor search and quantization, the model efficiently retrieves relevant context from millions of stored representations, reducing perplexity by up to 69.7% in out-of-domain settings compared to static models.
Recently, continuous cache models were proposed as extensions to recurrent neural network language models, to adapt their predictions to local changes in the data distribution. These models only capture the local context, of up to a few thousands tokens. In this paper, we propose an extension of continuous cache models, which can scale to larger contexts. In particular, we use a large scale non-parametric memory component that stores all the hidden activations seen in the past. We leverage recent advances in approximate nearest neighbor search and quantization algorithms to store millions of representations while searching them efficiently. We conduct extensive experiments showing that our approach significantly improves the perplexity of pre-trained language models on new distributions, and can scale efficiently to much larger contexts than previously proposed local cache models.
Motivation & Objective
- Address the challenge of adapting pre-trained language models to rapidly changing or out-of-domain data distributions without retraining.
- Overcome the limitations of local cache models that are restricted to small context windows (a few thousand tokens).
- Enable efficient, scalable adaptation using a non-parametric memory system that stores and retrieves millions of past hidden activations.
- Maintain model consistency with the original pre-trained distribution while improving performance on new or rare distributions.
Proposed method
- Store all past hidden activations from the language model in a non-parametric memory component for dynamic retrieval.
- Use approximate nearest neighbor (ANN) search with quantization (IFVPQ) to efficiently retrieve relevant representations from a large-scale memory.
- Combine the retrieved representations with the parametric model’s predictions to generate a dynamic, context-aware probability distribution.
- Integrate the cache mechanism into a recurrent neural network language model without retraining, enabling real-time adaptation.
- Leverage the similarity between query representations and stored activations to retrieve semantically relevant past sequences for improved next-token prediction.
- Scale the system to handle millions of stored representations while maintaining low inference latency through optimized ANN indexing and quantization.
Experimental results
Research questions
- RQ1Can a non-parametric memory of past hidden states significantly improve the performance of a pre-trained language model on out-of-domain or rapidly changing data distributions?
- RQ2How does the performance of an unbounded cache model compare to local cache models and static models in terms of perplexity across diverse data domains?
- RQ3What is the impact of increasing the number of nearest neighbors and the size of the cache on model performance and inference efficiency?
- RQ4Can approximate nearest neighbor search with quantization enable scalable, real-time retrieval from a large-scale memory without sacrificing accuracy?
Key findings
- The unbounded cache model reduces perplexity by 69.7% on average when adapting from the News domain to the Books domain, a highly dissimilar distribution.
- On far-domain adaptation tasks (e.g., News to Wiki), the unbounded cache achieves a 79.7% relative improvement over the static model and 51.6% over the unigram baseline.
- In near-domain adaptation (e.g., News 2007 to 2008–2011), the unbounded cache improves perplexity by 20.44% relative to the static model, while unigram and local cache offer minimal gains.
- The model achieves a 24.6% perplexity reduction on in-domain test data (News 2007) compared to the static model, demonstrating its ability to enhance discrimination through non-linear retrieval.
- Performance improves with the number of nearest neighbors, with 1,000 neighbors offering a favorable trade-off between speed and accuracy due to linear complexity.
- As the test set grows, the cache continues to improve performance due to the accumulation of high-quality representations for rare words.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.