Reformer's LSH Attention: Hashing for Efficient Long Contexts
The Reformer model introduced Locality-Sensitive Hashing (LSH) attention, a unique sparse attention mechanism that grouped similar query and key vectors into buckets. This innovation reduced the computational complexity of attention from O(N²) to O(N log N) and significantly conserved memory, making it efficient for longer sequences.
The top 3
- Reformer's O(L log L) Breakthrough: Halving Attention Complexity: Introduced by Google Research in 2020, LSH Attention in the Reformer model dramatically reduced the computational complexity of self-attention from quadratic O(L²) to a more efficient quasi-linear O(L log L) for long sequences.
- Hashing for Relevance: LSH Attention's Core Mechanism: LSH Attention employs a randomized hashing scheme that groups similar query and key vectors into shared 'hash buckets' with high probability. This allows the model to compute attention only among vectors within the same bucket, drastically reducing the number of comparisons and approximating full attention for efficiency.
- LSH Attention's Precision Trade-off: Hashing Collisions: While efficient, LSH attention is an approximation that risks hashing collisions, where irrelevant tokens are grouped or relevant ones are missed, potentially impacting attention accuracy.
Sources
Open the full topic