Llama 3.2 3B Instruct, losslessly compressed with Binade
Built with Llama.
meta-llama/Llama-3.2-3B-Instruct packed with Binade: 4.31 GB instead of 6.43 GB (10.731 bits per weight instead of 16 in the packed tensors), every weight restored bit for bit, and outputs bit-identical to the BF16 model, not just close. The files packed were the copy at unsloth/Llama-3.2-3B-Instruct, byte for byte the same weights.
Binade codes each weight's exponent by its frequency rank and keeps the sign and mantissa as they are. Its kernels decode the weights inside the matrix products and add the products in exactly the order the framework's own BF16 kernels do, so the logits and generated tokens match the original. The paper explains how.
Exactness
| check | result |
|---|---|
| every tensor unpacked and compared with the original checkpoint | 254 tensors, 0 values differ (Llama-3.2-3B-Instruct/roundtrip_v2.md) |
| logits at 16,352 WikiText-2 positions, Apple M4 Max, against BF16 in memory | 16,352 / 16,352 bit-identical (Llama-3.2-3B-Instruct/exactness_scale.md) |
| 32 greedy generations of 128 tokens, Apple M4 Max | 32 / 32 identical, tokens and log-probabilities |
| MLX 8-bit quantization, for comparison | 0 / 16,352 positions identical, argmax agreement 98.0% |
Use
pip install binade # Apple Silicon
pip install "binade[cuda]" # Linux + CUDA 12
from mlx_lm import generate
from binade.mlx.r4 import load
model, tokenizer, _ = load("Binade/Llama-3.2-3B-Instruct")
messages = [{"role": "user", "content": "Why is the sky blue?"}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, tokenizer, prompt, max_tokens=200))
To get the original BF16 checkpoint back, bit for bit: binade unpack Binade/Llama-3.2-3B-Instruct --out Llama-3.2-3B-Instruct-bf16.
Requirements and limits
- MLX 0.32.2 and mlx-lm 0.31.3, which
pip install binadeinstalls. Exactness is tied to MLX's own kernels; the tests in the repository check it. - Apple Silicon runs the fused prompt kernels on M3 and M4 GPUs. On NVIDIA they are verified on the RTX PRO 6000, L4 and A100; on other GPUs prompts rebuild BF16 weights, which is exact but slower.
- Exactness was tested on text generation.
- The Hub tags this repository 8-bit, and counts its parameters by bytes, because the packed bytes are stored as uint8 tensors. The weights are the full BF16 weights:
binade unpackrestores every one bit for bit.
License
Built with Llama. Llama 3.2 is licensed under the Llama 3.2 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.
This repository carries the license, Meta's acceptable use policy and the notice. Use of these weights follows both, as use of the original weights does. Binade itself is Apache-2.0.
Citation
@misc{shafir2026binade,
title = {Binade: Bit-Exact Compressed LLM Inference on Apple Silicon},
author = {Guy Shafir and Tulber},
year = {2026},
url = {https://github.com/GuyShafir/binade}
}
Packed by Binade format 2 at commit 75147d5 of the development repository.
- Downloads last month
- -