Training-Free Hashing-Based Attention via Binary Principal Components
Abstract
Lay Summary
Large language models are increasingly asked to work with very long inputs, such as long documents, code repositories, or extended conversations. However, as the input gets longer, the model must repeatedly look back at more and more stored information while generating each new word. This makes long-context models slow and expensive to use. We propose BinaryPC, a method that helps the model quickly decide which past information is most relevant, instead of checking everything. BinaryPC creates short binary “fingerprints” for the stored information by looking at the structure of the model’s own data. These fingerprints make it possible to efficiently group and retrieve similar pieces of information. Unlike some previous approaches, BinaryPC does not require additional training, model-specific tuning, or costly random projections. Across several long-context language models and benchmarks, BinaryPC keeps performance close to standard full attention while making generation much faster. On modern GPUs, it improves decoding throughput by up to 3.56× compared with FlashAttention. This makes long-context language models more practical for real-world applications that require fast and accurate processing of large amounts of text.