ZichenAI commited on
Commit
8449246
·
verified ·
1 Parent(s): e282eae

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +51 -9
README.md CHANGED
@@ -23,9 +23,9 @@ tags:
23
  # BaiHu-V1-Flash
24
 
25
  **BaiHu-V1-Flash** is an SSA (Sparse-attention + SubQ) retrofit of `Qwen/Qwen3-0.6B-Base`,
26
- fine-tuned on **1,294 bilingual multi-turn dialogues** whose purpose is **举一反三** — the
27
- model is shown one worked rule / format / method in the first turn, and later turns ask it to
28
- reuse that rule on a *new* case it has never seen.
29
 
30
  - Base model: `Qwen/Qwen3-0.6B-Base` (28 layers / 16 Q heads / 8 KV heads / head_dim 128 / 32K context / tied embeddings)
31
  - Parameters: **598.8M** (2.75M are SSA-only modules)
@@ -149,7 +149,42 @@ The improvement holds in **all 8 slices** (2 languages × 6 kinds + overall).
149
  is correct on most samples (`B12A`, `100, 50, 25, 12.5, …`, format rewrites). Arithmetic
150
  errors remain — a 0.6B model with 1.3K training dialogues still slips on multi-step math.
151
 
152
- ### 4.3 Effect of the P0 revision
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  Measured with the same data, recipe and seed, P0 vs the old single-vector shared branch:
155
 
@@ -174,8 +209,10 @@ been run yet — see Limitations.
174
  `generate()` (greedy or temperature/top-k; no beam search).
175
 
176
  The implementation lives in the project repository (not on the Hub). **This checkpoint
177
- requires the P0 revision** of `modeling_baihu_ssa.py` — an older copy loads without error but
178
- computes a different shared branch.
 
 
179
 
180
  ### 5.2 Minimal working example
181
 
@@ -203,9 +240,10 @@ tok = AutoTokenizer.from_pretrained(REPO)
203
  model = AutoModelForCausalLM.from_pretrained(REPO, dtype=dtype).to(device).eval()
204
 
205
  messages = [
206
- {"role": "user", "content": "这个数列的规律是什么?1、4、9、16、25"},
207
- {"role": "assistant", "content": "相邻两项的差是 3、5、7、9,每次加 2,所以第 n 项是 n 的平方。"},
208
- {"role": "user", "content": "按同样的规律,下一项是多少?36、49 之后呢?"},
 
209
  ]
210
  ids = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=True,
211
  enable_thinking=False)
@@ -222,6 +260,10 @@ print(text.strip())
222
  Training used `add_generation_prompt=True, enable_thinking=False` (the generation prompt then
223
  ends with `<|im_start|>assistant\n<think>\n\n</think>\n\n`). Keep that format for best results.
224
 
 
 
 
 
225
  ### 5.3 Troubleshooting
226
 
227
  | Error | Cause | Fix |
 
23
  # BaiHu-V1-Flash
24
 
25
  **BaiHu-V1-Flash** is an SSA (Sparse-attention + SubQ) retrofit of `Qwen/Qwen3-0.6B-Base`,
26
+ fine-tuned on **1,294 bilingual multi-turn dialogues** whose purpose is **generalizing from a
27
+ single worked example** — the model is shown one worked rule / format / method in the first
28
+ turn, and later turns ask it to reuse that rule on a *new* case it has never seen.
29
 
30
  - Base model: `Qwen/Qwen3-0.6B-Base` (28 layers / 16 Q heads / 8 KV heads / head_dim 128 / 32K context / tied embeddings)
31
  - Parameters: **598.8M** (2.75M are SSA-only modules)
 
149
  is correct on most samples (`B12A`, `100, 50, 25, 12.5, …`, format rewrites). Arithmetic
150
  errors remain — a 0.6B model with 1.3K training dialogues still slips on multi-step math.
151
 
