Native Apple Metal GPU inference via mlx-c bindings
Find a file
Snider 535b04d5d6 feat(metal): add Qwen2 model support (DeepSeek R1 validated)
Qwen2 and Qwen3 share the same architecture — Qwen3 adds Q/K RMS
normalization which Qwen2 lacks. The loader auto-detects the variant
from weight presence and reports the correct ModelType().

- Add "qwen2" to architecture dispatch in model.go
- Make Q/K norm optional in attention forward (nil-safe check)
- Store detected model type on Qwen3Model struct
- Add "qwen2" to chat template routing
- DeepSeek R1 7B (4-bit): 27 tok/s on M3 Ultra
- 2 new tests: inference + chat

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 21:55:56 +00:00
cpp fix(metal): address 4 minor code review items 2026-02-19 21:36:40 +00:00
docs/plans fix(metal): address 4 minor code review items 2026-02-19 21:36:40 +00:00
internal/metal feat(metal): add Qwen2 model support (DeepSeek R1 validated) 2026-02-19 21:55:56 +00:00
.gitignore chore: gitignore dist/ (CMake install output) 2026-02-19 19:30:23 +00:00
CLAUDE.md feat(api): migrate to go-inference shared interfaces 2026-02-19 20:15:42 +00:00
CMakeLists.txt feat: extract go-mlx from go-ai as standalone Metal inference package 2026-02-19 17:57:37 +00:00
FINDINGS.md fix(metal): address 4 minor code review items 2026-02-19 21:36:40 +00:00
go.mod feat(api): migrate to go-inference shared interfaces 2026-02-19 20:15:42 +00:00
mlx.go feat(api): migrate to go-inference shared interfaces 2026-02-19 20:15:42 +00:00
mlx_stub.go feat: extract go-mlx from go-ai as standalone Metal inference package 2026-02-19 17:57:37 +00:00
mlx_test.go feat(metal): add Qwen2 model support (DeepSeek R1 validated) 2026-02-19 21:55:56 +00:00
register_metal.go fix(metal): address 3 critical code review items 2026-02-19 21:24:10 +00:00
TODO.md feat(metal): add Qwen2 model support (DeepSeek R1 validated) 2026-02-19 21:55:56 +00:00