mlx-optiq
Guide · Fine-tuning

Fine-tune on your Mac

Turn a folder of your own material into a model that answers the way you want, and run it, without leaving your Mac.

Everything on these pages ships in the free mlx-optiq package. Training is LoRA on top of an OptiQ quant, MLX-native, with no PyTorch and no rented GPU. Each step works from the command line or from OptiQ Lab, the local web UI, and the two share one engine and the same defaults. Click a step to open its guide.

Fine-tuning pipeline: your files, dataset, LoRA SFT, optional DPO, compare, export, serve. A quantized base feeds training and the export.01Your filesnotes, code, CSV02Datasettrain + valid03LoRA SFTyour answers04DPOoptional05Comparebase vs tuned06Exportone folder07ServeOpenAI APIQuantized basea published OptiQ quant, or optiq convertsame base, bundled Fine-tuning pipeline, seven steps top to bottom, with a quantized base feeding training and the export.Your filesnotes, code, CSV01Datasettrain + valid02LoRA SFTyour answers03DPOoptional04Comparebase vs tuned05Exportone folder06ServeOpenAI API07QuantizedbaseOptiQ quant
The pipeline. Training and serving both use the same quantized base; the adapter is the only thing you train.

The guides

  1. Build a training set from your files. Notes, a code folder or a CSV of preferences, turned into train.jsonl and valid.jsonl by a Lab template.
  2. LoRA SFT on Apple Silicon. One command, method-aware defaults, and what to change when memory runs short.
  3. DPO on top of an SFT adapter. Teach the model which of two answers you prefer, starting from your SFT weights.
  4. Compare tuned and base in the Arena. One prompt, two panes: the base model and the base with your adapter.
  5. Quantize and serve the tuned model. Pick or build the quantized base, bundle the adapter with it, and serve it over the OpenAI and Anthropic APIs.
  6. Fine-tune a decision model. Typed questions in, a probability per option out, with no text to parse.
  7. NEFTune and early stopping. Two optional flags for small datasets: embedding noise during SFT, and stopping when validation loss stalls.
  8. Gemma 4 specifics. Which size to train on which Mac, the MoE recipe, and sampling for the check afterwards.

The short version

terminalbash
$ pip install mlx-optiq

# Build the dataset in the browser (Build dataset), or write the JSONL yourself
$ optiq lab

# Train a LoRA on a published OptiQ quant
$ optiq lora train mlx-community/Qwen3.5-4B-OptiQ-4bit \
    --data ./my_data -o ./my_adapter

# Bundle base + adapter into one folder and serve it
$ optiq lora export mlx-community/Qwen3.5-4B-OptiQ-4bit \
    --adapter ./my_adapter -o ./my-model
$ optiq serve --model ./my-model

What you need

  • A Mac with Apple Silicon. Small models are the place to start: a Qwen3.5 0.8B to 4B quant, or Gemma 4 E2B or E4B.
  • Memory sets how long a training example can be. On a 24 GB M4, Qwen3.5-4B trains at 8k context with a peak of about 14.4 GB; the training-ceiling map has the measured numbers.
  • A few hundred good examples beat thousands of noisy ones. The trainer defaults are set for small sets: three epochs for SFT, one for DPO.

CLI or Lab

StepCommand lineOptiQ Lab
Datasetwrite JSONLBuild dataset
SFT, DPOoptiq lora trainFine-tune
Combine adaptersoptiq lora mergeFine-tune, last step
Compareserve both and askArena
Quantize a baseoptiq convertQuantize
Bundle, serveoptiq lora export, optiq serveFine-tune, last step

The flag-by-flag reference for the trainer is the LoRA reference. What these pages cover is LoRA (or DoRA, with --use-dora) adapters on text and decision models; full-weight training is not part of OptiQ.