Skip to content

Commit fc10f96

Browse files
authored
One-bit wonder blog (#11)
* One-bit wonder blog draft * Tweaks * Update date * Add diagram * Minor tweaks * Tweak author styling
1 parent a3b1a57 commit fc10f96

8 files changed

Lines changed: 179 additions & 0 deletions

File tree

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
title: "1-bit Wonderful Weights for LLMs"
3+
date: 2026-03-11
4+
categories: [Articles]
5+
authors: [douglaso]
6+
tags: [number-formats, quantisation, LLMs]
7+
slug: 1-bit-wonder
8+
---
9+
10+
Would you rather use 1 million $\times$ 16-bit weights, 4 million $\times$ 4-bit weights, or even 16 million $\times$ 1-bit weights?
11+
12+
In joint work between Aleph Alpha Research and Graphcore, we asked this question of LLMs — the answer encouraged us to embrace the wonder ✨ of 1-bit weights, which can outperform 4-bit and 16-bit weights on a fixed weight memory budget.
13+
14+
![1-bit weights rule!](img/1bitwonderful.jpg)
15+
16+
<!-- more -->
17+
18+
Starting from a custom quantisation-aware training recipe, the work proceeds in three parts. First, a scaling laws evaluation prompts us to consider very low-bit formats. Second, scaled-up tests show the power of memory-matched models with 1-bit weights. Finally, kernel benchmarking demonstrates their feasibility for autoregressive inference.
19+
20+
With our [paper](https://arxiv.org/abs/2602.15563){:target="_blank"}, we also release the [code](https://github.com/Aleph-Alpha-Research/1-Bit-Wonder){:target="_blank"}, quantised weights and fused dequantisation kernels. Here's our favourite 1-bit model in action, doing some maths:
21+
22+
<video controls autoplay muted loop preload="metadata" style="border-bottom: 8px solid #161616;">
23+
<source src="/2026/03-1bitwonder/img/demo.mp4" type="video/mp4">
24+
</video>
25+
26+
## Putting the squeeze on
27+
28+
Let's start with our recipe for low-bit quantisation. We adopt modern block-scaled formats, which use shared scales across blocks of weights in order to capture their full range.
29+
30+
**Dequantisation**
31+
32+
We can think of the format in terms of what is stored and how the data is reconstructed. For a nonlinear block-scaled format, we store a table of <span style="color: #647687; font-weight: bold;">centroids</span> for each weight tensor, a <span style="color: #0050EF; font-weight: bold;">scale</span> for each block of weights and small integers as <span style="color: #008A00; font-weight: bold;">quantised indices</span> for each weight. To reconstruct a given weight, we first lookup the centroid from the stored index, then multiply by the shared block scale.
33+
34+
![A diagram of the mapping from quantised blocks of data to dequantised elements](img/dequant.png){:.img-large}
35+
36+
_Quantisation and reconstruction of a 2-bit format with illustrative block size B = 4. Note: our practical formats use B = 64 and store the scale in `bf16` for an overhead of 0.25 bits per element._
37+
38+
**Quantisation**
39+
40+
To quantise the flattened weight tensor $w$:
41+
42+
1. Split $w$ into blocks of $B=64$ elements.
43+
2. For each block, calculate the absolute maximum value (if targeting $n>2$ bits) or absolute mean value (if targeting $n\leq 2$ bits), as the <span style="color: #0050EF; font-weight: bold;">scale</span>. _Note: switching to absmean for low-bit formats is helpful since absmax quantisation would flush most values to zero in this regime._
44+
3. Divide the block elements by the scale and round these to the nearest of the $2^n$ <span style="color: #647687; font-weight: bold;">centroids</span>.
45+
4. Store the centroid <span style="color: #008A00; font-weight: bold;">index</span> ($n$ bits per value) and <span style="color: #0050EF; font-weight: bold;">scale</span> (`bf16`).
46+
47+
![A diagram of the mapping from original data to quantised blocks](img/quant.png){:.img-large}
48+
49+
**QAT**
50+
51+
To train a quantised model from scratch, we use quantisation-aware training (QAT) with the straight-through estimator, which performs an artificial version of the quantisation-dequantisation procedures shown above in the forward pass, but propagates the gradient unchanged to the underlying unquantised weight in the backward pass.
52+
53+
!!! note "Artificial quantisation and the straight-through estimator"
54+
Artificial quantisation takes a `bf16` input and produces a `bf16` output, quantising the values but not casting them to the compact format, so that the following kernel can use regular `bf16` operations. The straight-through estimator acts as if this is the identity operation, allowing the deep learning training procedure to search for good quantised weights.
55+
56+
**Training Schedule**{#training-schedule}
57+
58+
We perform 1000 steps of regular (non-QAT) training, before quantising the model. At this point, we evaluate two alternatives:
59+
60+
1. Create a uniform (integer) quantisation grid of centroids $\{-(2^{n-1}-1), \ldots, 0, \ldots, (2^{n-1}-1)\}$.
61+
2. Train a nonlinear quantisation grid of $2^n$ centroids by running scalar K-means on the flattened weight tensor.
62+
63+
We then continue training with QAT enabled for the remainder of the training run. Consistent with standard practice, we maintain embedding and final projection weights in high-precision (`bf16`).
64+
65+
---
66+
67+
## Results
68+
69+
Our goal in this work is to identify the best use of a fixed parameter memory budget with quantisation. We also wish to test the efficacy of nonlinear quantisation using K-means versus uniform integer quantisation.
70+
71+
!!! question "Research Question"
72+
What is the best use of a fixed parameter memory budget: a high-precision model with fewer parameters, or a highly quantised model with more parameters?
73+
74+
### Part 1: Go small or go home
75+
76+
We conduct a scaling law analysis, based on a broad sweep of model size, training budget and weight precision. We test both symmetric integer quantisation and K-means nonlinear quantisation, as [described above](#training-schedule).
77+
78+
_Expand the section below for details, or continue reading for the main conclusions._
79+
80+
<details markdown>
81+
82+
<summary>Scaling Law Analysis</summary>
83+
84+
We sweep model sizes $N$, training token budgets $D$ and average weight precisions $P_w$ (for both uniform and K-means variants). We use these results to fit scaling laws that model the loss as:
85+
86+
$$
87+
\mathcal{L}(N,D,P_w)
88+
\;=\;
89+
A\,N_{\mathrm{eff}}(N,P_w)^{-\alpha}
90+
\;+\;
91+
B\,D^{-\beta}
92+
\;+\;
93+
E,
94+
$$
95+
96+
where $A,B,E,\alpha,\beta>0$ are fitted constants. The effective parameter count $N_{\mathrm{eff}}$ is defined in terms of the average precision $P_w$:
97+
98+
$$
99+
N_{\mathrm{eff}}(N, P_w)
100+
\;=\;
101+
N \left(1-\exp\!\left(-\frac{P_w}{\gamma_w}\right)\right),
102+
$$
103+
104+
with fitted slope $\gamma_w$. We obtain:
105+
106+
| Centroids | $\alpha$ | $\beta$ | $\gamma_w$ |
107+
| --- | --- | --- | --- |
108+
| Uniform | 0.55 | 0.46 | 3.71 |
109+
| K-means | 0.63 | 0.40 | 3.32 |
110+
111+
Importantly, the larger value of $\alpha$ for K-means implies stronger scaling of loss with model size, and smaller $\gamma_w$ means faster saturation of capacity with increasing bit-width. Both of these show K-means to be stronger than uniform quantisation.
112+
113+
We also see this in an isoloss contour plot of our scaling law (each line corresponds to a fixed loss, showing a set of configurations with the same task performance):
114+
115+
![isoloss contours for $P_w$ and $N$, showing K-means lines to the left of uniform lines](img/isoloss_n.png){:.img-large}
116+
117+
_Isoloss contours from our scaling laws, where the background colour shows the predicted gap between loss using K-means centroids and that using uniform centroids (red means lower loss for K-means)._
118+
119+
</details>
120+
121+
Our scaling law fit for K-means and integers highlights the advantage of K-means quantisation:
122+
123+
!!! tip "Key takeaway 1"
124+
K-means quantisation achieves uniformly lower loss than uniform integer quantisation across all precision–budget tradeoffs, with the largest improvements in the ultra-low-bit regime.
125+
126+
Given the scaling law, we can now ask our main question "given a memory budget $M$, what precision minimises loss". This yields the exciting conclusion that budgets $\geq 8$ GB would perform better with ultra-low-precision 1-bit weights:
127+
128+
![figure showing effective parameters $N_{\mathrm{eff}}$ against precision $P_w$, with families of lines for different memory budgets and peaks shifting left towards 1-bit weights as memory budget increases](img/memory_budget.png){:.img-large}
129+
130+
_The optimal precision shifts left as memory budget increases. This is because the embedding and final projection, which are maintained in `bf16`, dominate the memory consumption for small memory budgets, so there is less saving to be had in quantising the remainder of the model._
131+
132+
We therefore conclude that:
133+
134+
!!! tip "Key takeaway 2"
135+
Under fixed memory, the best regime is the lowest stable precision, balanced by scaling up parameters.
136+
137+
### Part 2: Economies of scale
138+
139+
In order to gain confidence in this prediction, we conduct a scaled-up test. We compare a 16-bit `bf16` baseline against 4-bit and 1-bit models using K-means quantisation, setting the number of parameters to 4B, 12B and 31B respectively such that all models consume approximately 7.8 GB of weight storage.
140+
141+
After training on 150B tokens and evaluating on a suite of downstream tasks, we observe strong performance for the 4-bit and especially for the 1-bit model:
142+
143+
![table of downstream results, showing a 31B 1-bit model outperforming a 12B 4-bit model and 4B 16-bit model](img/table_main.png){:.img-medium}
144+
145+
_Our scaled-up test highlights the strength of memory-matched (7.8 GB) 1-bit and 4-bit models when compared against a 16-bit baseline. Both outperform the 16-bit model on "log-probability" (top) and "generative" (bottom) downstream tasks, with the 1-bit model performing best across most tasks._
146+
147+
### Part 3: Keeping the pipe full
148+
149+
Our research question assumes a fixed weight memory budget. However, inference speed is also an important practical consideration. If compute is maintained in `bf16`, the relative speed of a fused kernel consuming reduced-precision weights depends on whether the kernel is **compute-bound** or **memory-bound**. In the compute-bound setting (large batch size), the reduced-precision kernel cannot outperform a `bf16` baseline, since they involve approximately the same amount of compute work. In the memory-bound setting (small batch size), the reduced memory bandwidth requirement can yield a speedup.
150+
151+
<details markdown>
152+
<summary>Benchmarking Analysis</summary>
153+
154+
We developed fused dequantise-multiply kernels for the nonlinear block-scaled formats described above, and tested them on an inference GPU. In microbenchmarks, we observe at batch size 1:
155+
156+
| $P_w$ | Time (Speedup) | Effective BW |
157+
| --- | --- | --- |
158+
| $16$ | $175.6$ μs ($1.0\times$) | $764$ GB/s |
159+
| $4$ | $49.5$ μs ($3.7\times$) | $721$ GB/s |
160+
| $1$ | $24.0$ μs ($7.6\times$) | $438$ GB/s |
161+
162+
This shows near-ideal speedups for the 4-bit format (see memory bandwidth), but some overhead for the 1-bit format.
163+
164+
In whole-model token generation benchmarks, also at batch size 1, the 4B 16-bit model achieves 89 tokens/s, the 12B 4-bit model achieves 79 tokens/s and the 31B 1-bit model achieves 61 tokens/s. These figures show that the fixed memory budget does not perfectly transfer into a fixed inference time, even at batch size 1. Nevertheless careful kernel choice and optimisation can deliver a significant fraction of the available speedup. We recommend balancing hardware-specific and practical considerations against the fundamental advantage of very low-bit formats.
165+
166+
</details>
167+
168+
!!! tip "Key takeaway 3"
169+
Weight compression can yield significant inference speedups at small batch size, but good practical formats must balance available hardware capabilities against fundamental advantages of very low-bit formats.
170+
171+
## Conclusion
172+
173+
We were pleased (and somewhat surprised) that the simple recipe we have described was able to effectively train 1-bit weights. With this recipe, we saw the advantage of reducing weight precision in order to increase parameter count on a fixed memory budget. Based on this and our scaling laws, we encourage you to consider QAT, block-scaled formats and, especially, very low-precision weights in your next inference optimisation project!
174+
175+
Thanks for sharing our wonder! Find out more in our full paper: **[1-Bit Wonder: Improving QAT Performance in the Low-Bit Regime through K-Means Quantization](https://arxiv.org/abs/2602.15563)**.
176+
177+
<div style="font-weight: 500; margin-top: 2em; margin-bottom: 6em;">
178+
By Sohir Maskey, Constantin Eichenberg, Johannes Messner and Douglas Orr.
179+
</div>
186 KB
Loading
924 KB
Binary file not shown.
152 KB
Loading
359 KB
Loading
338 KB
Loading
134 KB
Loading
240 KB
Loading

0 commit comments

Comments
 (0)