Skip to content

feat(models): add IBM Granite family (granite, granitemoe, granitemoehybrid) #245

Closed

Description

@inureyes

Summary

Port the IBM Granite model family from mlx-lm. mlxcel has a Granite tool-call format name but not the model architecture. Granite is a widely used open family and upstream remains active (tied-embeddings sanitize fix ml-explore/mlx-lm#1298, 2026-06).

Upstream references

Scope (incremental, per mlxcel porting policy)

Land one variant with a working checkpoint and tests before broadening:

  1. Dense Granite (granite.py): base transformer with Granite scalar multipliers (attention_multiplier, embedding_multiplier, residual_multiplier, logits_scaling).
  2. GraniteMoE (granitemoe.py): reuse src/models/switch_layers.rs.
  3. GraniteMoEHybrid (granitemoehybrid.py): Mamba2 + attention hybrid; reuse the mamba2 / src/models/gated_delta.rs machinery and the hybrid cache pattern used by Jamba / Nemotron-H.

Acceptance criteria

  • src/models/granite.rs (and MoE / hybrid as scope advances) implemented.
  • Registered in src/models/detection.rs (granite, granitemoe, granitemoehybrid).
  • bf16 to f16 conversion applied at the weight-loading boundary (load_and_sanitize_weights).
  • Granite scalar multipliers (attention, embedding, residual, logits) applied correctly.
  • Unit tests in granite_tests.rs.
  • docs/supported-models.md updated and family added to the detection table.
  • Validated with a real mlx-community Granite checkpoint: mlxcel list shows it and mlxcel generate produces coherent output.

Effort

Medium (dense) to High (hybrid).

Activity

  1. added
    status:ready
    type:enhancement
    priority:high
    area:models
    status:in-progress
    and removed
    status:ready
    on Jun 13, 2026
  2. inureyes commented on Jun 13, 2026

    @inureyes
    MemberAuthor

    Dense granite landed in #254 (validated against mlx-community/granite-3.3-2b-instruct-4bit). Per the chosen plan, granitemoehybrid (Granite 4.x, Mamba2 + attention hybrid) will be implemented together with #247 (Falcon-H1) and #251 (PLaMo 2) on shared hybrid-cache infrastructure, and that follow-up will close this issue. Pure granitemoe is deferred: no public MLX checkpoint exists to validate it.

  3. inureyes commented on Jun 13, 2026

    @inureyes
    MemberAuthor

    Reopening: this issue was auto-closed when PR #254 merged because the PR body contained the literal phrase 'will close #245' (GitHub's closing-keyword parser matches 'close #245' regardless of surrounding tense/context). Dense granite is merged and validated. This issue stays open for the granitemoehybrid (Granite 4.x) variant, which lands with the shared Mamba2 hybrid infrastructure alongside #247 and #251.

  4. added
    status:review
    status:done
    and removed
    status:in-progress
    on Jun 13, 2026
  5. added this to the 0.3 milestone on Jun 21, 2026
  6. self-assigned this
    on Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:modelspriority:highstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions