AIAny
AI Train2023
Icon for item

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

GitHub
AI Train2025

An asynchronous, high-throughput framework for large-scale reinforcement learning and agentic training that scales to 1T+ MoE models and 1000+ GPUs, with native verifiers integration, end-to-end SFT/RL/evals, and Slurm/Kubernetes deployment; requires NVIDIA GPUs.

GitHub
AI Agent2026

Trains reusable natural-language 'skills' for frozen LLM agents by optimizing the skill document in text-space — using trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts. Multi-backend, zero inference-time cost at deployment, designed for iterative, validation-led skill improvement.

GitHub
AI Train2023

Modular PyTorch-based framework for building, training, and deploying physics-informed ML models (neural operators, PINNs, GNNs, diffusion). Provides GPU‑optimized training, domain-specific datapipes for meshes/point clouds, distributed scaling and a model zoo.