Skip to content

feat: dense arch pack for qk-norm and Gemma family (Qwen3, Gemma1, Gemma3, SmolLM3, OLMo2/OLMo3) #497

Closed

Description

@inureyes

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_json flags and the shared forward: q/k-norm flag, GeGLU/embed-scale flag, norm-placement flag, sliding-window config.
  • Per-family weight_names ordering in iree.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=xla path and serves via mlxcel-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

  1. added
    type:enhancement
    area:architecture
    area:models
    priority:medium
    status:blocked
    on Jun 30, 2026
  2. added
    status:in-progress
    status:done
    and removed
    status:blocked
    status:in-progress
    on Jul 1, 2026
  3. self-assigned this
    on Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:architecturearea:modelspriority:mediumstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions