Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: allenai/OLMoE-1B-7B-0125-Instruct
|
| 4 |
+
library_name: llama.cpp
|
| 5 |
+
tags: [mixture-of-experts, ternary, quantization, llama.cpp, tq1_0]
|
| 6 |
+
---
|
| 7 |
+
# trnr: OLMoE-1B-7B-0125-Instruct, expert weights at 1.6875 bits/weight
|
| 8 |
+
|
| 9 |
+
Post-training ternarization of the **expert weights only**: values in {-1, 0, +1} times one fp16
|
| 10 |
+
scale per 256 input columns, packed into llama.cpp's existing **TQ1_0** type. Attention,
|
| 11 |
+
embeddings, the output head and the router stay F16.
|
| 12 |
+
|
| 13 |
+
| | |
|
| 14 |
+
|---|---|
|
| 15 |
+
| expert weights | 1.359 GB at 1.6875 bits/weight, 46% exact zeros |
|
| 16 |
+
| full file | __SIZE__ GB |
|
| 17 |
+
| perplexity | __PPL__ (wikitext-2-raw, 8 x 512 tokens) |
|
| 18 |
+
| fp16 reference | 9.1512, same protocol and same pinned build |
|
| 19 |
+
| ratio | __RATIO__x |
|
| 20 |
+
| speed | ~16 tok/s on 4 CPU threads, no GPU, no custom kernels |
|
| 21 |
+
|
| 22 |
+
## Method
|
| 23 |
+
1. One dense random orthogonal rotation R, shared by all 16 layers, applied to the gate_up
|
| 24 |
+
**input** only, with the router folded by the same R so routing is unchanged.
|
| 25 |
+
2. A per-256-block ternary scale fitted by a Hessian-weighted least-squares objective.
|
| 26 |
+
3. Canonical GPTQ error feedback across blocks, with a per-expert Hessian for down_proj.
|
| 27 |
+
4. Bytes packed into TQ1_0's layout, verified byte-identical to llama.cpp's own encoder.
|
| 28 |
+
|
| 29 |
+
## Requirements
|
| 30 |
+
Needs the companion fork **trnr.cpp** -- one commit over llama.cpp at __PIN8__ -- for the
|
| 31 |
+
rotation tensor. `trnr_rot.patch` is in this repo. Without it the model loads and produces
|
| 32 |
+
garbage.
|
| 33 |
+
|
| 34 |
+
## Honest limitations
|
| 35 |
+
- __RATIO__x fp16 perplexity, and that is the price of ternary itself: the scalar three-level
|
| 36 |
+
optimum for Gaussian weights is 0.1903 NMSE and this pipeline measures 0.1954, i.e. it is
|
| 37 |
+
**at the optimum for this alphabet**. The remaining gap is ternary, not the fitting.
|
| 38 |
+
- Perplexity is not quality. Downstream tasks degrade more than wikitext suggests.
|
| 39 |
+
- No fine-tuning was used.
|
| 40 |
+
- llama.cpp's stock TQ1_0 quantizer is unusable for this model: its absmax scale sends ~92% of
|
| 41 |
+
weights to zero and yields ppl 5178. The learned per-block scale is what makes the format work.
|