styal commited on
Commit
77938da
·
verified ·
1 Parent(s): a2aea72

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +37 -0
README.md CHANGED
@@ -13,3 +13,40 @@ FFN MACs per token: 47.2M dense -> 30.9M cascade
13
  `styal/calib-data`; token inflation from the cut 1.0043x, so compare arms by bits/byte.
14
  Head/embedding are tied and cut on both sides. The stock model puts
15
  0.41% of its probability mass on the ids this cut removes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  `styal/calib-data`; token inflation from the cut 1.0043x, so compare arms by bits/byte.
14
  Head/embedding are tied and cut on both sides. The stock model puts
15
  0.41% of its probability mass on the ids this cut removes.
16
+
17
+ ## GGUF for llama.cpp
18
+
19
+ `lfm3-1.7b-cascade-30-Q8_0.gguf` (1.71 GB) runs this checkpoint in llama.cpp with the cascade FFN,
20
+ using [styalai/leffm-llamacpp](https://github.com/styalai/leffm-llamacpp). The vocabulary is already
21
+ cut, so the tokenizer and the head are stock for that fork — no extra flags.
22
+
23
+ ```sh
24
+ # the operating point: 5120 candidate units, 2304 of them gathered
25
+ LLAMA_CASCADE=5120,2304 llama-cli -m lfm3-1.7b-cascade-30-Q8_0.gguf -nr -p "..." -n 128
26
+ ```
27
+
28
+ - `-nr` (`--no-repack`) is **required**: the cascade reads `ffn_up` / `ffn_down` as Q8_0 in their
29
+ stored layout. The whole model is Q8_0 (same tensor-type profile as the stock
30
+ `LFM3-1.7B-Q8_0.gguf`), including the gate and the two gathered matrices.
31
+ - `LLAMA_CASCADE=7680,7680` reproduces the dense FFN: greedy output is identical to running the model
32
+ without the cascade (checked on Metal and CPU for this file; the CUDA kernels pass the same gate).
33
+ - Batch 1 only — the cascade is a single-token decode path. `llama-perplexity -ub 1` does exercise it.
34
+
35
+ **Perplexity in llama.cpp** (held-out slice of `styal/calib-data`, 64 sequences / 115,159 bytes,
36
+ batch-1 decode so the cascade is active, Q8_0, same tokenizer both arms):
37
+
38
+ | arm | PPL |
39
+ |---|---|
40
+ | dense FFN (`LLAMA_CASCADE=7680,7680`) | 3.174 |
41
+ | cascade, c=5120 k=2304 | 3.450 |
42
+
43
+ So the cascade costs **+0.276 nats (+8.7% PPL)** at this operating point in this runtime, measured on
44
+ the same weights and tokenizer. That is the cascade's own price; the table above prices the vocabulary
45
+ cut against a separately trained dense model.
46
+
47
+ **Selection rule.** These weights were trained with the calibrated stage-1 score
48
+ `|silu(g_j)| * c_j`, where `c_j = mean_x |u_j(x)| * ||w^d_j||` over calibration data — the
49
+ `feed_forward.const` buffers in the checkpoint. llama.cpp ranks stage 1 by `|silu(g_j)|` alone, and
50
+ the converter drops the constants: they are not part of the shipped graph. On this recipe that
51
+ substitution measured **+0.020 nats** at zero-shot, before any training (`c` = 2/3 of the units leaves
52
+ enough slack that almost any sane score preserves the true top-k).