TL;DR
Binary Token Representations (BTR) significantly optimizes Retrieval-Augmented Generation (RAG) by compressing passage representations into 1-bit vectors. This approach achieves up to a 4x inference speedup and a 100x reduction in storage—shrinking Wikipedia's footprint from terabytes to just 127GB—while retaining over 95% of the original model's accuracy.
The Scalability Wall in Retrieval-Augmented LMs
Retrieval-Augmented Language Models (RaLMs) are the gold standard for reducing hallucinations and keeping Large Language Models (LLMs) up-to-date. However, they face a massive scalability wall. In a typical "retrieve-and-read" pipeline, the reader model must compute complex cross-attention between the user's query and dozens of retrieved passages.
This process is slow and computationally expensive. While some existing solutions attempt to precompute passage representations to save time, they end up requiring terabytes of storage for a standard corpus like Wikipedia. The core challenge this paper addresses is: How can we precompute these representations to make inference fast without needing a data center's worth of hard drives?
Methods: Moving to 1-Bit Vectors
The authors introduce BTR, which moves away from standard 32-bit floating-point representations to highly efficient 1-bit binary vectors.
- Calibrated Binarization: Instead of applying a naive sign function at the end of the model, BTR inserts binarization inside the Transformer encoder block (after LayerNorm but before Attention). By saving the variance of the original representations, the model can "re-scale" the binary vectors during inference to match the expected input range of upper layers.
- Offline & Runtime Compression:
- Offline: BTR merges similar binary vectors for common tokens (like stopwords) across the entire corpus to save disk space.
- Runtime: During inference, the system merges redundant representations across different retrieved passages, further reducing the number of tokens the decoder has to process.
- Novel Training Objectives: To fix the accuracy drop inherent in extreme binarization, the authors employ two specific techniques:
- Query-aware Distillation: The model is trained to specifically preserve tokens that are semantically relevant to the query.
- Representation Recovery: A loss function that encourages binary vectors to retain the semantic "meaning" of their original floating-point counterparts.
Key Insights
- Binarization is for Activations, not just Weights: While most "binary" neural network research focuses on model weights, BTR proves that binarizing token representations (activations) is a viable path for extreme RAG efficiency.
- Redundancy is an Opportunity: Retrieved passages often contain overlapping information. BTR exploits this "context redundancy" through its merging algorithms, proving that you don't need to process every single token to get the right answer.
- Calibration is the Secret Sauce: Modern LLMs use "Pre-LayerNorm" architectures where values can range dramatically (e.g., from -500 to +300). Naive binarization destroys this scale; BTR’s calibration technique is what allows 1-bit vectors to actually work in a deep Transformer.
Key Results
BTR was evaluated across five knowledge-intensive NLP tasks, including Open-Domain QA (NaturalQuestions, TriviaQA, WebQuestions), Fact Checking (FEVER), and Reasoning (MMLU). The corpus used was a Wikipedia dump containing roughly 3.2 billion tokens.
Tested against state-of-the-art models like Atlas and LLaMA2-7B, BTR demonstrated remarkable efficiency gains:
- Efficiency: BTR-Atlas achieved a 3.1x to 4.1x speedup in queries per second (QPS) compared to the base Atlas model.
- Storage: It reduced the storage requirement for Wikipedia representations from over 12 TB (for continuous vectors) to just 127 GB.
- Performance: Despite the extreme compression, BTR maintained 90–95% of the original task performance across all benchmarks.
Limitations and Future Work
While highly effective for encoder-decoder architectures (like T5/Atlas), extending BTR to decoder-only models (like GPT-4 or LLaMA) is non-trivial. Decoder-only models compute query and passage representations sequentially, making it harder to cache passage-only states. Additionally, the speedup is less significant for extremely long input queries, as the query encoding (which isn't precomputed) starts to dominate the computation time.
Looking ahead, the authors suggest that applying similar binary techniques to the retriever component itself—not just the reader—is a promising next step for maximizing end-to-end efficiency.
Summary updated