← Latest papers
🤖 machine learning

Positional LSH: Binary Block Matrix Approximation for Attention with Linear Biases

This paper establishes a formal connection between positional bias and locality-sensitive hashing by proving that the ALiBi attention mechanism can be approximated with high probability by randomized block-diagonal binary masks, thereby enabling efficient near-linear time computation for long-context attention while unifying positional biases, masks, and embeddings into a single theoretical framework.

Original authors: Daniel Wolfson, Tal Wagner

Published 2026-05-12
📖 4 min read☕ Coffee break read

Original authors: Daniel Wolfson, Tal Wagner

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a Transformer model (the brain behind modern AI) as a massive library where every book (token) needs to know its place on the shelf to understand the story. To help the books "talk" to each other, the library uses a system called Attention.

However, there's a problem: when the library gets huge (long contexts), it becomes incredibly slow and expensive for every book to read every other book. To fix this, researchers invented ALiBi (Attention with Linear Biases). Think of ALiBi as a rule that says, "Books that are sitting next to each other on the shelf should talk more loudly than books that are far apart." It's a clever way to make the AI focus on nearby words without needing complex position markers.

But here's the catch: ALiBi is still mathematically heavy. It requires calculating a giant, complex "bias map" for every single interaction, which slows things down.

The Big Idea: "Positional LSH"

The authors of this paper asked a simple question: Can we approximate this complex ALiBi rule using something much simpler, like a set of binary switches (on/off)?

They found a way to do this using a concept called Locality-Sensitive Hashing (LSH).

The Analogy: The "Grouping Game"

Imagine you have a long line of people (the tokens) waiting in a hallway.

  1. The Old Way (ALiBi): You calculate the exact distance between every single pair of people to decide how much they should talk. This is precise but takes forever.
  2. The New Way (Positional LSH): Instead of measuring exact distances, you play a game. You toss a giant, random "net" over the hallway.
    • The net has holes of random sizes.
    • Anyone caught in the same hole gets a "1" (they are grouped together).
    • Anyone in different holes gets a "0" (they are ignored for this round).
    • Because the net is random, sometimes people who are close together get grouped, and sometimes they don't.

The Magic: If you repeat this "net-tossing" game many times and average the results, the pattern of who got grouped with whom perfectly mimics the complex ALiBi rule.

What the Paper Actually Proves

The authors didn't just guess this would work; they proved it mathematically:

  1. The Structural Connection: They showed that the complex ALiBi bias matrix is actually just the "average" of many simple, blocky, binary masks. Think of it like a high-resolution photo (ALiBi) that can be perfectly reconstructed by stacking many low-resolution, black-and-white pixelated layers (the binary masks).
  2. The Speed Boost: Because these binary masks are just blocks of "on" and "off," the computer doesn't need to do heavy math. It can break the giant library into small, manageable rooms (blocks) and process them separately. This turns a slow, heavy calculation into a fast, near-linear one.
  3. Accuracy: They proved that even though each individual "net toss" is a rough approximation, the average of many tosses is incredibly accurate. The more times you toss the net (sample more), the closer you get to the exact ALiBi result.

The Experiments

To test this, the researchers tried it on real, large AI models (like Llama and Mistral).

  • The Result: As they increased the number of "net tosses" (samples), the approximation became almost identical to the original, exact ALiBi method.
  • Performance: In their tests, using this method with a small number of samples actually improved the model's ability to handle long texts compared to the original model without any bias, and it performed very similarly to the exact ALiBi method.

The Limitations (What the Paper Doesn't Say)

The authors are very honest about what this doesn't do yet:

  • No Instant Speedup on Current Hardware: While the math says this should be faster (near-linear time), their current software prototype didn't beat the super-optimized, existing ALiBi code on today's GPUs. This is because current computer chips are built to handle huge, dense calculations very efficiently. Breaking the job into many small pieces (which this method does) isn't always faster on current hardware, even if the math says it uses fewer total operations.
  • It's a Theory First: The paper is a theoretical breakthrough that opens a door. It proves the door exists and shows how to build the key, but they haven't yet built the fastest possible car to drive through it.

Summary

In short, the paper reveals that the complex "distance rules" used by AI (ALiBi) can be replaced by a simple, random "grouping game." By playing this game a few times and averaging the results, you get the same smart behavior as the complex method, but with a structure that could be much faster in the future. It connects three different ways of handling position (biases, masks, and embeddings) into one unified, elegant framework.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →