Executable programs and extensions

Run local AI with MLX on Apple Silicon: frameworks and model tools explained

Check the chip and checkpoint before running a model with MLX on Apple silicon

MLX1 is a framework for computing AI models on Apple Silicon CPUs and GPUs. To use a language model in conversation, pass a compatible model and a question to a tool such as MLX-LM2. This guide explains how to check your Mac and model format, then choose a tool.

Running a language model requires matching the Mac's chip with the file format in the model repository. This guide covers loading an MLX checkpoint3 with MLX-LM on Apple silicon and starting a short conversation.

Requirements and key details
  • MLX is the compute framework; MLX-LM is the language-model runtime tool.
  • Even though CPU and GPU share unified memory, the OS, apps, weights, and KV cache all use it.
  • CUDA code and Intel Macs do not automatically switch to the MLX path.

Distinguish MLX from the tools around it

MLX-LM is a Python package that uses MLX for language-model inference and fine-tuning. Load a model, enter a question, and it generates an answer. Choose a compatible checkpoint with the required model implementation and configuration.

Metal4 is macOS technology for parallel GPU5 computation and underlies MLX on Mac. PyTorch MPS6 is a backend for using Apple GPUs from PyTorch7, so model packages and execution paths differ. GUI apps such as LM Studio are another option; check supported formats and controls for the specific app version.

A desk with a notebook, turned laptop, metal ruler, hand tools, and closed file
Framework, model tool, and GPU foundation are separate layers.

Choose an installation path for the Mac chip

MLX's Mac installation and optimization assume Apple silicon. Check About This Mac for an M-series chip. The same commands do not follow the same path on Intel Macs, so compare llama.cpp tools or GUI engines that explicitly support Intel.

Changing .to("cuda8") or an NVIDIA device setting to mlx does not make CUDA code run on Mac. The MLX project also documents a separate Linux CUDA backend, but it does not automatically convert PyTorch CUDA models, extensions, or operations to MLX. Check model implementation, weight format, kernels, and dependencies individually.

A model may load successfully but run out of memory with longer input. MLX-LM memory and speed settings explains how to adjust quantization9 and the KV cache10.

Three work areas with two laptops and a desktop showing a graphics card
Choose model files and runtime paths that match the chip.

Account for non-model use of unified memory

Apple Silicon CPUs and GPUs share physical memory. MLX arrays use it to reduce copies between CPU11 and GPU. macOS, apps, model weights, intermediate computations, and the growing conversation KV cache all use the installed memory.

A 24 GB Mac cannot devote all 24 GB to weights. Long inputs need working space during processing, and the KV cache grows during generation. Quantization can reduce weight size but does not remove loading workspace, computation memory, or cache. Check headroom with the applications you actually use rather than relying on file size alone.

Blocks divided among a tray and small bowls beside a closed laptop
The operating system and running apps use the same memory pool.

Check the model card and MLX-LM support

Find an MLX checkpoint on the Hugging Face model card and check the architecture in MLX-LM's support list. Start with a short text generation. For community conversions, also check the conversion date, original model version, tokenizer configuration, and license.

Some models may require custom tokenizer code or permission to run repository code. Review the source and code before enabling that permission; test image input and tool calling separately from basic generation on the current version.

Choose a terminal, GUI, or PyTorch path for the task

MLX-LM is a starting point for directly loading a model from Python or testing it quickly. If you want to select models and manage APIs and conversation history in a visual interface, compare GUI apps that offer an MLX engine. A GUI using MLX does not necessarily expose every MLX-LM option or model.

For an existing PyTorch project, first check whether its model and code run on MPS. The same Mac does not determine a performance ranking: model implementation, operations, library version, input length, and memory state all matter. For comparison, align model family, quantization, and input/output lengths, and record runtime12 differences.

To move a CUDA project to Mac, first look for an MLX checkpoint and example; if none exists, retain the CUDA environment or find another supported runtime. For image or audio models, do not infer support from MLX-LM documentation; check the relevant ecosystem tool.

Terminology notes

  1. MLX — Apple’s machine-learning framework, which runs models using memory shared by the CPU and GPU on Apple Silicon.

    Back to the text
  2. MLX-LM — A package for loading, running, and fine-tuning language models with MLX.

    Back to the text
  3. Checkpoint — A file containing saved model weights and related state. Versions or tasks in one model family may use different checkpoints.

    Back to the text
  4. Metal — Apple’s low-level technology for graphics and parallel GPU computation.

    Back to the text
  5. GPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.

    Back to the text
  6. PyTorch MPS — The PyTorch backend for computation on Apple GPUs. Required operations and models must be supported on MPS.

    Back to the text
  7. PyTorch — A software framework for building and running AI models. Check the compatible PyTorch version and hardware support along with the model.

    Back to the text
  8. CUDA — A software platform for general-purpose computing on NVIDIA GPUs.

    Back to the text
  9. Quantization — A way to represent model weights or values with fewer bits, reducing storage and memory use. The coarser representation can also affect accuracy.

    Back to the text
  10. KV cache — Memory that stores attention keys and values from earlier tokens for reuse during later token generation. Its size depends on context length and batch size.

    Back to the text
  11. CPU — The central processor that runs the operating system and general-purpose instructions; in AI workloads it also handles tasks such as preprocessing and data movement.

    Back to the text
  12. Runtime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.

    Back to the text

Frequently asked questions

What should you check first in this article?
MLX is a framework for computing AI models on Apple Silicon CPUs and GPUs. To use a language model in conversation, pass a compatible model and a question to a tool such as MLX-LM. This guide explains how to check your Mac and model format, then choose a tool.
How much memory does it need?
A model may load successfully but run out of memory with longer input. [MLX-LM memory and speed settings](/guides/mlx-lm-memory-speed-guide) explains how to adjust quantization and the KV cache.
Where can you check the conditions and sources?
Find an MLX checkpoint on the Hugging Face model card and check the architecture in MLX-LM's support list. Start with a short text generation. For community conversions, also check the conversion date, original model version, tokenizer configuration, and license.