Commit 5a3f58b
committed
feat(v7-q13): full DeepSeek V4 Flash mini-model + native tokenizer + rich adapter help
Operator opened the deepseek_v4_flash preset and got 4 disconnected
bricks with no MTP head, no DSA compression ratios, no positional
embed — nothing like Raschka's diagram. Plus only 4 tokenizers, no
native cppmega, no custom-create. Plus the adapter ? popups were
1-sentence stubs that didn't explain real use cases.
Three fixes:
1. _deepseek_v4_flash() rebuilt as a CONNECTED full mini-model that
mirrors the actual DeepSeek V4 Flash architecture:
- abs_pos_embed input
- 3x backbone layer, each:
lightning_indexer (top_k=H/128) → csa_hca → engram →
dsv4_attention (kv_lora_rank=H/4) → rmsnorm → moe
- final rmsnorm
- nemotron_h_mtp drafter head (k=2)
Encodes DSA's 1/128 sparse-keys + 1/4 KV LoRA compression
contract from the paper.
2. Tokenizer presets — added 'cppmega_native_65k' (the local repo's
tokenizer) and '<custom>' sentinel for file-picker. Surface
counter went 12 -> 14.
3. BLOCK_BUILDERS gained rmsnorm / layernorm / residual entries
(thin nn.RMSNorm / nn.LayerNorm / identity wrappers) so canvas
nodes of these kinds instantiate via from_block_specs. Closes
the 'kind not in BLOCK_BUILDERS' fusion-test regression for any
preset that emits norm/residual bricks explicitly.
4. Rewrote 5 adapter HELP_TOPICS entries (linear_bridge / merge_heads /
split_heads / transpose_bnsd / rmsnorm / residual) from 1-sentence
stubs to in-depth explanations covering:
- WHY the adapter exists (4 concrete scenarios for linear_bridge:
decoupled-Q, mid-stack width change, cross-model transplant,
A/B experiments)
- When NOT to use it (95% of presets don't need linear_bridge)
- Compare-vs-other-adapter context
- Concrete example with the typical pattern
- Paper references where applicable
Tests (all green):
- tests/v4/test_deepseek_v4_flash_full_model.py: 7 cases pinning the
new shape (3-layer backbone + MTP + DSA compression knobs)
- tests/v4/test_fusion_stage_d.py dsv4 cases: PASS (was failing due
to engram param schema + missing BLOCK_BUILDERS entries)
- vbgui vitest help-suite: 10/10 PASS
Known pre-existing failure (not from this commit):
- test_gemma4_preset_groups_5_sliding_then_breaks_to_global_and_moe
fails on main (gemma4_ple now fuses with first sliding attention).
Reproduced via git stash + clean checkout — issue exists before
Q13. Carrying as separate ticket.1 parent 6fe5518 commit 5a3f58b
7 files changed
Lines changed: 734 additions & 62 deletions
File tree
- cppmega_v4
- architectures
- jsonrpc
- models
- tests/v4
- vbgui
- src/components
- diagrams
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
89 | 106 | | |
90 | 107 | | |
91 | 108 | | |
| |||
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
106 | 156 | | |
107 | 157 | | |
108 | 158 | | |
| |||
113 | 163 | | |
114 | 164 | | |
115 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
116 | 169 | | |
117 | 170 | | |
118 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
389 | 412 | | |
390 | 413 | | |
391 | 414 | | |
| |||
600 | 623 | | |
601 | 624 | | |
602 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
603 | 632 | | |
604 | 633 | | |
605 | 634 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments