Lossless BF16 compression that executes directly on the GPU.
Korthil compresses BF16 weights, KV-caches, and fine-tune deltas without quantization, then unpacks inside Apple Metal 3 and NVIDIA CUDA registers. Archives restore the original Hugging Face .safetensors SHA-256 via a 47 KB OS-only binary.
629.8 GB/s
RTX 2080 Ti CUDA effective BF16 (616 GB/s bus, 1.20x raw)
221.5 GB/s
Apple M2 Pro 16K KV25 peak (200 GB/s bus, up to 1.47x chat)
40% to 43%
Unseen 2K KV-cache savings, 13.74 GB/s CUDA rANS decode
57.87%
Fine-tune lineage delta (6.74 bpw, 44.3% under Zstd-22)
Decode trace
Recorded on Apple M2 Pro Metal 3 at true token cadence. Clone and run tools/korthil_arena.py to test live.
Raw BF16
-- tok/s
RAM
-- MB
Ready
0 tok
Korthil SP-WIN3 v2
DONE FIRST-- tok/s
RAM
-- MB
Ready
0 tok
BF16 bit layout
Measured across 2.89B real weights, the 7-bit mantissa is near-random (6.972 bits of entropy) while the 8-bit exponent clusters around 2.630 bits.
Sign (1b)
Exponent (8b -> 3b window)
Mantissa (7b)
Bits per weight (lossless)
Standalone weights hit a 10.56 bpw Shannon floor. KV-caches and fine-tunes go further via history and parent correlation.
Raw BF1616.00 bpw
SP-WIN3 v2 (GPU weights)11.37 bpw (-28.9%)
Standalone Shannon floor10.56 bpw (-34.0%)
CKV6 v2 (2K KV-cache)9.10 bpw (-43.1%)
Fine-tune lineage6.74 bpw (-57.9%)
Benchmarks
Measured locally with isolated timings and SHA-256 or bit-exact GPU unpack verification.
NVIDIA RTX 2080 Ti (CUDA sm_75)
Ubuntu 22.04 x86_64 · 616 GB/s GDDR6 bus
526.4 GB/s
584.5 GB/s
629.8 GB/s
Red line: 616 GB/s physical GDDR6 bus (axis max 700).
Apple M2 Pro (Metal 3)
macOS 15.7.3 ARM64 · 200 GB/s unified bus
173.8 GB/s
213.2 GB/s
221.5 GB/s
Red line: 200 GB/s physical LPDDR5 bus (axis max 240).
| Workload | Hardware | Size | Throughput / Speed | Check |
|---|---|---|---|---|
| DeepSeek-R1-1.5B chat | Apple M2 Pro | 3,554 -> 2,526 MB (-28.9%) | 40.1 -> 58.4 tok/s (1.46x) | 0 diffs, -1.14 GB at 16K |
| Qwen3-0.6B chat | Apple M2 Pro | 1,503 -> 1,073 MB (-28.6%) | 92.1 -> 104.5 tok/s (1.14x) | 0 diffs, -896 MB at 16K |
| DeepSeek-R1-1.5B GEMV | RTX 2080 Ti | 3,554 -> 2,525 MB (-28.9%) | 629.8 GB/s (1.20x raw) | Bit-exact unpack, cos=1.0 |
| Qwen3-0.6B GEMV | RTX 2080 Ti | 1,503 -> 1,073 MB (-28.6%) | 584.5 GB/s (1.17x raw) | Bit-exact unpack, cos=1.0 |
| CKV6 v2 KV (SmolLM2 2K) | RTX 2080 Ti | 83.9 -> 50.3 MB (-40.1%) | 13.74 GB/s (19,840 threads) | GPU SHA-256 exact |
| CKV6 v2 KV (SmolLM2 2K) | Apple M2 Pro | 83.9 -> 50.3 / 47.7 MB (-43.1% xl) | 7.61 GB/s (kv26-tok) | GPU SHA-256 exact (Zstd-19: 24.6%) |
| Granite-4.0-350M lineage | macOS / Linux | 704.8 -> 296.9 MB (-57.9%) | 6.74 bpw (35s pack, 8 thr) | 44.3% under Zstd-22 patch |
Install and verify
Compiles with standard Apple Clang, GCC, or NVCC. No external libraries or pip packages required.
# Cross-OS recovery test: packed on macOS ARM64, restored on Ubuntu 22.04 x86_64
$ ls -lh bin/korthil-recover && ldd bin/korthil-recover
-rwxr-xr-x 1 rob rob 47K bin/korthil-recover
libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
$ PATH="" ./bin/korthil-recover recover smollm2_360m.korthil restored.safetensors && sha256sum restored.safetensors
e6bffe7435d7ddc10fd3b9a9efd429dafbacb1cb17015fb5562664e7532bf86e restored.safetensors
Limits
- Standalone BF16 entropy floor: Random low mantissa bits cap lossless single-model savings near 34.0% (10.56 bpw). The 40% to 58% ratios apply to KV-caches and fine-tune lineages, not standalone weights.
- KV cross-layer speed tradeoff: Zero-calibration
kv26-tokdecodes all layers in parallel (7.61 GB/s Metal 3, 13.74 GB/s CUDA). Adding cross-layer prediction (kv26-xlayer) saves ~3% more space but runs sequentially across layers (0.137 GB/s). - Small matrices and mid-context steps: On RTX 2080 Ti, small SmolLM2-360M matrices (320x960) save 28.5% VRAM at 0.97x raw speed before reaching 1.17x (Qwen3-0.6B) and 1.20x (DeepSeek-R1-1.5B). On M2 Pro, isolated T=4096 and G=3,6 16K steps run 0.71x to 0.92x raw while still cutting RAM by 26% to 29%.
- Accumulation order and H100 estimates: Archived weights and KV pages are SHA-256 bit-exact across all 65,536 BF16 bit patterns; deferred sparse escape addition in fused matmuls shifts FP32 reduction order by 4e-7 to 4e-5 (0 greedy token diffs). H100 TCO figures in the repo docs are modeled projections, not H100 measurements.