PyTorch and MLX reach Apple GPUs through different frameworks. PyTorch exposes the mps device; MLX provides its own array and neural-network APIs. Metal supplies Apple’s underlying graphics and compute interface. Choosing between them starts with the model and runtime you need to run.

Metal, and what MPS is built on

Apple describes Metal as a graphics and compute API coupled with a shading language, with a low-overhead model that gives direct control over each task the GPU performs. Two higher-level pieces sit above it and matter for machine learning. The Metal Performance Shaders framework provides optimised compute and graphics shaders. The Metal Performance Shaders Graph framework provides graph-based computation. Apple’s Metal page links both, alongside a page for accelerated PyTorch training on Mac.

PyTorch on the mps device

PyTorch’s own notes say the mps device enables high-performance training on GPU for macOS devices with the Metal programming framework, mapping computational graphs and primitives onto the MPS Graph framework and tuned kernels from MPS. Move a compatible tensor or module with .to("mps").

Apple’s PyTorch installation page requires Apple silicon and sets minimum macOS and Python versions for the documented release, alongside Xcode command-line tools. It describes the MPS backend as beta. PyTorch provides torch.backends.mps.is_available() to check whether the installed build can use the device; that check does not establish support for every operator in a model.

Coverage is not complete. PyTorch documents an environment variable, PYTORCH_ENABLE_MPS_FALLBACK, which when set to 1 falls back to the CPU for operations MPS does not support. If the variable is set, unsupported operations can move work to the CPU and change performance.

MLX

MLX is an array framework for machine learning on Apple silicon, brought out by Apple machine learning research. Its README lists a Python API that closely follows NumPy, plus C++, C and Swift APIs, with higher-level mlx.nn and mlx.optimizers packages whose APIs follow PyTorch. It does lazy computation, builds graphs dynamically, and supports composable function transformations for automatic differentiation and vectorisation.

Its README documents pip install mlx for macOS and, on Linux, pip install mlx[cuda] for a CUDA backend or pip install mlx[cpu] for a CPU-only package.

The design point that separates it from the others is unified memory. The README calls this a notable difference from other frameworks: arrays live in shared memory, and operations on them can run on the CPU or the GPU without transferring data.

Running language models with MLX is a separate package, mlx-lm, with its own install and server commands. That is covered on our MLX page rather than repeated here.

Where the serving runtimes stand

llama.cpp enables Metal by default on macOS, per its build guide, which also documents -DGGML_METAL=OFF to disable it at compile time and runtime controls for GPU-layer placement. Its release builds include macOS arm64 and x64 binaries.

vLLM does not run natively on Apple GPUs. Its Apple silicon page points instead to vLLM-Metal, which it describes as a community-maintained hardware plugin using MLX as the compute backend and providing GPU acceleration through Metal. The requirements given are macOS Sonoma or later, Apple silicon and Metal support, and it is documented as working with MLX-format models from the mlx-community organisation on Hugging Face. The main vLLM installation page also lists Apple silicon under CPU support as a separate option.

llama.cpp’s Vulkan instructions include a macOS path, where the Vulkan drivers available are translation layers onto Metal, either MoltenVK or KosmicKrisp, selected with VK_ICD_FILENAMES. The build for that case turns Metal off.

FAQ

Should I use MPS or MLX on a Mac?

If your code is already PyTorch, mps is the smaller change. If you are running language models locally and want Apple silicon treated as the primary target, MLX and mlx-lm are built for it, including quantised weights from mlx-community.

Does PyTorch MPS work on Intel Macs?

Apple’s requirements list a Mac with Apple silicon. The MPS availability message in PyTorch refers to macOS 14.0 or later and an MPS-enabled device.

Can I serve models with vLLM on a Mac GPU?

Only through vLLM-Metal, a community-maintained plugin that uses MLX underneath, per vLLM’s Apple silicon documentation. The core project’s GPU support covers CUDA, ROCm and Intel XPU.

Why is my model slower on mps than expected?

Unsupported operations can fall back to the CPU. PyTorch documents PYTORCH_ENABLE_MPS_FALLBACK=1 as the switch that enables that fallback, so check whether it is set and which operations are hitting it.