techguy1423 commited on
Commit
4f49b3d
·
verified ·
1 Parent(s): 740ee1c

Add one-command run, charts and cross-model speeds

Browse files
README.md CHANGED
@@ -7,6 +7,7 @@ tags:
7
  - draft-model
8
  - bonsai
9
  - llama.cpp
 
10
  ---
11
 
12
  # Common Flash v0.1
@@ -18,6 +19,24 @@ A small model proposes tokens and Bonsai checks them in one pass, so the output
18
  (1,000 completions of at most 192 tokens; rank 32, all linear layers), vocabulary trimmed to Bonsai's 151,669 tokens
19
  (llama.cpp needs the draft vocabulary within 128 tokens of the target's), then quantized to Q4_0.
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ## Target model (required pairing)
22
 
23
  This drafter only works with **`Ternary-Bonsai-8B-Q2_0_g64.gguf`** from
@@ -126,6 +145,28 @@ Speed relative to plain decoding:
126
  Draft acceptance is about 65% overall but only 33-45% on chat. Run-to-run ratios varied between 1.19x and 1.41x on a busy machine, so treat these as approximate.
127
  With greedy decoding every speculative output matched plain decoding. With sampling the random draws differ, so that check does not apply.
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  ## Limits
130
 
131
  - Tested on one machine. Older llama.cpp builds or other hardware may not see a speedup.
 
7
  - draft-model
8
  - bonsai
9
  - llama.cpp
10
+ pipeline_tag: text-generation
11
  ---
12
 
13
  # Common Flash v0.1
 
19
  (1,000 completions of at most 192 tokens; rank 32, all linear layers), vocabulary trimmed to Bonsai's 151,669 tokens
20
  (llama.cpp needs the draft vocabulary within 128 tokens of the target's), then quantized to Q4_0.
21
 
22
+ ## Run it in one command
23
+
24
+ Needs a recent llama.cpp (`llama-server`, build 1268eda or newer; see Quick start below). This downloads Bonsai 8B and this drafter, then starts a speculative server with a chat page at http://127.0.0.1:8080:
25
+
26
+ ```bash
27
+ llama-server \
28
+ -hf prism-ml/Ternary-Bonsai-8B-gguf:Q2_0_g64 \
29
+ -hfd TheCommonAI/common-flash-v0.1 \
30
+ -ngl 99 -ngld 99 -fa on -np 1 -c 4096 \
31
+ --spec-type draft-simple --spec-draft-n-max 3
32
+ ```
33
+
34
+ `-hf` fetches the target model, `-hfd` fetches the drafter from this repo. Tested from an empty cache; the first start downloads about 2.7 GB.
35
+
36
+ > **About the "Use this model" button.** Hugging Face generates that snippet itself, and for this repo it would start the drafter alone, which is not useful. Use the command above instead.
37
+
38
+ ![Decode speed by model](assets/speed_by_model.png)
39
+
40
  ## Target model (required pairing)
41
 
42
  This drafter only works with **`Ternary-Bonsai-8B-Q2_0_g64.gguf`** from
 
145
  Draft acceptance is about 65% overall but only 33-45% on chat. Run-to-run ratios varied between 1.19x and 1.41x on a busy machine, so treat these as approximate.
146
  With greedy decoding every speculative output matched plain decoding. With sampling the random draws differ, so that check does not apply.
147
 
148
+
149
+ ### Charts
150
+
151
+ ![Speedup by workload](assets/speedup_by_workload.png)
152
+
153
+ ![Why the runtime matters](assets/verify_throughput.png)
154
+
155
+ ![What helped](assets/what_helped.png)
156
+
157
+ ### Decode speed on the same M3 (plain, llama.cpp 1268eda, `llama-bench` tg128)
158
+
159
+ | Model | File size | tokens/s |
160
+ | --- | ---: | ---: |
161
+ | Ternary Bonsai 1.7B | 0.46 GB | 127 |
162
+ | Ternary Bonsai 2 2B | 0.51 GB | 97 |
163
+ | **Common Flash** (Bonsai 8B + drafter) | 2.3 GB + 0.4 GB | **~49** (36.3 x 1.36) |
164
+ | Ternary Bonsai 2 4B | 1.1 GB | 48 |
165
+ | Ternary Bonsai 8B, plain | 2.1 GB | 36 |
166
+ | Ternary Bonsai 2 9B | 2.4 GB | 28 |
167
+
168
+ The Common Flash row is derived: plain Bonsai 8B speed times the measured 1.36x ratio, not a separate `llama-bench` run. Smaller models are faster but are different, smaller models; the comparison that matters for quality is Bonsai 8B plain against Bonsai 8B with the drafter, which produce the same text.
169
+
170
  ## Limits
171
 
172
  - Tested on one machine. Older llama.cpp builds or other hardware may not see a speedup.
assets/speed_by_model.png ADDED
assets/speedup_by_workload.png ADDED
assets/verify_throughput.png ADDED
assets/what_helped.png ADDED