↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recording…

What BitNet b1.58 is

The other quantization tabs take a model trained in 16 bits and round it afterwards. BitNet b1.58 is trained with low-precision weights from the start: every weight of every linear layer is , or , times one scale per matrix, and every linear layer's input is rounded to 8 bits per token. Three values carry bits of information, which gives the name. Because the weights are ternary, a matrix product needs no multiplications: each output adds some inputs, subtracts others and skips the rest.

This page records Microsoft's BitNet b1.58 2B4T, a 2-billion-parameter model trained on 4 trillion tokens (30 layers, a hidden size of 2,560 and squared-ReLU MLPs), with transformers' built-in BitNet code in float32 on this Mac's CPU. It features layer 15's down_proj (2,560 × 6,912) and compares it with Microsoft's bf16 master copy of the same weights.

Ternary weights

BitNet b1.58 quantizes a weight matrix with its absmean: the scale is the mean absolute value of the full-precision weights, and each weight is divided by it, rounded and clipped:

A weight becomes 0 when . In the featured matrix , stored in bf16 as weight_scale, and 39.8 % of the weights are 0, 30.1 % are and 30.1 % are . The Ternary weights panel switches between the released ternary weights and the bf16 master copy. Applying the rule to the master copy gives the stored weight for 97.50 % of the matrix; the other 442,463 all have , where , within one bf16 step of the rounding point , so the bf16 copy cannot tell which side the training weights were on.

The file packs four ternary weights into a byte, each stored as weight + 1 in 2 bits; the Bits per weight panel sets those 2 bits against 16 for bf16 and the 1.58 bits of information.

A matrix product without multiplications

The layer's input is quantized per token with its absmax to integers . One output of the layer is then

an integer sum and difference, then one multiplication by the two scales. The A matrix product without multiplications panel computes output 1024 for the last prompt token: ; 2,104 inputs have weight and sum to 556, 2,053 have weight and sum to , and 2,755 are skipped. The result, 1,247, matches the model's own down_proj output to 0.00049. bitnet.cpp's kernels exploit this structure; PyTorch here multiplies by the ternary values as ordinary floats.

The Share of zero weights strip shows that across all 210 ternary matrices between 36 % and 60 % of the weights are zero, inputs that every product skips outright.

Training with ternary weights

Rounding has zero gradient almost everywhere, so BitNet keeps a full-precision copy of every weight during training. The forward pass uses the ternary weights and 8-bit activations; the backward pass treats the rounding as the identity, the straight-through estimator, and the optimiser updates the full-precision copy:

After training only and are kept. The bf16 master copy on this page is that copy, released separately and rounded to bf16, which is why it cannot settle the weights that lie at ; the ternary file is what is meant to run.

What the model says

"8-bit inputs" in the What the model says panel is the model as trained, with ternary weights and every linear layer's input rounded to 8 bits; "unrounded inputs" keeps the same weights and skips only that rounding. Both answer "The capital of Australia is Canberra."; with unrounded inputs the model goes on to a second sentence. Their next-token distributions differ by a KL divergence of nats, and their WikiText-2 perplexities are 21.54 and 21.57. These use the model's Llama 3 tokenizer, so they do not compare with the Qwen tabs' perplexities.

The file is 1,179 MB: 657 MB is the bf16 embedding, shared with the output layer, and 521 MB holds the 2.08 billion ternary weights packed at 2 bits each. At this size the embedding, not the transformer, takes most of the memory.

Where it came from

Bengio et al. (2013) studied the straight-through estimator for training through hard thresholds, and ternary weight networks (2016) trained image classifiers with weights in and a scale. BitNet (2023) introduced BitLinear, a drop-in replacement for the linear layer, and trained transformer language models from scratch with binary weights. BitNet b1.58 (2024) added the zero and the absmean scale, and its paper reports matching a full-precision transformer of the same size and training tokens in perplexity and end-task performance. The 2B4T report (2025) released the model on this page, and bitnet.cpp (2024) the CPU kernels that compute its products with additions.

Papers

  1. The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits Shuming Ma, Hongyu Wang, Lingxiao Ma, Lei Wang et al. · arXiv 2024 BitNet b1.58: ternary weights with an absmean scale and 8-bit activations, trained from scratch.
  2. BitNet b1.58 2B4T Technical Report Shuming Ma, Hongyu Wang, Shaohan Huang, Xingxing Zhang et al. · arXiv 2025 The 2-billion-parameter model trained on 4 trillion tokens that this page records.
  3. BitNet: Scaling 1-bit Transformers for Large Language Models Hongyu Wang, Shuming Ma, Li Dong et al. · arXiv 2023 BitLinear and the first transformer language models trained from scratch with binary weights.
  4. 1-bit AI Infra: Part 1.1, Fast and Lossless BitNet b1.58 Inference on CPUs Jinheng Wang, Hansong Zhou, Ting Song, Shaoguang Mao et al. · arXiv 2024 bitnet.cpp, the CPU kernels that run ternary products without multiplications.
  5. Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation Yoshua Bengio, Nicholas Léonard, Aaron Courville · arXiv 2013 Studies the straight-through estimator, the gradient that lets rounded weights be trained.
  6. Ternary Weight Networks Fengfu Li, Bin Liu, Xiaoxing Wang, Bo Zhang, Junchi Yan · arXiv 2016 Weights constrained to +1, 0 and −1 with a scale, trained on image classifiers before BitNet.

See also