Downloads · 30 days
0
KanakMalpani/bnn-lab-wrap-demo
bnn-lab-wrap-demo is a other model from KanakMalpani. Use it for the other task on the model card, and read the license before you ship it in a product. It is set up for bnn-lab. The card lists the license as mit.
Canary / lab demo — not ImageNet SOTA. Packed binary Linear weights for the committed wrapdemo shape (wide Sequential, hidden=4096, layers 3 and 5). Format: .bnnpack v2 (weightsonly load, content hashes).
Downloads · 30 days
0
Access
Public
Updated Aug 14, 2026
Repo size
4.3 MB
Likes
0
Public
Click a slice to open those files.
.bnnpack4.3 MB · 100%
From the Hugging Face model README
.bnnpack (canary)Canary / lab demo — not ImageNet SOTA. Packed binary Linear weights for the
committed wrap_demo shape (wide Sequential, hidden=4096, layers 3 and
5). Format: .bnnpack v2
(weights_only load, content hashes).
32× is uint64 pack compression of the replaced Linear weights, not a GPU
speedup from sign() / STE. Wall-clock is a separate metric.
This Hub file is a shape/codec canary (PTQ pack of seed-0 random-init middles). It is not the QAT checkpoint behind the published JSON.
On wrap_demo hidden=4096, after MSE + fold_α QAT (200 steps), committed
results/wrap_demo.json:
| Metric | Published | Floor (tests/golden_floors.json → wrap_demo) |
|---|---|---|
| Weight compression (replaced) | 32.0× | weight_compression_exact: 32.0 |
| Output cosine vs FP | 0.9990 | cosine_min: 0.85 |
| E2E speedup vs FP Sequential | 2.65× | e2e_speedup_min: 1.5 |
| Status | OK (drop_in_ok=true, forced=false) | AND-gate without --force |
PTQ-only cosine on this shape is bounded by cosine_max_without_qat: 0.5
(legacy ~0.31). Do not quote PTQ as drop-in.
results/ultra_wrap.json
hybrid/binary TinyBlock: cosine ~0.70 (0.6988), status
REFUSE_DROP_IN_CLAIM. Ternary on that suite meets cosine but loses
wall-clock (~0.73×). Ternary 0.991 / 0.73× does not count as the AND-gate.
from huggingface_hub import hf_hub_download
from bnn.codec import decode_file, packed_module_fp_err
path = hf_hub_download("KanakMalpani/bnn-lab-wrap-demo", filename="model.bnnpack")
modules, meta = decode_file(path)
mod = modules["3"] # PackedBinaryXNORLinear, in=4096 out=4096
print(meta["canary"])
print("GEMM err", packed_module_fp_err(mod)) # 0
Needs pip install bnn-lab huggingface_hub (or pip install -e ".[hf]" from
the repo). Tutorial: docs/tutorials/08_HF_OPTIMISER.md.
Offline encode (no Hub):
python scripts/encode_hf_canaries.py --only wrap-demo --out-dir results/hf_canaries
model.bnnpack — packed layers 3 and 5 (binary XNOR, ~4 MiB packed vs
128 MiB FP32 for those two Linears).MIT (same as bnn-lab).