C.W.K.
Stream
Lesson 01 of 06 · published

What MLX Actually Is

~14 min · mlx, introduction, philosophy

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

The marketing sentence vs the architectural sentence

Marketing copy will tell you MLX is "Apple's machine learning framework, optimized for Apple Silicon, with NumPy-like APIs and lazy evaluation." That's a true sentence. It's also a useless one — every framework's marketing reads like that. Let me give you the architectural sentence instead.

MLX is an array library that treats unified memory as the default world, and treats separate-GPU-memory architectures as the special case. That's the actual differentiator. Every other choice — the lazy graph, the function transforms, the close kinship with NumPy — is downstream of that one decision.

The boring facts (so we can move on)

MLX shipped publicly in December 2023. As of this lesson's verification stamp (2026-05-03), the current versions are:

  • mlx 0.31.x — the core array library, MIT-licensed
  • mlx-lm 0.31.x — the language-model serving stack on top
  • Plus: mlx-vlm, mlx-audio, the mlx-community Hugging Face org, the mlx-examples reference repo

It's an Apple research project — open source, but driven by Apple's ML research team. The framework has Python, Swift, C++, and C bindings. We'll use Python throughout this quest, because that's where every other AI tool you'll meet expects to live.

The one thing that makes it not "just another array library"

NumPy taught you arrays. PyTorch taught you arrays-with-gradients. JAX taught you arrays-with-function-transforms. MLX teaches you arrays where the GPU and the CPU are reading the same bytes at the same moment. No device='cuda:0'. No tensor.to(device). No "did I forget to move this to GPU?" debugging.

That sounds like a small detail. It is not. The next lesson is dedicated to it, because everything else MLX does is shaped by it. For now, just hold the shape: the array lives in memory both processors can see, and that fact is the framework's design center, not a feature buried somewhere in the docs.

What this quest is actually for

Eight tracks. Fifty-one lessons. We'll go from "what's installed" through "I can fine-tune a Llama on my Mac and serve it through an OpenAI-compatible endpoint" — with every code block re-run on current MLX so you don't inherit the polite hallucinations LLMs generate when asked to write MLX code. (That last problem gets a whole lesson — see compare.lesson5.)

Verifying the version on your machine

Before any lesson asks you to type import mlx.core as mx, the version check below tells you whether you're holding the same MLX I verified this quest against. If you're significantly behind, run pip install -U mlx mlx-lm in your env first — MLX is fast-moving on purpose, and you want the latest.

Code

Quick version check (run inside your `mlx` conda env)·bash
# In a clean conda env on Apple Silicon
conda activate mlx

python -c "import mlx.core as mx; print('mlx:    ', mx.__version__)"
python -c "import mlx_lm;        print('mlx-lm: ', mlx_lm.__version__)"
python -c "import platform;      print('python: ', platform.python_version(), platform.machine())"

# Expected (verified 2026-05-03):
#   mlx:     0.31.2
#   mlx-lm:  0.31.3
#   python:  3.11.9 arm64
Your first MLX array — note what's missing·python
import mlx.core as mx

a = mx.array([1.0, 2.0, 3.0, 4.0])
print(a)
print("dtype:  ", a.dtype)
print("shape:  ", a.shape)

# No device argument. No .to('cuda') / .to('mps').
# The default device IS the unified memory the GPU and CPU share.
print("device: ", mx.default_device())   # → Device(gpu, 0)  on Apple Silicon

External links

Exercise

Open a Python REPL in your mlx env and answer three questions in your own words, two sentences each — no need to write them up, just be able to say them out loud. (1) What does mx.default_device() return on your Mac, and what does that tell you about CPU/GPU separation? (2) Run pip show mlx mlx-lm — what versions are you on, and how does that compare to the verification stamp in this quest's meta.json? (3) If you pip install MLX into a Rosetta x86 Python env (don't actually — just imagine), what error do you predict and why? Lesson 2 of this track will confirm your guess.

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.