← Latest papers
🤖 machine learning

Theory-optimal Quantization Based on Flatness

This paper introduces Bidirectional Diagonal Quantization (BDQ), a novel post-training quantization framework that derives a theory-optimal solution based on a new "Flatness" metric to effectively disperse activation outliers, thereby achieving state-of-the-art accuracy in low-bit Large Language Model quantization.

Original authors: Xiusheng Huang, Zhe Li, Xuanwu Yin, Lu Wang, Yequan Wang, Dong Li, Emad Barsoum, Kang Liu

Published 2026-05-20
📖 5 min read🧠 Deep dive

Original authors: Xiusheng Huang, Zhe Li, Xuanwu Yin, Lu Wang, Yequan Wang, Dong Li, Emad Barsoum, Kang Liu

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

The Big Problem: The "Loud Neighbor" in a Quiet Room

Imagine you have a massive, incredibly detailed library of books (a Large Language Model, or LLM). To fit this library into a small backpack (your phone or a cheap server), you need to shrink the books down. This process is called quantization.

Usually, the books are written in high-definition ink (32-bit or 16-bit precision). To save space, you want to rewrite them using only a few simple colors (4-bit or even 2-bit).

The Issue: Most of the text in these books is normal, but every now and then, there is a sentence written in giant, neon-red letters that screams louder than everything else. In the paper, these are called outliers.

When you try to shrink the whole book to fit into a small space, the "giant neon letters" force the entire system to stretch out to accommodate them. This squishes all the normal text into a tiny, unreadable corner. The result? The book becomes garbled nonsense.

The Old Solutions: Trying to Rotate the Room

Previous methods tried to fix this by rotating the room or rearranging the furniture. They would spin the data around (using linear transformations) hoping the giant neon letters would blend in with the normal text.

The authors of this paper looked at these methods and said, "It's not working well enough." Even after spinning the room, the neon letters are still there, just in a different spot. They are still hogging all the space, leaving the rest of the data cramped.

The New Idea: "Flatness" and the Equalizer

The authors came up with a new way to think about the problem. Instead of just trying to hide the neon letters, they wanted to flatten the landscape.

Imagine the data as a hilly terrain. Most of the land is flat, but there are a few massive mountains (the outliers).

  • The Goal: You want the terrain to be as flat as possible (like a calm lake). This is what they call Flatness.
  • The Metric: They invented a math tool to measure how "bumpy" the data is. If the mountains are too high, the "Flatness" score is bad. If the land is smooth, the score is good.

They proved mathematically that the best way to flatten this terrain isn't by spinning it, but by using a two-sided stretching tool.

The Solution: BDQ (Bidirectional Diagonal Quantization)

The authors propose a new method called BDQ. Here is how it works, using a metaphor:

Imagine the data is a giant grid of people standing in rows and columns.

  1. The Problem: A few people in specific rows and columns are giants (outliers).
  2. The Old Way: You try to rotate the whole grid. The giants are still giants; they just face a different direction.
  3. The BDQ Way: You give every single person in a specific row a pair of stretchy pants (a diagonal matrix) and every person in a specific column a pair of stretchy shoes (another diagonal matrix).
    • If a row has a giant, you shrink the pants for everyone in that row.
    • If a column has a giant, you shrink the shoes for everyone in that column.
    • The Result: The giants get shrunk down to a normal size, and the tiny people get stretched up. Suddenly, everyone is roughly the same height. The "terrain" is flat.

Because the giants are no longer dominating the space, you can now compress the whole grid into a tiny backpack without losing any important details.

The "Overfitting" Trap: The Student Who Crammed

There was one more problem. When teaching the computer how to use these stretchy pants and shoes, they only showed it a tiny sample of data (like 128 sentences).

The computer was like a student who memorized the answers to those 128 specific practice questions perfectly but failed the real exam because it didn't understand the general rules. In technical terms, this is called overfitting.

To fix this, the authors added a special rule called Recursive Cross-Entropy Loss.

  • Analogy: Instead of just telling the student "This is the right answer," they also say, "Look at what you predicted was right, and make sure your confidence matches the actual answer."
  • This forces the computer to learn the general pattern of how to flatten the data, rather than just memorizing the specific practice sentences.

The Results: Packing a Suitcase Perfectly

The paper tested this new method on some of the smartest AI models in the world (like LLaMA-3 and DeepSeek).

  • The Test: They tried to shrink the models down to extremely small sizes (using only 4 bits for weights and 4 bits for activations, or even 2 bits for weights).
  • The Outcome:
    • Previous methods made the AI "dumb" when shrunk this small (accuracy dropped significantly).
    • BDQ kept the AI almost as smart as the original full-size version.
    • In one extreme test (shrinking a 70-billion-parameter model to 2-bit weights), BDQ closed the performance gap by nearly 40% compared to the best existing methods.

Summary

The paper claims that by mathematically proving that "flatness" is the key to good compression, and by using a two-sided stretching tool (BDQ) combined with a smarter learning rule (RCE), they can shrink massive AI models down to tiny sizes without them losing their intelligence. They turned a bumpy, mountainous landscape into a smooth, flat plain that fits easily into a small backpack.

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 →