atlas: measured-cost quantization for MLX — give it a RAM budget, it finds the optimal (bit-width, group-size) plan #3798
Matth21
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I built a quantizer for MLX that replaces heuristics with measurement.
How it works: it fake-quantizes one transformer block at a time, measures KL divergence on the output logits over a fixed calibration set, and builds a cost table for every (bits, group_size) config — bits ∈ {3,4,5,6} × gs ∈ {32,64,128}. A validated additivity assumption turns budget-constrained allocation into an exact per-block Lagrangian rule, so one overnight profiling run gives you the entire 3–5 bit/w Pareto frontier. After that, any budget is milliseconds.
The product gesture:
→ best quality that fits in 4 GB. Pre-computed cost tables for TinyLlama-1.1B and Qwen2.5-7B ship in the repo, so first run takes minutes.
Results (disk size / total params, full Wikitext-2 sliding window, both TinyLlama-1.1B and Qwen2.5-7B):
mxfp4support is my next step to close it.Honest footnote: v1 of this work used an entropy heuristic. Controlled baselines (random + inverted rankings) showed the entropy signal was exactly zero — the paper's Section 6 documents the correction openly.
Repo (code, tests, all experimental data): https://github.com/Matth21/atlas
Paper: https://doi.org/10.5281/zenodo.21190586
Feedback very welcome — especially from anyone who knows the quantized-matmul kernel internals and has opinions on richer low-bit formats in MLX.
Beta Was this translation helpful? Give feedback.
All reactions