AIAny
AI Train2023
GitHub

MLX Examples

Collection of runnable model implementations — LLaMA, Mistral, Stable Diffusion, Whisper, CLIP, plus LoRA fine-tuning — ported to the MLX array framework so they run natively on Apple silicon's unified memory rather than CUDA.

Introduction

Most model zoos assume an NVIDIA GPU and carry a CUDA mental model with them. This repository exists for the opposite case: it shows what idiomatic model code looks like when the backend is MLX and the CPU and GPU share a single pool of unified memory. The examples are teaching artifacts, not packaged products — each is a minimal, readable port of a well-known architecture that runs on a MacBook with no driver setup.

What Sets It Apart
  • Breadth doubles as a learning map. Text (LLaMA, Mistral, T5, BERT), image (Stable Diffusion, FLUX), audio (Whisper, EnCodec, MusicGen), and multimodal (CLIP, LLaVA, Segment Anything) sit side by side, so you can compare how one framework expresses very different architectures.
  • It shows MLX's defining traits in context. Lazy array evaluation and unified memory mean tensors aren't copied between host and device; the code reads like NumPy but executes on the GPU, which is the whole reason to study these instead of CUDA equivalents.
  • LoRA fine-tuning marks the practical edge. Beyond inference, the LoRA example fine-tunes an LLM locally, making clear what is actually feasible on consumer Apple hardware versus what still needs a data center.
  • It is the canonical reference from the framework's own authors, so the patterns track MLX's API as it evolves rather than drifting like third-party tutorials.
Great Fit / Look Elsewhere

Great fit if you own Apple silicon and learn frameworks best by reading short, complete model implementations, or want a starting point to adapt a known architecture to MLX. Look elsewhere if you need production training pipelines, multi-GPU or cluster distribution, or portability to NVIDIA hardware — these are intentionally minimal single-machine examples, and heavier LLM workflows have largely moved to the separate mlx-lm package.

Information

  • Websitegithub.com
  • OrganizationsApple
  • Authorsml-explore, Awni Hannun, Jagrit Digani, Angelos Katharopoulos, Ronan Collobert
  • Published date2023/11/28

Categories

More Items

Hugging Face
AI Model2026

Fine-tunes Inkling-2-Mini with reinforcement learning for the pi coding agent, reducing tool calls and generated tokens. It improves Terminal-Bench 2.1 results under a one-hour limit, while matching the base model roughly when given more time.

Hugging Face
AI Model2026

Fine-tunes Inkling-2-Mini to draft natural-sounding X posts from short prompts, alongside an ensemble for distinguishing human and AI-written text. The author reports 92.6% ROC-AUC on held-out authors.

Hugging Face
AI Model2026

Uses reinforcement learning alone to improve Qwen3.8-27B on multimodal reasoning and long-horizon agent tasks. Trained on about 1,200 curated tasks, it retains a 256K context and is released in BF16, FP8, and NVFP4.