Output-Aware Rotation for INT2 KV-Cache Quantization
This paper proposes OptR, an output-aware rotation method that minimizes post-projection attention-output errors through per-head orthogonal corrections and key reparameterization, thereby significantly improving the performance of INT2 KV-cache quantization for large language models while maintaining negligible inference overhead.
Original paper dedicated to the public domain under CC0 1.0 (http://creativecommons.org/publicdomain/zero/1.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 remember a massive story to tell a friend. You have a notebook where you write down every important detail you've heard so far. The bigger the story, the more pages you need. Now, imagine your notebook is running out of space, and you can't afford to buy a bigger one. To solve this, you decide to shrink your handwriting. Instead of writing full, clear letters, you scribble them down using only four tiny symbols: a dot, a dash, a circle, and a cross. This is like compressing a huge amount of information into a very small space.
In the world of artificial intelligence, specifically Large Language Models (LLMs), these notebooks are called "KV caches" (Key-Value caches). They store the context of a conversation so the AI can remember what was said earlier. As conversations get longer, these caches get huge, eating up memory and slowing things down. To fix this, scientists try to shrink the data to just 2 bits (using only four levels, like our four symbols). But here's the catch: when you squish data that tightly, the "outliers"—the really important, unusual details—get squashed into the wrong shape, and the AI starts making mistakes. It's like trying to fit a giant, lumpy potato into a tiny box; the potato gets bruised, and when you take it out, it doesn't look like the potato you put in.
For a while, researchers tried to fix this by rotating the potato before squishing it, hoping to spread the lumps out evenly. But they were measuring the success by how well the potato looked inside the box, not by how well the AI could use it to tell the story later. This paper introduces a new method called OptR (Output-Aware Rotation) that changes the game. Instead of just trying to make the squished data look nice, OptR checks if the AI can still understand the story after the data has been squished and un-squished. It turns out that by paying attention to the final result, the AI can remember much more accurately, even with that tiny, four-symbol notebook.
The Problem: The "Squished Potato" Effect
When an AI reads a long text, it builds a mental map of the words it has seen. This map is stored in the KV cache. To save space, researchers use a technique called quantization to shrink this map. The most extreme version is INT2 quantization, which reduces the data to just four possible values. It's incredibly efficient—using only 1/8th of the memory of standard formats—but it's risky.
Think of the data in the cache as a group of students standing in a line. Most students are average height, but a few are giants. If you try to fit them all into a small room (the INT2 range), the giants get crushed, and the average students get squished too because the room is too small for the giants. This causes "quantization error," where the AI misremembers the giants and the average students alike.
To fix this, previous methods used rotation. Imagine spinning the line of students so the giants are no longer standing straight up but are leaning sideways. This spreads their height out across the room, making it easier to fit everyone without crushing them. However, the paper argues that existing methods were making a mistake. They were spinning the students just to make them fit nicely in the room (minimizing the error of the stored data), but they weren't checking if the students could still run a race correctly once they left the room.
The authors point out a mismatch: the rotation that makes the data look best inside the box isn't necessarily the rotation that helps the AI perform best after it uses that data. The AI doesn't care if the data looks perfect in the cache; it cares if the final answer is correct.
The Solution: OptR (Output-Aware Rotation)
The paper proposes OptR, a method that optimizes the rotation based on the final output of the AI, not just the storage.
Here is how OptR works, step-by-step:
Centering the Data (The "Leveling" Trick): Before squishing the data, OptR subtracts the average value from the keys (the "Key Reparameterization"). Imagine if the giants in our line were actually just standing on a high platform. OptR lowers the platform so everyone is standing on the same ground level. This doesn't change who is tall or short relative to each other, but it stops the giants from hitting the ceiling of the small room. Crucially, this step is "attention-equivalent," meaning it changes the numbers but keeps the AI's attention focus exactly the same. It narrows the range of numbers, making the INT2 squishing much less painful.
Learning the Perfect Spin (The "Output-Aware" Step): Instead of using a fixed spin (like a standard mathematical rotation), OptR learns a custom spin for every single "head" (a specific part of the AI's brain) in the model. It does this by simulating the whole process: squishing the data, un-squishing it, running it through the AI's attention mechanism, and then projecting it to the final answer.
- It looks at the error in the final answer (the "post-WO attention-output error").
- It breaks this error down into two parts: errors caused by the keys (which determine what the AI pays attention to) and errors caused by the values (which determine what information is actually retrieved).
- It then tweaks the rotation angles slightly to minimize the error in the final answer, not just the error in the storage.
Think of it like tuning a radio. Old methods tried to make the static sound as quiet as possible inside the speaker box. OptR listens to the music coming out of the speaker and adjusts the knobs until the song sounds perfect, even if the static inside the box isn't perfectly silent.
What They Found
The researchers tested OptR on three different AI models (Qwen3-4B, Qwen3-8B, and Phi4-14B) and five different challenging benchmarks, including math problems (AIME25), coding tasks (LiveCodeBench), and long-context retrieval (finding a needle in a haystack of 64,000 words).
The results were striking:
- Massive Accuracy Gains: On the Qwen3-8B model, using standard INT2 quantization with the previous best method (QuaRot) resulted in an accuracy of only 17.33% on a difficult math test. When they added OptR, the accuracy skyrocketed to 66.67%. That's nearly a four-fold improvement.
- Beating the Baseline: Even compared to the state-of-the-art method (OSCAR), which was already quite good, OptR pushed the accuracy from 54.67% to 66.00%.
- Long-Context Superpower: The most impressive finding was in long-context tasks. As the story got longer (up to 64,000 tokens), standard INT2 methods failed miserably, dropping to near-zero accuracy. OptR kept the retrieval accuracy high, dropping only slightly from 99.83% (at 4k tokens) to 70.02% (at 64k tokens), whereas the standard method crashed to 0.04%.
- No Speed Penalty: The authors confirmed that this magic doesn't come with a heavy cost. They integrated OptR into the system and found that it added negligible overhead. The speed of the AI (latency) and the amount of data it could process (throughput) remained almost identical to the standard methods. It's like getting a supercharged engine without adding any extra weight to the car.
Why This Matters
The paper suggests that for ultra-low-bit quantization (like INT2) to work, we can't just look at the data in isolation. We have to look at how that data flows through the entire system to the final answer. By optimizing for the output rather than the storage, OptR bridges the gap between extreme compression and high performance.
The authors emphasize that this isn't just a theoretical win; it's a practical one. It allows AI models to handle much longer conversations and larger batches of users without running out of memory, all while keeping the model smart enough to solve hard math problems and write code. They didn't just suggest this might work; they measured it across multiple models and found consistent, significant improvements, proving that "output-aware" optimization is the key to unlocking the full potential of 2-bit AI.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.