Commit 00dfdc3
feat: LFM2-24B +7% decode, foundry tracking, repo cleanup (#10)
* docs: publish benchmark-vs-baseline truth set and bump 0.8.5
* docs: simplify benchmark tables to actionable winners
* repo: track foundry module, clean .gitignore, improve navigation
- Un-gitignore and track CLAUDE.md, AGENTS.md, UPSTREAM_PLAN.md
(fixes broken README link to UPSTREAM_PLAN.md; makes AI agent
context available to all cloners)
- Un-gitignore and track src/zmlx/foundry/ (48-file kernel template
evaluation module that was previously local-only)
- Track configs/qwen3_1p7b_kernel_sft_lora.yaml (LoRA SFT config)
- Add sessions/, runs/, training_data/, discover_sessions/ to
.gitignore (ephemeral output directories)
- Rename docs/AGENTS.md -> docs/DEVELOPMENT.md (content is a dev
guide/backlog, not agent instructions)
- Create docs/FOUNDRY.md documenting the foundry module CLI
- Update CLAUDE.md: add foundry/discover module sections, CLI
entry points table
- Update AGENTS.md: add foundry/discover to file layout tree
- Update README.md docs table: add FOUNDRY.md link
- Fix ruff lint issues in foundry module (UP006, UP035, I001, B905)
- Move 7 stale root prompt files to sessions/prompts/ (local only)
Validation: ruff check . clean, pytest 920 passed / 75 skipped / 3 xfailed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: fix broken links in ARCHITECTURE.md and ROADMAP.md
- ARCHITECTURE.md: fix `docs/UPSTREAMING.md` -> `UPSTREAM_PLAN.md`
- ROADMAP.md: fix `benchmarks/results/TEST_SUMMARY.md` -> `BENCHMARKS.md`
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: LFM2-24B-A2B-MLX-4bit +7% decode via D-SIMD gate kernel
Add a new D-SIMD (dual SIMD group) Metal kernel for MoE gating with
64 experts (D=64, K=4). The kernel fuses softmax + bias + top-K
selection into a single GPU dispatch using 2 SIMD groups (64 threads),
replacing ~10 separate Metal dispatches per layer.
Key insight: MLX's argpartition returns top-K in ascending value order.
Matching this ordering in the kernel output is critical for
token-identical fidelity — different accumulation order in the combine
step causes cascading divergence across 40 layers.
Results on M4 Max 36GB (stock MLX, 4-bit quantized):
- 200 tokens: 152.6 → 163.1 tok/s (+7.2%), 200/200 fidelity PASS
- 500 tokens: 152.0 → 161.1 tok/s (+6.0%), 500/500 fidelity PASS
Smart defaults differentiate by K (num_experts_per_tok):
- K<=2 (LFM2-8B): fused SwiGLU + kernel combine (existing +12% win)
- K>=3 (LFM2-24B): D-SIMD gate + native combine, fused SwiGLU disabled
(gather_qmm_swiglu causes 0.77x regression at K=4)
patch(model) works automatically — no env vars needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: track fusion module and resolve CI failures
- Add src/zmlx/fusion/ to git (was untracked, caused ModuleNotFoundError
in CI macOS Metal tests)
- Exclude foundry/fusion from mypy strict checks (pre-existing type
issues in newly tracked code)
- Fix union-attr mypy error in moe_mlp.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1930c6a commit 00dfdc3
98 files changed
Lines changed: 12769 additions & 104 deletions
File tree
- benchmarks
- repro_capsules
- configs
- docs
- src/zmlx
- foundry
- export
- harness
- ops
- plugins
- reports
- sampling
- templates
- moe_combine
- rmsnorm
- swiglu
- fusion
- kernels
- patch
- patterns
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 37 | + | |
| 38 | + | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | | - | |
46 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | | - | |
| 56 | + | |
50 | 57 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 58 | | |
55 | 59 | | |
| 60 | + | |
56 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
57 | 68 | | |
58 | | - | |
59 | 69 | | |
60 | | - | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
0 commit comments