본문 바로가기
C.W.K.
Stream
Lesson 04 of 07 · published

mlx-lm이 이미 알아듣는 모델 구조들

~12 min · architectures, llama, qwen, mistral

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

지원 목록은 길고, 확인법은 짧아

mlx-lm은 모델의 config.json에 적힌 구조 이름을 읽고 알맞은 코드로 보내. 2026-05의 mlx-lm 0.31.3은 100개가 넘는 모델 구조 구현을 담고 있어. 널리 쓰는 공개 가중치 LLM 계열은 물론이고 수많은 변형과 갈래까지 포함해.

목록을 외울 필요는 없어. Hugging Face 모델이 그대로 동작할지 확인하는 법과, 아직 지원하지 않을 때 무엇을 할지만 알면 돼.

자주 만날 큰 계열

  • llama 계열llama, llama3, llama4_text. Meta의 공개 가중치 계열이고 수많은 파생 모델이 재사용하는 사실상의 기준 구조야. Llama 방식이라고 밝힌 모델은 mlx-lm이 불러올 가능성이 높아.
  • qwen 계열qwen, qwen2, qwen2_vl, qwen3, qwen3_vl, qwen3_moe, qwen3_next. Alibaba의 경쟁력 있는 공개 가중치 계열이고 지원도 매우 활발해.
  • mistral 계열mistral, mistral3, mixtral. Mistral AI의 모델과 MoE 변형이 들어 있어.
  • phi 계열phi, phi3, phi3small, phimoe, phixtral. Microsoft의 작지만 강한 모델들이야.
  • gemma 계열 — 여러 크기로 나온 Google의 공개 가중치 계열이야.
  • deepseek — 최전선급 추론 모델이야.
  • mamba / mamba2 / ssm / rwkv7 — Transformer 대신 상태 공간이나 RNN 방식을 쓰는 대안이야. 커뮤니티는 더 작아도 지원돼.

받기 전에 30초만 확인해

Hugging Face 저장소의 config.json에서 model_type을 보면 모델 구조 이름이 나와. 같은 이름의 구현이 mlx-lm의 models/ 디렉터리에 있으면 불러올 수 있어. 아래 코드는 mlx_lm.models를 살펴 현재 제공하는 모든 구조를 나열하고 후보 모델이 목록에 있는지 확인해.

아직 지원하지 않는다면

  1. ml-explore/mlx-lm의 최근 이슈와 PR을 찾아. 널리 쓰이는 새 모델은 보통 며칠 안에 PR이 올라와.
  2. mlx-community 조직에서 MLX 형식 변환본을 찾아. 커뮤니티가 구조 이름을 이미 지원되는 방식으로 맞춘 경우가 있어.
  3. 기다리거나 직접 기여해. 기초 트랙 레슨 6에서 봤듯 mlx-lm은 빠르게 새 버전을 내서 빠진 구조가 오래 남는 경우는 드물어.

Code

mlx-lm이 현재 제공하는 모든 모델 구조·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
받기 전에 Hugging Face 모델의 config.json 확인·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

모델 구조 목록 코드 블록을 실행해. 이어서 다른 곳에서 추천받은 Hugging Face 모델 세 개를 골라. 널리 쓰이는 모델과 틈새 모델 어느 쪽도 좋아. model_arch 도우미로 각 model_type이 지원 목록에 있는지 확인하고, 실제로 시도하기 전에 load()가 성공할지 예측해. "이 모델이 MLX에서 될까?"라는 질문을 30초 안에 답하는 습관을 만드는 게 목적이야.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.