File size: 1,908 Bytes
f49ac6e
 
2eec02e
 
f49ac6e
 
2eec02e
f49ac6e
 
 
2eec02e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
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.