C.W.K.
Stream
Lesson 04 of 07 · published

Architectures mlx-lm Already Speaks

~12 min · architectures, llama, qwen, mistral

Level 0Curious
0 XP0/51 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

The supported list, briefly

mlx-lm dispatches to the right code path for a model based on the architecture name in the model's config.json. As of 2026-05 (mlx-lm 0.31.3), the package ships implementations for over 100 architectures — every mainstream open-weights LLM family you'd expect, plus a long tail of variants and forks.

You don't need to memorize this list. You need to know two things — how to check whether a given Hugging Face model will Just Work with mlx-lm, and what to do when the answer is no.

The biggest families you'll actually use

  • llama familyllama, llama3, llama4_text. Meta's open-weights line, and the de-facto baseline architecture that many derivatives reuse. If a model claims to be "Llama-shaped," mlx-lm probably loads it.
  • qwen familyqwen, qwen2, qwen2_vl, qwen3, qwen3_vl, qwen3_moe, qwen3_next. Alibaba's competitive open-weights line; very actively supported.
  • mistral familymistral, mistral3, mixtral. Mistral AI's models, including the MoE variant.
  • phi familyphi, phi3, phi3small, phimoe, phixtral. Microsoft's small-but-strong line.
  • gemma family — Google's open-weights line, multiple sizes.
  • deepseek — frontier-quality reasoning models.
  • mamba / mamba2 / ssm / rwkv7 — state-space and RNN-style alternatives to the transformer; smaller communities but supported.

How to check before you download

For a Hugging Face repo with config.json, the model_type field tells you the architecture name. If that name is in mlx-lm's models/ directory, the model loads. The code block below is the inspector — peek at mlx_lm.models to list every architecture mlx-lm ships, and then check a candidate model against that list.

What to do when the architecture isn't supported yet

  1. Check if there's a recent issue or PR on ml-explore/mlx-lm. New mainstream models usually get a PR within days.
  2. Look for an MLX-format conversion on the mlx-community org — sometimes the community has already adapted the architecture name to a supported one.
  3. Wait or contribute. mlx-lm's release rhythm is fast (lesson 6 of foundations); a missing architecture is rarely missing for long.

Code

List every architecture mlx-lm currently ships·python
import os
import mlx_lm.models as m

ARCH_DIR = os.path.dirname(m.__file__)
NON_ARCH = {"base", "cache", "switch_layers", "rope_utils"}

archs = sorted(
    f.replace(".py", "")
    for f in os.listdir(ARCH_DIR)
    if f.endswith(".py") and not f.startswith("_") and f.replace(".py", "") not in NON_ARCH
)

print(f"mlx-lm supports {len(archs)} architectures (as of {m.__file__.split('/')[-3]}):")
for a in archs:
    print(f"  - {a}")

# Verified count (2026-05-03, mlx-lm 0.31.3): 114 architectures
Check a Hugging Face model's config.json before downloading·python
# Read the architecture name from a model's config.json on Hugging Face
# without downloading the weights. Uses the public HF API.
from huggingface_hub import hf_hub_download
import json

def model_arch(repo_id):
    path = hf_hub_download(repo_id=repo_id, filename="config.json")
    with open(path) as f:
        cfg = json.load(f)
    return cfg.get("model_type"), cfg.get("architectures", [])

print(model_arch("mlx-community/Llama-3.2-1B-Instruct-4bit"))
# → ('llama', ['LlamaForCausalLM'])

print(model_arch("mlx-community/Mistral-7B-Instruct-v0.3-4bit"))
# → ('mistral', ['MistralForCausalLM'])

External links

Exercise

Run the architecture-listing block. Then pick three Hugging Face models you've seen recommended elsewhere — mainstream or niche — and use the model_arch helper to check their model_type against the supported list. For each, predict whether load() would succeed before you actually try it. The point of the exercise is to retire the question "will this work in MLX?" by giving yourself a 30-second answer.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.