Skip to content

OpenELM

Model guide index

Overview and status

Registry type: openelm. The native decoder uses layer-specific attention-head counts and feed-forward widths, fused QKV, GQA, RoPE, and RMSNorm. apple/OpenELM-270M is an upstream reference and the supported primary checkpoint, with passing native generation and applicable interface records. Other sizes remain separate profiles. See the current support record.

Model Architecture

The diagram follows the native implementation. Layer counts, widths, head counts, and input sizes come from the checkpoint configuration; this is an architecture map, not an additional support or qualification claim.

Token IDs → token embeddings
    ↓
┌────────────────── Layer i (checkpoint-defined widths) ──────────┐
│ RMSNorm → fused QKV → optional Q/K norm → GQA + RoPE → add      │
│ RMSNorm → feed-forward (optional gated form)         → add      │
│ Query/KV head counts and feed-forward width vary by layer       │
└─────────────────────────────────────────────────────────────────┘
    ↓
Final RMSNorm → tied/untied LM head → next-token logits

Papers and upstream references

Paper: OpenELM: An Efficient Language Model Family with Open Training and Inference Framework.

Installation and assets

Install python -m pip install -e . from the repository root using Python 3.10+. Execution needs Apple Silicon/Metal. Supply the actual OpenELM config.json and complete safetensors weights/index. The text loader requires tokenizer.json; an external compatible tokenizer can be supplied through tokenizer_source. The current adapter does not load a SentencePiece .model alone. Obtain the publisher-recommended tokenizer assets, including any required access authorization.

Inspection and completion

mlx-one inspect apple/OpenELM-270M

This example uses two prepared local directories; replace both paths. The checkpoint must satisfy the native weight contract, and tokenizer IDs must match the checkpoint vocabulary. It is not a recorded integration result.

from mlx_one import TextGenerationOptions, generate, load_text_model

bundle = load_text_model(
    "/path/to/OpenELM-270M",
    tokenizer_source="/path/to/compatible-tokenizer",
    offline=True,
)
result = generate(
    bundle,
    "The advantages of running models locally include",
    options=TextGenerationOptions(max_tokens=32),
)
print(result.text)

Base models take completion text. Use stream_chat only with an appropriate instruction checkpoint/template; a generic chat fallback is not evidence that a base model was instruction tuned. The generate CLI currently has no --tokenizer-source option; use the Python loader when tokenizer assets are separate.

Settings, cache, and troubleshooting

  • Preserve per-layer dimensions from the config. Treating OpenELM as a uniform Llama layout can produce invalid QKV and FFN shapes.
  • Dense KV is the baseline; block KV is restricted to dense Qwen2/Qwen2.5.
  • Read context length from the checkpoint and qualify memory independently.
  • Missing tokenizer.json requires compatible exported tokenizer assets, not remote-code execution. Verify BOS/EOS IDs before interpreting output.
  • Native config support does not qualify checkpoint training, parity, or quality.

Implementation and validation

See configuration, model, weights, architecture tests, and synthetic Metal tests.

pytest -q tests/test_native_openelm_architecture.py
MLX_ONE_RUN_MLX_TESTS=1 pytest -q tests/test_native_openelm_mlx.py

See the candidate catalog for release qualification.


Edit this page