Repository navigation
Description
Part of #493
Context
These architectures are Llama-shaped or Gemma2-shaped with small, well-understood deltas:
- Qwen3 and SmolLM3 add a per-head q/k RMSNorm.
- Gemma1 uses GeGLU and an embedding scale, without the Gemma2 soft-caps.
- Gemma3 is Gemma2 plus qk-norm and a different sliding-window configuration.
- OLMo2 and OLMo3 differ in norm placement.
Once the shared attention core (#494) lands, each is a config flag plus a small forward delta.
Scope
- Add each architecture via
Config::from_jsonflags and the shared forward: q/k-norm flag, GeGLU/embed-scale flag, norm-placement flag, sliding-window config. - Per-family
weight_namesordering iniree.rs. - Files:
emitter/config.rs,emitter/model.rs,iree.rs.
Acceptance criteria
- Each listed architecture (Qwen3, Gemma1, Gemma3, SmolLM3, OLMo2, OLMo3) loads and generates via the CLI
MLXCEL_BACKEND=xlapath and serves viamlxcel-server. - Single-sequence path is token-exact vs an HF fp32 oracle on a real checkpoint (dequant a 4bit/8bit checkpoint, for example qwen3-, gemma-2b, gemma3-, for the oracle).
- Serve path is reference-exact via
xla_batch_bench. - tanh-based families (Gemma soft-cap/GeGLU) may differ only at sub-0.01 logit near-ties; that is acceptable.
Dependencies
#494 (shared attention core). Uses #496 (validation harness) when available.
Implementation status (PR #558)
Emit + loader wiring is complete for all six families and the family math is proven token-exact vs the HF fp32 oracle (IREE llvm-cpu) on a small synthetic model per family (isolates the arch delta without a heavy checkpoint or the xla-iree build): Qwen3 0.0, Gemma1 3e-8, Gemma3 with dual RoPE 4e-8, SmolLM3 NoPE 5e-10, OLMo2 2e-9 max abs logit diff. The 69 pure-Rust tests keep the existing Llama/Qwen2/Gemma2 goldens byte-for-byte unchanged.
Deferred to the orchestrator's post-merge real-checkpoint gate (they need a local xla-iree build): the real-checkpoint CLI (MLXCEL_BACKEND=xla) / mlxcel-server load-and-generate run (criterion 1) and the xla_batch_bench serve reference-exact run (criterion 3); both paths are wired (weight_names feeds the IREE loader) and the single-sequence math is proven above (criterion 2, on synthetic weights). OLMo3 is structure-complete but its full-size checkpoint uses yarn RoPE (rejected with a clear message) and is 32B, so its execution check is deferred; its post-norm + flat q/k-norm + sliding structure is covered by the OLMo2 execution proof and a plain-RoPE OLMo3 parse test.
Activity
refactor: share per-layer attention core across emitter graph kinds (#…
Merge origin/main: unify #497 qk-norm/Gemma and #499 dense packs
merge origin/main: unify #497/#499 and #498 dense arch packs
Merge origin/main into feature/issue-500-moe-ffn-primitive
feat: add Qwen3-MoE and OLMoE on the shared MoE FFN primitive (#563)
refactor: share per-layer attention core across emitter graph kinds (l…
feat: add Qwen3-MoE and OLMoE on the shared MoE FFN primitive (lablup…