LoRA fine-tuning on your Mac

LoRA fine-tuning is available in Rapid-MLX 1.1.3 and newer.

Fine-tune a text model locally on Apple Silicon with rapid-mlx finetune (alias rapid-mlx lora). Quantized MLX checkpoints use QLoRA.

Train and serve an adapter

To try the workflow, put at least two rows in examples.jsonl using one of the formats below. Use representative data when fine-tuning for your task.

rapid-mlx finetune qwen3-0.6b-4bit --data ./examples.jsonl --out ./my-adapter --iters 10 --batch-size 1 --num-layers 4 --max-seq-length 512

When training succeeds, Rapid-MLX prints the serve command. For this example, run:

rapid-mlx serve qwen3-0.6b-4bit --adapter ./my-adapter --port 8613

Qwen3.5 training measurements

These measurements were taken on an M3 Ultra with 4-bit weights, 16 adapted layers, and a maximum sequence length of 1,024 tokens, using training rows that fill it. Steps/s is the steady-state rate; the first two stock steps run at about 0.05 while compiling.

CheckpointBatchPathPeak memorySteps/s
Qwen3.5-9B1Stock mlx-lm 0.31.385.9 GB0.11
Qwen3.5-9B1Native gated delta15.4 GB0.45
Qwen3.5-9B4Native gated delta35.2 GB0.11
Qwen3.5-27B1Native gated delta26.3 GB0.20
Qwen3.5-27B2Native gated delta36.6 GB0.10

Stock mlx-lm 0.32.2, the latest release, peaked at the same 85.9 GB. Shorter rows use less memory on both paths. Method and commands.

Data formats

Supply a JSONL file or a directory with train.jsonl and valid.jsonl. Use the same format across all splits, including test.jsonl if present, with one JSON object per line.

Chat

{"messages":[{"role":"user","content":"Say hello"},{"role":"assistant","content":"Hello!"}]}

Prompt and completion

{"prompt":"Say hello","completion":"Hello!"}

Plain text

{"text":"Hello from a local model."}

Training defaults

When telemetry is enabled, the completion event contains the outcome, elapsed time and row-count buckets, and whether preflight accepted a validation split you supplied.

Checkpoint and serving limits

Choose an mlx-lm text checkpoint that supports LoRA, such as qwen3-0.6b-4bit, or a dense Qwen3.5 checkpoint such as qwen3.5-9b-4bit or qwen3.5-27b-4bit. Use checkpoints from sources you trust, since mlx-lm allows custom tokenizer code.

For dense Qwen3.5, serve --adapter automatically loads the text backbone. Image inputs return HTTP 400. Adapter serving disables speculative decoding and requires a base checkpoint without MTP draft tensors. See the serve CLI reference.

Troubleshooting

Connect Codex

With Codex installed, run the following in a second terminal. Agent setup writes the local server and adapter model ID to the Codex config.

rapid-mlx agents codex --setup --base-url http://127.0.0.1:8613/v1
codex