Skip to content

feat(models): add Kyutai Helium (helium) text model support #837

Closed

Description

@inureyes

Summary

Add support for Kyutai's Helium text model (model_type: helium) to the mlxcel Rust inference runtime, ported from mlx-lm. Helium is a Llama-style dense decoder, so this is a small port that mostly reuses the existing Llama/Mistral decoder path.

Upstream reference

Public checkpoint

  • kyutai/helium-1-preview-2b. Confirm an mlx-community 4-bit conversion exists (for example an mlx-community/helium-* SafeTensors export); if none is published, convert the base checkpoint with the standard mlx tooling for validation. Direct MLX SafeTensors from mlx-community load without a conversion step.

Architecture notes

Helium is essentially a Llama-style dense decoder:

  • RMSNorm for attention/MLP norms and the final norm.
  • Traditional RoPE: nn.RoPE(head_dim, traditional=True, base=rope_theta). This is the one deviation from the common Llama path, which uses traditional=False.
  • GQA (num_attention_heads >= num_key_value_heads).
  • SwiGLU MLP with SiLU activation (gate/up/down projections).
  • No QK-norm, no MoE, no sliding window. Very close to Llama and Mistral dense decoders.

Implementation plan

This is nearly a Llama clone. The existing dense decoder path does almost all the work:

  • Reuse the decoder block, attention, and SwiGLU MLP from src/models/llama3.rs (or src/models/mistral4.rs for the plain dense shape). No new attention or MLP kernels are needed.
  • The distinctive work is the traditional-RoPE flag. In src/models/llama3.rs the RoPE call is mlxcel_core::fast_rope(&q, self.rope_dims, false, self.rope_base, 1.0, offset), where the third argument is traditional. Helium must pass true. Thread a traditional bool from the config through block construction to every fast_rope / fast_rope_batched call in the Helium attention path. Note added after implementation (verified against src/lib/mlxcel-core/cpp/mlx_cxx_bridge.cpp and the merged src/models/helium.rs / src/models/llama3.rs, PR feat(models): add Kyutai Helium (helium) text model support #930, 1f21b1f4c): threading the flag through the fast_rope calls is necessary but not sufficient, and this sentence should not be read as implying that every RoPE path can carry it. The two fused quantized launchers, fused_qkv_project_split_rope and fused_causal_prefill_attention, hardcode traditional = false in their C++ bodies and take no flag, so there is no way to ask them for the interleaved rotation. Routing a traditional-RoPE model through either one applies the wrong rotation to correctly shaped tensors, which nothing throws on. The shipped port therefore bypasses them rather than extending them: both fast paths are gated on !rope_traditional, so a traditional-RoPE model always takes the graph fallback, which does receive the flag. Neither fast path is enabled by default, so the gate costs nothing today.
  • Add a Helium ModelArgs/config struct (RMSNorm eps, rope_theta, head counts, head_dim, hidden/intermediate sizes, vocab, tie_word_embeddings) with serde defaults matching the upstream ModelArgs.
  • Handle tied embeddings in sanitize if the checkpoint omits lm_head.weight.

Touchpoints & acceptance criteria

Delivered and closed. Implemented by PR #930, merged as 1f21b1f4c; mlxcel arch now reports the family. Test coverage: 27 unit tests in src/models/helium_tests.rs. Real-checkpoint validation: 40 greedy tokens from the 4-bit models/helium-1-preview-2b-4bit reproduce the mlx-lm reference exactly. The checkpoint being quantized is what makes this meaningful, since traditional RoPE was at risk precisely on the quantized path. The unticked boxes below are the original pre-implementation plan and were not maintained during the work; treat the merged PR and its review thread as the record of what shipped.

Follow docs/adding-models.md. Integration is complete only when the model loads and generates from a real checkpoint.

  • Config struct with serde parse matching the upstream helium.py ModelArgs (including the traditional-RoPE flag and rope_theta).
  • from_weights builds the model (reusing the Llama/Mistral dense decoder path).
  • sanitize handles tied lm_head and any weight-key normalization.
  • Traditional RoPE wired through: fast_rope / fast_rope_batched called with traditional = true in the Helium attention path.
  • Detection arm for "helium" added in src/models/detection.rs.
  • Registration in src/model_metadata.rs via for_each_model_registration!.
  • TP/distributed arch-string wired if the dense path supports it.
  • _tests.rs unit tests (config parse, from_weights shape, a forward smoke).
  • docs/supported-models.md updated with the Helium entry.
  • Real-checkpoint validation: mlxcel arch reports the architecture and ./target/release/mlxcel generate -m models/<helium> -p "..." produces coherent output.

Correction: the real-checkpoint validation step above originally read mlxcel list, which lists downloaded checkpoints in the local model store. The architecture registry is mlxcel arch, and that is what confirms the binary knows the family.

Effort

LOW. Nearly a Llama clone; the only genuinely new behavior is the traditional-RoPE flag plus config and registration wiring.

Activity

  1. added
    type:enhancement
    priority:low
    status:ready
    area:models
    status:in-progress
    status:review
    and removed
    status:ready
    status:in-progress
    on Jul 21, 2026
  2. added
    status:done
    and removed
    status:review
    on Jul 27, 2026
  3. added a commit that references this issue on Jul 27, 2026
    1f21b1f
  4. self-assigned this
    on Aug 31, 2026
  5. added a commit that references this issue on Oct 27, 2026
    242fc0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:modelspriority:lowstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions