CoSA: Accelerating Long-Context Inference via Proxy-Kernel Co-Designed Sparse Attention
CoSA is a training-free, two-stage sparse attention framework that couples a Kernel-Aware Proxy with an Ordered-Skipping Kernel to dynamically optimize block selection and skipping, achieving significant inference speedups and reduced latency for long-context LLMs while maintaining high accuracy under tight computational budgets.
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 you are trying to read a massive, 128,000-page encyclopedia to answer a single question. In the world of Artificial Intelligence, these "encyclopedias" are called Large Language Models (LLMs), and the "reading" process is how they understand context. The problem is that the standard way these models read is like a librarian who insists on reading every single page of the book, from the very first word to the very last, before they can even start thinking about your question. As the book gets longer, this "read-everything" approach becomes painfully slow and expensive, like trying to run a marathon while carrying a backpack full of bricks.
To fix this, scientists have tried to teach the librarian to be a bit more selective, a technique called "sparse attention." Instead of reading every page, the model tries to guess which pages are important and skips the rest. Usually, this involves two steps: first, a quick "proxy" (a fast guesser) looks at the book and marks the important pages with a simple "Yes" or "No" list. Second, a "kernel" (the actual worker) follows that list and does the heavy lifting. It's a decent system, but it has a flaw: when the book gets huge and you need to be very strict about which pages you skip to save time, the quick guesser starts making mistakes, and the worker just follows the bad list blindly. The result is that the model gets faster but starts forgetting important details, like a librarian who skips the climax of the story because they thought it was boring.
This is where a new method called CoSA (Co-Designed Sparse Attention) comes in. The researchers behind CoSA realized that the "guesser" and the "worker" were working in isolation, which caused the system to break down under pressure. They decided to redesign the whole process so the two work together as a team. Instead of just handing the worker a simple "Yes/No" list, the new "guesser" (called a Kernel-Aware Proxy, or KAP) hands over a priority list. It doesn't just say "read this page"; it says, "Read this page first, then this one, then this one."
Here is the magic trick: The worker (called an Ordered-Skipping Kernel, or OSK) uses this priority list to rearrange the order in which it reads the pages. By reading the most critical pages first, the worker builds up a "running score" of what's important very early on. Because it knows the most important stuff right away, it can confidently skip even more pages later in the process without getting confused. It's like if you were reading a mystery novel and the detective told you, "Read the first three chapters to find the killer, then you can safely skip the next fifty chapters of gardening tips."
The paper shows that this teamwork approach is a game-changer. When tested on models reading contexts as long as 128,000 tokens (roughly the size of a long novel), CoSA managed to speed up the "attention" part of the process by 4.93 times and cut the time it takes to generate the first word by 2.53 times. Crucially, it did this without the model losing its ability to understand the story or solve complex reasoning problems. The researchers found that by letting the proxy and the kernel talk to each other and share a specific order of operations, they could be much more aggressive about skipping work while still keeping the model smart. It turns out that in the world of AI, knowing when to read a page is just as important as knowing which page to read.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.