152
+ ### 4.3 Standard benchmarks (lm-evaluation-harness)
153
+
154
+ Both checkpoints were scored with `lm-evaluation-harness` **0.4.13** in one environment, with
155
+ the same prompts, batch size and dtype (`bfloat16`), over the **entire evaluation split** of
156
+ every task — 2,376 arc_easy / 1,172 arc_challenge / 10,042 hellaswag / 1,838 piqa / 1,267
157
+ winogrande examples, with no `--limit` subsampling — so the two columns are like-for-like. The
158
+ metrics are the harness's 0-shot numbers, scored in raw-completion mode (no chat template),
159
+ which is what a base checkpoint supports.
160
+
161
+ | Task | Metric | Qwen3-0.6B-Base | **BaiHu-V1-Flash** | Δ |
162
+ |---|---|---|---|---|
163
+ | arc_easy | acc_norm | 0.5791 ±0.0101 | **0.5939 ±0.0101** | +0.0148 |
164
+ | arc_challenge | acc_norm | 0.3848 ±0.0142 | **0.3882 ±0.0142** | +0.0034 |
165
+ | hellaswag | acc_norm | 0.5385 ±0.0050 | **0.5507 ±0.0050** | +0.0122 |
166
+ | piqa | acc_norm | 0.6997 ±0.0107 | **0.7084 ±0.0106** | +0.0087 |
167
+ | winogrande | acc | 0.5856 ±0.0138 | **0.6062 ±0.0137** | +0.0206 |
168
+ | unweighted mean | | 0.5575 | **0.5695** | +0.0119 |
169
+
170
+ **How to read this.** All five deltas are positive, but each is between 0.3σ and 1.5σ of its
171
+ own standard error, so the defensible claim is **"no regression in general capability"**, not
172
+ "the fine-tune made the model smarter". The movement is also not an SSA effect: a control run
173
+ of the *dense* `Qwen3-0.6B-Base` fine-tuned with the identical data and recipe lands within
174
+ ±0.005 of BaiHu-V1-Flash on every one of these tasks (arc_easy 0.5951, arc_challenge 0.3908,
175
+ hellaswag 0.5511, piqa 0.7111, winogrande 0.6014). What this release did buy is the transfer
176
+ behaviour of §4.1–§4.2 — a 63% perplexity drop on held-out dialogues and no degenerate
177
+ generations.
178
+
179
+ Caveats, stated plainly:
180
+
181
+ - These are **English** benchmarks. This harness build ships no C-Eval / CMMLU / C3 tasks, so
182
+ Chinese capability is not measured above; the held-out split of §4.1 (which contains both
183
+ languages) is the only Chinese-side evidence in this card.
184
+ - The Hub checkpoint stores float32 weights and the harness ran it at `bfloat16` (see §5.2).
185
+ The two agree to within 0.002 on every task listed, so precision is not driving the table.
186
+
187
+ ### 4.4 Effect of the P0 revision
188
 
189
  Measured with the same data, recipe and seed, P0 vs the old single-vector shared branch:
190
 
 
209
  `generate()` (greedy or temperature/top-k; no beam search).
210
 
211
  The implementation lives in the project repository (not on the Hub). **This checkpoint
212
+ requires two revisions** of that code: the P0 revision of `modeling_baihu_ssa.py` (an older
213
+ copy loads without error but computes a different shared branch), and the dtype-aware loader
214
+ in `model_baihu_ssa.py` — before it, `from_pretrained(..., dtype=...)` was silently ignored
215
+ and the model always came back float32.
216
 
217
  ### 5.2 Minimal working example
218
 
 
240
  model = AutoModelForCausalLM.from_pretrained(REPO, dtype=dtype).to(device).eval()
241
 
242
  messages = [
243
+ {"role": "user", "content": "What is the rule behind this sequence? 1, 4, 9, 16, 25"},
244
+ {"role": "assistant", "content": "The gaps between consecutive terms are 3, 5, 7, 9 "
245
+ "(+2 each time), so the n-th term is n squared."},
246
+ {"role": "user", "content": "Using that same rule, what comes after 36 and 49?"},
247
  ]
248
  ids = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=True,
249
  enable_thinking=False)
 
260
  Training used `add_generation_prompt=True, enable_thinking=False` (the generation prompt then
261
  ends with `<|im_start|>assistant\n<think>\n\n</think>\n\n`). Keep that format for best results.
262
 
263
+ The Hub checkpoint stores **float32** weights (2.4 GB). Passing `dtype=torch.bfloat16`, as
264
+ above, loads them at **1.20 GB** and leaves the (float32) rotary tables untouched; omitting
265
+ `dtype` gives the 2.40 GB float32 model. Both score identically on the benchmarks in §4.3.
266
+
267
  ### 5.3 Troubleshooting
268
 
269
  | Error | Cause | Fix |