ARotting's picture
Publish Interactive FP32, binary, and ternary comparison
2eec02e verified
|
Raw
History Blame Contribute Delete
1.91 kB
---
title: Bitforge Precision Lab
emoji: 🧪
colorFrom: indigo
colorTo: blue
sdk: static
app_file: index.html
pinned: false
---
# BitForge 1-bit
BitForge trains and compares a full-precision digit classifier, a strict one-bit
weight model, and a ternary-weight model. The low-bit students use straight-through
quantization during training and learn from both labels and the full-precision
teacher's softened output distribution.
The binary deployment artifact stores each matrix weight as one packed sign bit,
plus one floating-point scale per output channel and floating-point biases. The
project reports both classification accuracy and the measured inference payload.
Activations, scales, and biases remain floating point, so this is specifically a
one-bit **matrix-weight** experiment rather than a claim that every operation or
parameter is one bit.
## Verified results
| Variant | Test accuracy | Accuracy change |
| --- | ---: | ---: |
| FP32 teacher | 95.78% | reference |
| Packed binary matrix weights | 94.22% | -1.56 points |
| Ternary matrix weights | 95.11% | -0.67 points |
Each network has 4,810 parameters, including 4,736 matrix weights. The measured
inference payload fell from 19,240 bytes for FP32 parameters to 1,184 bytes for
packed signs, per-channel scales, and biases, a 16.25 times reduction. The `.npz`
container itself is 3,270 bytes because it also carries names, shapes, and archive
metadata. An independent reload of the packed signs reproduced 94.22% accuracy.
## Reproduce
```powershell
uv run python projects/bitforge-1bit/train.py
```
## Hosted showcase
This free static Space preserves the complete original Gradio source, trained artifacts, evaluation files, and local launch requirements. Hugging Face now requires PRO for CPU-backed Gradio hosting, so the public landing page is static while the checked-in `app.py` remains the authoritative runnable demo.