Guides · 2026-10-13

LoRA fine-tuning on a Mac with mlx_lm.lora

QLoRA fine-tune a model on Apple Silicon with mlx-lm: data format, training, fusing and serving, with RAM guidance.

Researched and drafted with AI assistance from the cited sources. Benchmarks are single-machine third-party results: treat them as indicative, not guaranteed.

What fits

Rough capacity for QLoRA on a Mac: 16 GB → 8B (about an hour), 32 GB → 14B, 64 GB → 32B. Unsloth and Axolotl are CUDA-only, so on a Mac use mlx-lm, or mlx-tune (formerly unsloth-mlx), which offers an Unsloth-compatible API with SFT/DPO/GRPO and GGUF export.

Install

pip install "mlx-lm[train]"

Data

Put train.jsonl and valid.jsonl in a folder. Each line is one example, for example chat format:

{"messages": [{"role": "user", "content": "Q"}, {"role": "assistant", "content": "A"}]}

Fine-tuning needs safetensors / MLX weights, not GGUF.

Train

If you point mlx_lm.lora at a quantized model, it does QLoRA automatically:

mlx_lm.lora \
  --model <hf-or-local-4bit-mlx-model> \
  --train \
  --data ./data \
  --iters 600 \
  --batch-size 1 \
  --adapter-path ./adapters

LoRA is the default. DoRA and full fine-tuning are also supported (--fine-tune-type). If you run out of memory, lower --batch-size, reduce --num-layers, or use a smaller model.

Test, fuse, serve

mlx_lm.generate --model <model> --adapter-path ./adapters --prompt "Q"
mlx_lm.fuse --model <model> --adapter-path ./adapters --save-path ./fused
mlx_lm.server --model ./fused

mlx_lm.fuse merges the adapter into the base weights. Check mlx_lm.lora --help for the current flags in your installed version.

Sources

  1. https://github.com/ml-explore/mlx-lm/blob/main/mlx_lm/LORA.md
  2. https://insiderllm.com/guides/fine-tuning-mac-lora-mlx/
  3. https://github.com/ARahim3/mlx-tune

Skip the trial and error: sourced config packs →

Get the weekly Mac local-AI digest

New models, tool updates, and sourced configs. Free. Unsubscribe anytime.

Launching soon. Follow along via RSS in the meantime.