Skip to content

Apple Silicon MLX Backend

Soup v0.25.0 added a native MLX training backend for M1 to M4 Macs, running on unified memory without CUDA, Rosetta, or x86 emulation. Since v0.77.1 it trains six tasks: supervised fine-tuning through mlx-lm's tuner, DPO, ORPO, SimPO and KTO through Soup's own MLX loop (v0.77.0), and GRPO through Soup's own generation loop (v0.77.1). Since v0.77.2 the unified task: preference also runs on MLX when training.preference_loss is dpo, orpo or simpo (a second spelling of those native tasks, not a seventh one), and GRPO also trains on a 4-bit mlx-community base. Every other task, and ipo, bco or a preference_loss_weights blend under task: preference, is refused at config load. See the table below. Upstream covers the v0.77.2 preference spelling and 4-bit GRPO only with its hosted macOS MLX test job; it did not exercise them by hand before the release. Since v0.77.1 soup infer --backend mlx also generates from an MLX base or a native adapter without Torch (see Native MLX generation).

Since v0.78.0 native MLX text SFT also trains every weight of a dense Llama model (lora.r: 0), takes vocabulary expansion, linear RoPE extension, two selective loss masks and an existing pre-tokenized cache, and soup chat --backend mlx and soup merge --backend mlx chat with and fuse a native adapter. See Dense full fine-tuning on MLX, More text-SFT settings on MLX and Native MLX chat and fusion. Upstream covers every one of them only with its hosted macOS MLX test job and fixtures: it did not exercise them by hand on Apple Silicon before the release. No MLX speed, memory or time figure exists for any of them, and this page prints none.

Install

bash
pip install "soup-cli[mlx]"

This pulls mlx>=0.31.2 and mlx-lm>=0.31.3 as optional dependencies. The mlx-lm floor was raised in v0.73.1, to the version the MLX supervised path is actually built against. The mlx floor itself was mlx>=0.20 through v0.77.2, a floor the extra could never install on macOS (#2471, fixed by @Sofia5050 in #2779).

Enable the backend

Set backend: mlx in soup.yaml. It is a config key only: soup train has no --backend flag (--backend belongs to soup serve). A minimal config:

yaml
base: mlx-community/Llama-3.1-8B-Instruct-4bit
backend: mlx
task: sft

data:
  train: data.jsonl
  format: chatml

training:
  epochs: 3
  lr: 1e-4
  batch_size: 2
  lora:
    r: 16
    alpha: 32

For a preference task on the same backend, see Preference training on MLX below, and for GRPO see GRPO on MLX.

Supported tasks

TaskMLXNotes
sft✓mlx-lm's tuner. LoRA, QLoRA on pre-quantized mlx-community 4-bit models, and native DoRA since v0.77.0. Since v0.78.0 also a dense Llama full fine-tune (lora.r: 0), vocabulary expansion, linear RoPE extension, two selective loss masks and an existing token cache, each with the conditions below
dpo✓Since v0.77.0. Soup's own MLX loop, TRL's sigmoid loss with training.dpo_beta; reference log-probs precomputed once from the base, so no second model is loaded
orpo✓Since v0.77.0. TRL 0.29.1's ORPO objective with training.orpo_beta; no reference model
simpo✓Since v0.77.0. TRL 0.29.1's CPO simpo loss, beta fixed at 0.1 as on the transformers backend, with simpo_gamma and cpo_alpha; no reference model
kto✓Since v0.77.0. TRL 0.29.1's KTO objective with training.kto_beta; reference precomputed once from the base; batch_size 2 or more, as on every backend
preference✓ for dpo, orpo, simpoSince v0.77.2 (#2333, by @vaputa). task: preference with training.preference_loss: dpo, orpo or simpo runs the native trainer of that name, with the same load-time refusals and the same doctor table. ipo, bco and any preference_loss_weights blend are refused at load. See Preference training on MLX. Through v0.77.1 the whole task was refused (tracked as #2202)
grpo✓Since v0.77.1. Soup's own loop: it generates completions from the current policy, scores them with the built-in accuracy or format reward and takes one policy-gradient step per update, on the objective Soup's transformers path trains on TRL 0.29.1. LoRA on a dense text base, or since v0.77.2 on a base pre-quantized by mlx-lm at 4 bits in affine mode (mlx-community/...-4bit). See GRPO on MLX
ppo, ipo, bco, online_dpo, reward_model, embedding, pretrain and the rest–Refused at config load, with an error naming the task. Use backend: transformers

Through v0.76.1 the backend ran sft and nothing else: every other task, DPO included, was refused at config load because mlx-lm ships no training helper for them. Through v0.77.0 GRPO was refused too. (Since closed in v0.77.1: task: grpo trains on MLX, #2182. Since closed in v0.77.2: task: preference with preference_loss dpo, orpo or simpo trains on MLX, #2333; ipo, bco and blends stay refused.)

Preference training on MLX

v0.77.0 trains task: dpo, orpo, simpo and kto on backend: mlx through Soup's own loop, on the objectives Soup's transformers backend runs through TRL (#1846, #2073, #2097, #2111, by @dryn85-max; KTO was requested by @Amix29).

yaml
base: mlx-community/Qwen2.5-0.5B-Instruct-4bit
task: dpo
backend: mlx

data:
  train: ./prefs.jsonl
  format: dpo
  max_length: 1024

training:
  lr: 2e-5
  dpo_beta: 0.1
  batch_size: 2
  gradient_accumulation_steps: 4
  gradient_checkpointing: true
  seed: 42
  lora:
    r: 16
    alpha: 32

orpo and simpo take the same format: dpo rows. kto takes format: kto rows and needs batch_size: 2 or more.

task: preference on MLX (v0.77.2)

Since v0.77.2 (#2333, by @vaputa) the unified task: preference runs on backend: mlx when training.preference_loss is dpo, orpo or simpo. It selects the native trainer of that name, with the same load-time refusals and the same soup doctor --config table as the explicit task. The config keeps task: preference; adapter_config.json records the native task (dpo, orpo or simpo), so --resume matches either spelling.

yaml
base: mlx-community/Qwen2.5-0.5B-Instruct-4bit
task: preference
backend: mlx

data:
  train: ./prefs.jsonl
  format: dpo
  max_length: 1024

training:
  preference_loss: dpo
  lr: 2e-5
  dpo_beta: 0.1
  batch_size: 2
  gradient_accumulation_steps: 4
  gradient_checkpointing: true
  seed: 42
  lora:
    r: 16
    alpha: 32

This config passes soup doctor --config on the v0.77.2 binary; the training loop itself needs Apple Silicon and was not run for this page. soup doctor --config exits 2 on preference_loss: ipo or bco (soup train exits 1) with MLX backend only ships SFT, DPO, ORPO, SimPO, KTO and GRPO; task='preference' has no trainer on backend='mlx'. Use backend=transformers for task=preference. A preference_loss_weights blend stays refused on MLX; kto has no preference_loss spelling, so use task: kto. Upstream's own Known Limitations say this path is covered only by the hosted macOS MLX test job.

  • The same rows as the transformers backend. Rows go through the loader's own format: dpo and format: kto converters and are tokenized the way TRL 0.29 does, so a row that fits in data.max_length trains on the same tokens on either backend. On DPO a pair whose chosen equals its rejected, and a row the chat template cannot slice, are skipped with a count; fewer pairs than training.batch_size after skipping is refused. ORPO and SimPO keep ties, as TRL does. Per-row tools and chat_template_kwargs are not applied.
  • No second model. LoRA B starts at zero, so before the first update the policy is the base model. DPO and KTO compute their reference log-probs from it once, before training, and before a --resume checkpoint loads, so the reference is always the base.
  • LoRA dropout stays on (lora.dropout, default 0.05). TRL turns dropout off on the transformers backend, so set lora.dropout: 0 to match it.
  • Long pairs. The vocabulary head runs in checkpointed chunks, so a batch's full-vocabulary logits are never held at once, and the chunked path is checked against the full model on the first batch. For long pairs set training.gradient_checkpointing: true.
  • The prompt cut (v0.78.0). Native MLX DPO, ORPO and SimPO keep the whole prompt when both preference inputs fit data.max_length. Only an overflowing pair applies the half-length prompt cap and clips the answers to the remaining room, which matches the transformers backend (#2199, #2659, by @nazek52). Before v0.78.0 the cap went on every prompt (the v0.77.2 MLX DPO code applies it unconditionally), so a run whose prompts are longer than half of data.max_length may train on different tokens now. Upstream covers this with fixtures run by the hosted macOS MLX job.
  • A diverged DPO run reports NaN rather than stopping. ORPO, SimPO and KTO stop on a non-finite loss. Upstream's docs call DPO more sensitive to the learning rate than SFT and recommend starting at 2e-5 or below.
  • KTO builds its KL rows the way TRL does and runs batches in dataset order, so training.seed does not reorder its rows: shuffle the file to mix labels.
  • Evaluation runs once per epoch and after the last update. training.eval_steps is refused on these four tasks.
  • Progress. The live panel, the soup ui stream and the tracker show loss and validation loss. The per-objective metrics (reward accuracy and margin, and their equivalents for ORPO and KTO) print on each logged step only when there is no live panel, and are returned in the run result.
  • Resume. DPO, ORPO, SimPO and KTO refuse a --resume checkpoint that has no adapter_config.json beside it, or that names another task or another base, before any tensor loads. DPO joined the other three in v0.77.2 (#2321, by @mayuriphad). An MLX SFT adapter is therefore refused for a DPO run: its adapter_config.json has no task key, so the refusal reads was trained with task=None, not 'dpo'. (Through v0.77.1 ORPO, SimPO and KTO had the check and DPO did not.)
  • Output: adapters.safetensors and an adapter_config.json recording the task, its beta and the base, loadable with mlx_lm.load(base, adapter_path=output).

Upstream qualified ORPO, SimPO and KTO on Qwen2.5-0.5B-Instruct in bf16 and 4-bit on an M4 Pro, and says of its own runs that they show the objective moving, not alignment quality. No throughput or memory figure is published here for any MLX preference task.

GRPO on MLX

Since v0.77.1, task: grpo with backend: mlx trains natively through Soup's own MLX loop (#2182 by @dryn85-max, the dense baseline, step 1 of #1976): it generates num_generations completions per prompt from the current policy, scores them with the built-in accuracy or format reward and takes one policy-gradient step per update, on the objective Soup's transformers path trains on TRL 0.29.1. Held-out prompts are scored once after training as val_reward. Through v0.77.0 this config was refused at load. Through v0.77.1 it trained a dense base only; since v0.77.2 it also trains a base pre-quantized at 4 bits (see the first bullet below).

yaml
base: Qwen/Qwen2.5-0.5B-Instruct
task: grpo
backend: mlx

data:
  train: ./train.jsonl
  format: chatml
  max_length: 256

training:
  reward_fn: accuracy
  num_generations: 4
  batch_size: 4
  gradient_accumulation_steps: 2
  grpo_beta: 0.1
  lr: 1e-5
  quantization: none
  lora:
    r: 16
    alpha: 32

A row of train.jsonl is a chat row whose final assistant turn is the gold answer:

json
{"messages": [{"role": "user", "content": "What is 2+3? End with '#### <number>'."}, {"role": "assistant", "content": "#### 5"}]}

This config loads and passes soup doctor --config and soup train --dry-run --yes on the v0.77.2 binary; the training loop itself needs Apple Silicon and was not run for this page. Upstream says it qualified the loop on Qwen2.5-0.5B-Instruct in bf16 on an M4 Pro, on a synthetic arithmetic task that is easy and fully verifiable, and that this shows the loop training, not reasoning quality in general. No speed, memory, time or accuracy figure is published here for MLX GRPO (upstream's docs print some for that run, but none has a record in its benchmarks/ directory), and nothing here compares it with the transformers backend or with TRL.

Since v0.77.2 (#2386, by @ybai08) the same task also trains on a base that mlx-lm pre-quantized at 4 bits, as the mlx-community/...-4bit repositories write it. Only base and quantization change:

yaml
base: mlx-community/Qwen2.5-0.5B-Instruct-4bit
task: grpo
backend: mlx

data:
  train: ./train.jsonl
  format: chatml
  max_length: 256

training:
  reward_fn: accuracy
  num_generations: 4
  batch_size: 4
  gradient_accumulation_steps: 2
  grpo_beta: 0.1
  lr: 1e-5
  quantization: 4bit
  lora:
    r: 16
    alpha: 32

This config also passes soup doctor --config and soup train --dry-run --yes on the v0.77.2 binary, and it was not trained for this page. Upstream's Known Limitations say this path, like task: preference above, is covered only by the hosted macOS MLX test job, and that nothing was exercised by hand on Apple Silicon before the release. The quantization check runs after the model loads, which neither soup doctor --config nor --dry-run reaches.

  • The base: dense, or 4-bit affine. Use a bf16, fp16 or fp32 checkpoint with quantization: none, or an mlx-community/...-4bit base (as mlx_lm.convert -q writes it) with quantization: 4bit. Since v0.77.2 the quantized layers (QuantizedLinear and QuantizedEmbedding, a tied output head included) stay frozen and only the LoRA adapter trains, with the same loop and objective as on a dense base; a quantized tensor left trainable is refused before the first update, and the reference is the same quantized base with the adapter off. Any other quantized base is refused right after the model loads, naming the first layer outside the rule with its kind, bits and mode: 8-bit and mixed-bit recipes, mxfp4, mxfp8, nvfp4, quantized mixture-of-experts layers and BitNet layers. So a config can pass soup doctor --config and soup train --dry-run and still stop there. quantization: 8bit is refused at load (exit 2 from soup doctor --config: training.quantization='8bit' is not supported by task='grpo' on backend='mlx': MLX GRPO trains a dense base or one pre-quantized at 4 bits (affine), not an 8-bit one. ...). adapter_config.json records base_quantization: the bits, group size, mode and the numbers of quantized linear and embedding layers, or null for a dense base. (Through v0.77.1 every quantized base was refused after the load, and the message read MLX GRPO trains a dense base in this release, and <base> is quantized (...).)
  • Rewards: the built-in accuracy and format only. reward_fn of accuracy (the default) or format. A custom .py file, a comma-separated ensemble, verifiable, judge_rank and prm_reward are refused at load. With accuracy, each completion is scored against its own row's gold answer: with messages rows the final assistant turn is the gold, an Alpaca row's output works too, and a prompt string is the user turn. A bare {"prompt", "answer"} row is not auto-detected as a format, so use messages or Alpaca rows. With accuracy, a missing gold is refused when the trainer starts, before the model loads, so --dry-run does not see it; format reads no gold (it scores a <think>...</think> block and an answer after it). Too few prompts for one update is refused for both, at the same point.
  • Units are TRL's. training.batch_size counts completions per micro-step. One update uses batch_size x gradient_accumulation_steps completions, which is that number divided by num_generations prompts, and the product must be a multiple of num_generations (another trainer-start refusal). A batch below one group, and batch_size: auto, is one group of num_generations completions. Prompts are shuffled each epoch from training.seed, and the trailing prompts that do not fill an update are dropped. save_steps counts updates. num_generations must be at least 2.
  • Rollouts. Completions are generated once per update from the policy at that update, in train mode, so LoRA dropout is active as in TRL, at temperature 1 with no top-p, top-k or min-p. A completion stops at the tokenizer's eos_token_id, which it keeps, or after data.max_length tokens (data.max_length is the completion length here, so keep it small: rollouts dominate the cost of an update). There is no gradient through generation.
  • The objective. These are the defaults of TRL 0.29.1's GRPOConfig, which Soup does not override on its transformers path either: loss_type: dapo (a per-token clipped surrogate summed over every completion token of the update and divided by that token count), rewards scaled per group, epsilon 0.2 on both sides, one iteration, token-level importance sampling, and a k3 KL penalty against the base weighted by training.grpo_beta (default 0.1; 0 runs no reference forward). The reference is the policy with every LoRA scale set to 0, so no second copy of the model is loaded. That dapo is TRL's default objective, not Soup's grpo_variant: dapo: grpo_variant is refused on MLX GRPO, so this is not support for the GRPO variants.
  • Validation. On MLX the loader always holds out data.val_split (default 0.1), where the transformers path holds rows out only with training.eval_steps. The run prints how many prompts were held out. They are not trained on; after training each gets num_generations completions at temperature 1 with dropout off, and the mean reward is printed, returned and logged as val_reward (its standard deviation is returned as val_reward_std). Set data.val_split: 0 to train on every row. training.eval_steps is refused, because there is no mid-run evaluation.
  • A non-finite loss or gradient skips the update. The weights and optimizer moments do not change, and the skip is printed and counted as skipped_steps in the result and in adapter_config.json. A skipped update also holds the learning-rate schedule, because MLX has one optimizer step that drives both; upstream's docs say the transformers path still advances its scheduler.
  • Saved. adapters.safetensors and adapter_config.json, written atomically (the metadata before the first update), loadable with mlx_lm.load(base, adapter_path=output). The metadata records the settings of the objective, the reward and the skipped-update count.
  • Seeds. training.seed seeds mx.random and the per-epoch prompt shuffle. data_seed is recorded but moves nothing here: the prompt order follows training.seed alone, as TRL's sampler does. Nothing here promises that two runs match bit for bit.
  • Refused at load. soup doctor --config exits 2 on these: a modality other than text, lora.r: 0, DoRA, lora.rank_pattern and alpha_pattern, use_liger, use_flash_attn, neftune_alpha, relora_steps, loss_watchdog, multipack, stream_layers (streaming is a permanent exclusion for GRPO on every backend), grpo_variant, rollout_backend and rollout_func, tis_threshold, off_policy_mask_threshold, mask_truncated_completions, skip_zero_advantage, async_grpo_prefetch, replay_buffer_size, defer_rerolling, grpo_fp16, ref_model_ema_alpha, every reward_hack_*, echo_trap_*, rl_checkpoint_* and curriculum* setting, and the vLLM options. lora.use_rslora and data.chat_template are accepted (this is the one MLX task that applies data.chat_template).
  • Refused at launch or after the load. soup train --resume and --hf-resume exit 1 (--resume is not supported for task 'grpo' on backend 'mlx'): only the adapter is saved, so a restart would not continue the same run. --deepspeed and --fsdp are refused. A base that loads quantized in any way other than the 4-bit affine rule above (8-bit, mixed-bit, mxfp4, mxfp8, nvfp4, quantized MoE, BitNet) is refused right after the load. soup train --dry-run passes the --deepspeed, --fsdp and quantized-base refusals, but not the --resume and --hf-resume ones, which exit 1 even together with --dry-run.

No MLX GRPO recipe exists in the catalog: the three backend: mlx recipes are all task: sft, and the catalog is 181 at v0.78.0 (173 at v0.77.2, 171 at v0.77.1), none of the additions being an MLX recipe. On the transformers backend GRPO has far more settings, rewards and variants: see Training methods and GRPO+.

Refused at load on MLX

Each refusal names the field and what to change. soup doctor --config reports the first cross-field refusal it hits, so fix that setting and run it again until it prints no error.

  • On every MLX task: lora.use_vera and a non-random init_strategy, loraplus_lr_ratio (the MLX optimizer uses one learning rate for every LoRA tensor), use_lorafa, relora_steps, stream_layers, multipack, the Quant Menu formats (hqq:* and the rest), loss_spike_recovery and grad_accum_auto_tune. Most of these have been refused since v0.76.0.
  • Refused except on MLX text SFT, which accepts them since v0.78.0 under conditions: lora.r: 0, rope_scaling_type, freeze_layers / freeze_ratio and data.add_new_tokens / new_special_tokens. Through v0.77.2 this list refused all four on every MLX task. Now lora.r: 0 loads with quantization: none on task: sft (and is still refused on dpo, grpo and the other MLX tasks); rope_scaling_type: linear loads with quantization: none (yarn and the other types are refused); freeze_layers / freeze_ratio load only together with lora.r: 0; data.add_new_tokens loads with quantization: none. A LoRA r of 1 or more beside freeze_* is still refused, data.add_new_tokens and new_special_tokens beside lora.r: 0 are refused (vocabulary expansion currently requires LoRA), and so are lora.alpha, dropout and target_modules away from their defaults next to lora.r: 0. On every other MLX task the four are refused as before. The sections Dense full fine-tuning on MLX and More text-SFT settings on MLX carry the detail and the messages.
  • New in v0.77.0: lora.rank_pattern and alpha_pattern (#1996; the MLX trainer builds every adapter from one scalar rank and alpha, so through v0.76.1 a pattern trained a uniform adapter without a word; an empty {} still loads; upstream calls the refusal a stop-gap until the trainer applies them), data.chat_template (#2051; MLX renders the model's shipped template only, except on task: grpo, which applies it since v0.77.1), and training.use_mod: true (#1752).
  • New in v0.77.2, on task: sft: training.reasoning_effort and training.train_on_eot set to a value (#2278, by @abdulwaarith0). The MLX trainer has its own loop with no SFT formatter, so through v0.77.1 these two loaded and trained without the setting; the message reads training.reasoning_effort is not applied by task='sft' with backend='mlx': the MLX trainer has its own loop, with no SFT formatter, so this run would ignore it. Use backend: transformers, or remove the key. soup doctor --config exits 2 on it and soup train exits 1. Leave the key out: train_on_eot: false also loads, and reasoning_effort loads when it is null (train_on_eot: null and reasoning_effort: false are refused). use_flash_attn and use_liger are not refused by the config loader on MLX SFT (soup doctor --config lists them as ignored), but soup train stops on them before the MLX trainer starts, even with --dry-run: FlashAttention requires CUDA and Liger Kernel requires CUDA, exit 1. Leave both keys out of an MLX config (false loads). Through v0.77.1 the runs finished without the setting; upstream lists no re-run for it, and deleting the key changes nothing on MLX.
  • On DPO, ORPO, SimPO and KTO: a non-text modality, DoRA, training.eval_steps, loss_watchdog, dpo_beta_schedule / dpo_ref_regen_epochs, and, on ORPO, SimPO and KTO, quantization: 8bit (use none, or a pre-quantized mlx-community 4-bit base with quantization: 4bit). A preference_loss_weights blend needs task: preference with no scalar preference_loss, and MLX refuses it (preference_loss_weights is not supported on the mlx backend). Under task: preference, preference_loss: ipo and bco are refused too, with the message MLX backend only ships SFT, DPO, ORPO, SimPO, KTO and GRPO; task='preference' has no trainer on backend='mlx'.
  • On GRPO: a longer list, in GRPO on MLX. It includes training.eval_steps, custom and ensemble rewards, grpo_variant and quantization: 8bit; a quantized base other than the 4-bit affine rule is refused too, but only after the model loads.
  • Now accepted on MLX SFT, since v0.77.0: lora.use_dora (text, quantization none or 4bit), training.eval_steps, and training.loss_watchdog (text only).
  • New in v0.78.0, on every MLX task: an enabled eval gate (training.eval_gate.enabled: true, or soup train --gate) is refused: training.eval_gate is not supported for backend='mlx' because MLX does not attach a live training callback (#2564; soup doctor --config exits 2, soup train and soup train --dry-run exit 1). enabled: false loads. Through v0.77.2 an enabled gate on MLX loaded and the run trained without ever checking it. The model was not wrong; it was never gated. Remove the block or set enabled: false, and run soup eval gate or soup ship after training instead.
  • Settings that are only ignored still load and are listed by soup doctor --config (see below).

A few limits are checked only when the trainer starts, so soup doctor --config cannot see them: a training split smaller than batch_size on MLX SFT is refused before the model loads, as is eval_steps with an empty validation split; DPO, ORPO and SimPO refuse fewer pairs than batch_size after skipping, and KTO fewer than two rows. GRPO is refused before the model loads for fewer prompts than one update needs, or for a batch_size x gradient_accumulation_steps that is not a whole number of groups; it is refused right after the model loads for a quantized base other than the 4-bit affine rule (v0.77.1 refused every quantized base there); and --resume and --hf-resume are refused at launch with exit 1, even together with --dry-run. soup train --dry-run passes the other limits in this paragraph.

DoRA on MLX

training.lora.use_dora: true on text SFT uses mlx-lm's native weight-decomposed adapter (v0.77.0, #1920, by @Amix29). It supports dense linear targets on an unquantized or pre-quantized 4-bit base, with the same scalar lora.r, lora.alpha and target_modules as MLX LoRA. Switch or expert layers, embedding targets, unmatched target names and 8-bit layers are refused before the adapter is converted. use_rslora, rank_pattern, alpha_pattern and quantization: 8bit are refused at load. The output records fine_tune_type: dora and loads with mlx_lm.load(base, adapter_path=output). A warm start refuses missing, extra or differently shaped tensors, magnitudes included. Upstream's tests use a tiny random model: they establish the adapter lifecycle, not quality or a speed advantage over LoRA. soup infer --backend mlx, soup chat --backend mlx and soup merge --backend mlx refuse a DoRA adapter (v0.78.0 for chat and merge), so it is loaded with mlx_lm.load(base, adapter_path=output) and, to fuse it, with mlx-lm's own mlx_lm.fuse (not run here).

rsLoRA on MLX

lora.use_rslora: true is applied on MLX since v0.77.0 (#1899, by @ndablizov): the scale alpha / sqrt(r) goes into adapter_config.json and into training. Through v0.76.1 it loaded and was never read, so such runs trained at the plain-LoRA scale alpha / r, an 8x smaller update at the default r: 64, alpha: 16. The same config now trains at the rsLoRA scale, so its results change; drop the flag to keep the old scale. MLX DoRA refuses it.

Dense full fine-tuning on MLX (v0.78.0)

Through v0.77.2 lora.r: 0 on backend: mlx was refused at config load. Since v0.78.0 native MLX text SFT trains every weight when training.lora.r: 0 and training.quantization: none on an unquantized Llama model (#1992, #2818, by @here-2007). The loaded model must be mlx_lm.models.llama.Model with model_type: llama: any other architecture, and any quantized module even under quantization: none, is refused when the trainer starts, after the model loads, so soup doctor --config and soup train --dry-run cannot see it.

yaml
base: ./local-dense-llama
backend: mlx
task: sft
output: ./llama-full

data:
  train: ./train.jsonl

training:
  quantization: none
  batch_size: 1
  freeze_ratio: 0.75   # optional; omit to train every base parameter
  lora:
    r: 0

This config loads and passes soup doctor --config on the v0.78.0 binary. The trainer needs Apple Silicon and was not run for this page.

  • What trains. Layers below freeze_layers, or int(num_layers * freeze_ratio), stay frozen; freeze_layers wins when both are set, and an out-of-range count is refused. The embedding, the final norm and the output head always train, tied embedding and head weights receive one update, and the exact frozen and trainable parameter and tensor counts are printed before the first update. Frozen tensors get no optimizer state. freeze_layers and freeze_ratio are accepted on MLX only beside lora.r: 0.
  • Numerics. Trainable weights are promoted to float32, a bf16 or fp16 checkpoint included, so gradients and the two AdamW moments are float32; frozen weights keep their dtype. Accumulated gradients are weighted by the number of supervised tokens and clipped once per optimizer update. gradient_checkpointing: true works. No automatic batch-size estimate covers a dense model, so choose a small batch_size yourself.
  • Memory arithmetic, not a measurement. For a model with P parameters of which T train, upstream's projection of persistent memory is 4*T + frozen_weight_bytes + 4*T + 8*T bytes (trainable weights, frozen weights, gradients, two float32 moments), which is 2*(P-T) + 16*T when the frozen weights are bf16. Activations, temporary buffers, accumulation, the cache and macOS need more on top. Freezing 75% of the blocks does not freeze 75% of the parameters, because the embedding, norm and head stay trainable. Upstream says neither 96 GB nor 128 GB of unified memory is a measured capacity guarantee, and no measured peak for a real model is published here.
  • Output. The final folder and each checkpoint-000000N/ hold complete weights (frozen layers included), the model configuration, the tokenizer and a training_config.json with the freeze plan and the completed update count. Trainable tensors are saved in float32 and frozen ones keep their dtype, so one checkpoint can hold both. Load it with mlx_lm.load("./llama-full"), without the original base or an adapter. Use a fresh output folder for every run: one that already holds model or adapter artifacts is refused. save_steps counts micro-batches, and a save that falls inside an accumulation group waits for its optimizer update. Checkpoints hold weights, not exact optimizer or random-number state (#1977), so a saved model can be the base of a new run but not a resume point.
  • Still refused. --resume and --hf-resume (MLX full fine-tuning does not support --resume), distributed training, LISA, Spectrum, lora.alpha, lora.dropout and target_modules away from their defaults next to lora.r: 0, a LoRA r of 1 or more beside freeze_*, data.new_special_tokens and data.add_new_tokens, and lora.r: 0 on dpo, grpo and every other MLX task.

Upstream covers the dense path with its hosted macOS MLX test job and a tiny fixture, and its record for it (benchmarks/mlx-full-ft-1992.md) says that no large-model memory or throughput claim follows from that fixture.

More text-SFT settings on MLX (v0.78.0)

Four more settings that Soup refused or ignored on backend: mlx through v0.77.2 are honoured on text SFT now. Upstream covers all four with its hosted macOS MLX test job and fixtures only, and no MLX speed, memory or time figure exists for any of them.

Vocabulary expansion

data.add_new_tokens and data.new_special_tokens work on MLX text SFT when training.quantization: none, on a dense Llama-style model (model.model.embed_tokens and model.lm_head) whose embedding row count equals the tokenizer length, with LoRA (lora.r of 1 or more; the tokens beside lora.r: 0 are refused) (#1994, #2684, by @here-2007).

yaml
base: mlx-community/Llama-3.2-1B-Instruct-bf16
backend: mlx
task: sft

data:
  train: ./train.jsonl
  add_new_tokens: ["<tool>", "</tool>"]

training:
  quantization: none
  lora:
    r: 16

The base embedding table and head stay frozen; Soup allocates only an additive new_tokens x hidden slice and trains it, so the extra memory is new tokens x hidden size x dtype size, doubled for untied models. Per upstream's docs, special tokens are registered before ordinary ones, the opposite of backend: transformers, and the new rows start from a normal draw matching the base embedding's standard deviation and dtype, seeded by the training seed (42 when training.seed is unset: that default belongs to this draw, not to training). A 4-bit base is refused at load (native MLX vocabulary expansion requires unquantized embeddings). Checkpoints keep adapters.safetensors (without the new rows) and add added_tokens.safetensors and added_tokens_info.json. soup infer, soup chat and soup merge refuse such an adapter (Native MLX generation does not currently support artifacts with expanded vocabularies (#1986); tracked as #1986 and #1988), so a run trained with expanded vocabulary on MLX cannot yet be used by Soup's own consumers.

Linear RoPE extension

training.rope_scaling_type: linear with training.quantization: none extends the context on MLX text SFT when data.max_length is larger than the checkpoint's max_position_embeddings (#1995, #2710, by @here-2007). The factor is data.max_length / max_position_embeddings and positions are interpolated by 1 / factor. The scaling is recorded in adapter_config.json and re-applied by soup infer, soup chat and soup merge --backend mlx.

yaml
base: mlx-community/Llama-3.2-1B-Instruct-bf16
backend: mlx
task: sft

data:
  train: ./train.jsonl
  max_length: 8192

training:
  quantization: none
  rope_scaling_type: linear
  lora:
    r: 16

Any other type (yarn, dynamic, llama3, longrope) is refused on MLX at load (MLX text SFT currently supports rope_scaling_type='linear' only), linear with quantization: 4bit is refused, a checkpoint that already carries RoPE scaling or per-layer nested RoPE is refused rather than modified, and generation and fusion refuse a RoPE-scaled adapter on a quantized base.

Selective loss masks

On native MLX text SFT data.mask_history: true trains only the last assistant message (consecutive assistant turns and a conversation that ends in a tool turn included; every earlier message stays in the input). data.train_on_responses_only: false together with data.train_on_messages_with_train_field: true trains exactly the messages whose own train flag is true: the whole token span of header, content and end marker, whatever the role. false excludes a message, a missing or null flag uses the assistant default, and any other value is refused (#1985, #2128, by @Amix29). Both settings load on MLX and pass soup doctor --config.

Both need chat message rows and token boundaries the loader can verify against the model's chat template. An unsupported render is refused with a message naming the template, and a row with no supervised target (a selected turn cut away by data.max_length included) is refused instead of training another turn. The first row is checked before training and the others as they are read, and the effective flags are written to the adapter metadata. On modality: vision or audio they are refused: soup doctor --config lists them as rejected there (native selective message masks support text SFT only), not as ignored.

Through v0.77.2 both settings were ignored on MLX and listed as ignored, so a config that set them trained every assistant turn. The same config trains on a different set of tokens now. Upstream's evidence is ordinary LoRA on dense and genuinely 4-bit text bases, in fixtures.

A pre-tokenized cache

data.format: pre_tokenized with data.tokenized_path (a cache written by soup data preprocess) is consumed by native MLX text SFT through the same fingerprint gate as the transformers path, without Torch, PEFT or TRL (#1991, #2131, by @Amix29). Reading the Arrow files needs pip install "soup-cli[mlx]" datasets. Stored ids and explicit labels are used exactly: no template render, no re-tokenizing, no added BOS or EOS, and padding is never trained, even when PAD equals EOS.

yaml
base: mlx-community/Llama-3.2-1B-Instruct-bf16
backend: mlx
task: sft

data:
  format: pre_tokenized
  tokenized_path: ./tok-cache
  train: ./train.jsonl

training:
  lora:
    r: 16

Every row is checked (integer ids and labels, vocabulary bounds, matching lengths, right-padding attention masks, at least one target left after truncation), and a single bad row stops the run, with no fallback to the raw rows. The cache key binds names, paths and settings, not file contents: an unchanged name does not prove unchanged data or model, so use only caches you built yourself.

Evaluation and small splits

  • training.eval_steps: N on MLX SFT (v0.77.0, #2074) evaluates after every N completed optimizer updates (after accumulation) and once after the last. Every validation row counts, including a tail smaller than one batch, weighted by supervised tokens. The interval is recorded in adapter_config.json, and an empty validation split is refused before the model loads. Unset, mlx-lm keeps its own cadence.
  • A validation split smaller than one batch (the default val_split: 0.1 gives one row on a 10-row file) is not evaluated when eval_steps is unset. The run warns, naming both numbers, and records no val_loss; set data.val_split: 0 to train on those rows instead, or set eval_steps, which evaluates such a split. Through v0.76.1 that split crashed the run at its first evaluation, after the model had loaded (#1857).
  • A training split smaller than one batch is refused before the model loads.

The loss watchdog on MLX SFT

training.loss_watchdog: true works on MLX text SFT since v0.77.0 (#2115, by @Amix29), with the usual loss_watchdog_threshold and loss_watchdog_patience. Reports count completed optimizer updates (every logging_steps updates). A triggering report stops training at a completed optimizer update and saves the current adapter, and adapter_config.json records the stop reason and the work actually completed: training_outcome (stopped or completed), stop_reason (loss_watchdog or budget_completed), completed_updates and completed_iterations; total_steps stays in MLX micro-batch units. The CLI prints Training Stopped and exits 0, and the tracker's completed status only means the run finalised, so read the adapter metadata for the reason. Unlike the transformers watchdog, a reported NaN or infinite loss on MLX is an immediate error whatever the patience. It saves the last state, not a best-loss checkpoint. The other MLX tasks and modalities refuse the watchdog, and MLX still refuses loss_spike_recovery.

Native MLX generation with soup infer --backend mlx

Since v0.77.1, soup infer takes --backend transformers|mlx (the default stays transformers). With --backend mlx, native text LoRA adapters and MLX base models load and generate without Torch or PEFT (#2121 by @Amix29, part 1 of #1986).

bash
pip install "soup-cli[mlx]"
soup infer --backend mlx --model ./output --input prompts.jsonl --output results.jsonl

prompts.jsonl holds one {"prompt": "..."} row per line, as for any soup infer run. --model is an adapter directory written by Soup's native MLX trainers (an adapter_config.json beside adapters.safetensors), or a local native MLX base model with no adapter: base-only generation works too.

  • A strict loader. It reads the base model, the layer count and the LoRA parameters from adapter_config.json and checks every adapter tensor name, shape and finite value against the base before anything is generated. --base, if you give it, must match the base the metadata names, and a relative base path in the metadata resolves from the current directory. A malformed native adapter_config.json is refused with a message that names the file.
  • What it covers. Ordinary linear text LoRA (the rsLoRA scale included) on a dense or a genuinely 4-bit base, and text causal language models only. DoRA, full fine-tune adapters, embedding and switch-layer targets and other quantized targets are refused.
  • Options it refuses, one named option at a time, exit 1. --task other than text (MLX generation requires --task text), --batch-size other than 1, --cuda-graphs, any --device (MLX selects its native device; omit --device), --hub other than hf, and the ASR options. A negative or non-finite --temperature is refused. --max-tokens takes 1 to 16384, as everywhere.
  • Sampling. Temperature 0 is greedy; anything above it samples with nucleus top_p=0.9. There is no seed flag, so nothing promises that two runs print the same text.
  • The two messages you will meet. Without the [mlx] extra, --backend mlx exits 1 with Native MLX generation requires soup-cli[mlx]; install it on Apple Silicon. A native adapter given to the default backend exits 1 with Native MLX adapter detected; select --backend mlx.
  • Not covered. MLX serving: soup serve has no native MLX route. An adapter trained with vocabulary expansion (see below) is refused. (Since closed in v0.78.0: soup chat --backend mlx and soup merge --backend mlx exist, #2123, #2124; see the next section. soup merge --backend mlx refuses a DoRA adapter, see DoRA on MLX.)

The option refusals above were run on the v0.77.2 binary without MLX installed (the soup infer MLX path did not change between v0.77.1 and v0.77.2). The load and generation path needs Apple Silicon and was read from the code, not run for this page. No MLX generation speed or memory figure is published here.

Native MLX chat and fusion (v0.78.0)

Since v0.78.0 soup chat and soup merge take --backend transformers|mlx (the default stays transformers; any other value is a usage error, exit 2). Both reuse the strict loader that soup infer --backend mlx uses (#2123, #2124, by @Amix29, parts of #1986 and #1988): the same adapters are covered (ordinary linear text LoRA, the rsLoRA scale included, on a dense or a genuinely 4-bit base, plus base-only generation), every adapter tensor name, shape and finite value is checked against the base before anything runs, and --base, if given, must match the base the adapter's adapter_config.json names. DoRA, full fine-tune adapters, embedding and switch-layer targets and other quantized targets are refused.

bash
soup chat --backend mlx --model ./mlx-adapter --temperature 0
soup merge --backend mlx --adapter ./mlx-adapter --output ./fused --dtype float32

Chat. --model ./mlx-base gives base-only chat. The conversation keeps its history and takes /quit, /clear and /system. Ctrl+C or end of input during generation ends the session with Goodbye! and discards the in-memory history. Each of these is refused with exit 1, one named option at a time: any --device (MLX selects its native device; omit --device), a --hub other than hf, a negative or non-finite --temperature, and --max-tokens above 16384 (MLX max_tokens must be between 1 and 16384; zero is a usage error with exit 2). Temperature 0 is greedy; above it the reply is sampled with nucleus top_p=0.9, and there is no seed flag. A native adapter given to the default backend exits 1 with Native MLX adapter detected; select --backend mlx, for soup merge too.

Fusion. soup merge --backend mlx writes a standalone dense checkpoint (weights, model configuration, tokenizer) that loads without the original base or adapter; quantization metadata and live adapter tensors are removed and tied-weight configuration is kept. --dtype is float16 (the default), bfloat16 or float32. A genuinely 4-bit source needs the explicit --dequantize (Quantized MLX fusion requires explicit --dequantize for dense output); the output is dense and nothing re-quantizes it, and any quantization other than 4-bit is refused. --dequantize without --backend mlx exits 1 (--dequantize requires --backend mlx). The output must be a new folder under the working directory that does not overlap the adapter or the base, symlinks included. It is written to a staging folder next to it and renamed into place only when complete, so a failed or interrupted merge (Ctrl+C exits 130) publishes nothing and leaves the inputs unchanged.

Refused on this path, exit 1 with MLX merge failed: ...: DoRA and other unqualified adapter variants, a --save-format other than fp16, an explicit --double-quant or --no-double-quant, --low-memory (native fusion loads the whole model and does not stream tensors), a --hub other than hf, and a RoPE-scaled adapter on a quantized base. The saved files come from the local snapshot the load already used, so a partial Hub cache is enough offline with MLX-LM 0.31.3, and no README is fetched. An auto_map entry still needs --trust-remote-code when the result is loaded.

Not supported by soup infer, soup chat or soup merge: an adapter trained with vocabulary expansion (data.add_new_tokens / new_special_tokens, see More text-SFT settings on MLX). Its added_tokens.safetensors sidecar makes all three stop with Native MLX generation does not currently support artifacts with expanded vocabularies (#1986) until a unified loader exists (tracked as #1986 and #1988). The transformers soup merge refuses it too (soup merge does not support adapters with expanded vocabularies (#1988).).

The option refusals on this page's chat and merge forms were run on the v0.78.0 binary without MLX installed. Loading, generation and fusion need Apple Silicon and were read from the code, not run for this page. Upstream covers all of it only with its hosted macOS MLX test job and tiny dense and 4-bit fixtures, did not exercise chat, fusion or any other MLX path by hand before the release, and makes no claim about model quality or GGUF conversion. No MLX speed, memory or time figure exists.

Diagnostics

bash
soup doctor

On Apple Silicon this reports Backend: MPS (Apple Silicon) and whether it is available, and since v0.76.0 it also prints an MLX panel with the installed MLX version, the chip name and the unified memory; if MLX is not installed the panel says not installed and prints pip install "soup-cli[mlx]". (Through v0.75.2 soup doctor never reported MLX: the helper that would fill those in had no caller, so the version always read unknown. This was written from the code at the tag and not run on an Apple machine.) It does not report a recommended batch size. soup doctor --config soup.yaml is the part of this command that knows what the MLX backend does not read, and it is documented below.

Since v0.73.3, device detection knows this backend exists. Before that, detect_device() only probed PyTorch MPS and fell back to cpu, so an MLX run announced "CPU (no GPU detected)" — and the label was never the harm. That fallback also fired a "4bit quantization is not supported on CPU" warning and silently rewrote quantization: 4bit to none, on every MLX run that asked for 4-bit. With backend: mlx set, detection now resolves to MLX with the chip name, reports Apple unified memory in telemetry, and preserves 4bit for pre-quantized mlx-community checkpoints, which is a different thing from bitsandbytes NF4 and was never what that warning was written about. The CUDA-shaped analytical VRAM pre-flight is also skipped on this path, because Apple unified memory is managed by Metal rather than by a fixed VRAM pool.

Also since v0.73.3: [mlx] is a self-contained install for SFT on local JSONL, JSON or CSV data, since v0.77.0 for DPO, ORPO, SimPO and KTO too, and since v0.77.1 for GRPO (the GRPO trainer module and the built-in rewards import without torch, trl or transformers in a light install) and for soup infer --backend mlx, so you never need the PyTorch stack just to train on a Mac. Since v0.74.0 you may combine them: pip install "soup-cli[train,mlx]" resolves, because both extras now declare the same transformers>=5.16.1,<6.0.0 floor. Before that release the two declared ranges that could not be satisfied together at all, so the combination was not a style preference but an outright resolver failure. [train] is still the PyTorch and TRL stack the Transformers backend uses. A Hugging Face Hub or streaming dataset still needs datasets, because that data source owns the dependency; a local file path does not.

MLX-native recipes

  • llama3.1-8b-sft-mlx — M2+ 16GB. Its model, mlx-community/Llama-3.1-8B-Instruct-4bit, was also trained on an 8 GB M1 under a smaller config than the recipe's (LoRA r=8, batch 1, max_length: 512, 48 rows, one epoch): 48 iterations, adapter written and reloadable. The recipe's own settings (r=16, batch 2, max_length: 2048, 3 epochs) were not run on that machine
  • qwen3-8b-sft-mlx — M2+ 16GB. Its repo ID was broken until v0.75.0, pointing at mlx-community/Qwen3-8B-Instruct-4bit, which does not exist; it now names mlx-community/Qwen3-8B-4bit
  • gemma3-4b-sft-mlx — M1+ 16GB. Renamed in v0.75.0, from gemma3-9b-sft-mlx: there is no 9B Gemma 3, so the old name pointed at a repository that raised RepositoryNotFoundError. It now names mlx-community/gemma-3-4b-it-4bit

Use any of them with soup recipes use <name>. The old gemma3-9b-sft-mlx name exits 1.

qwen3-8b-sft-mlx behaves differently after v0.75.0, and the change is a refusal rather than a regression. It does not set data.train_on_responses_only, so it takes the true default, which reached nothing on this backend until now. Qwen3's chat template injects its thinking block only for the last assistant turn, which means partial renderings are not prefixes of the full one and MLX cannot build a per-token mask it can vouch for. Single-turn and system-plus-single-turn rows train as before; multi-turn rows are now refused at dataset construction, before the training loop starts, with a message naming data.train_on_responses_only: false as the remedy. Set that to restore the old behaviour on multi-turn Qwen3 data, knowing it trains on the prompt. llama3.1-8b-sft-mlx and gemma3-4b-sft-mlx mask correctly on both shapes and are unaffected.

The six options this backend accepted and never read

v0.75.0 is the release named for this page. Training options were validated by the schema, documented in these pages, accepted by the config loader, and then read by nothing on backend: mlx. Upstream's release notes count six; the table below lists every setting its fix entries name, eight in all. The same soup.yaml trained a different recipe on Apple Silicon than it did on a CUDA box, silently, and nothing warned.

OptionWhat actually happened before v0.75.0
data.train_on_responses_onlyDefaults to true and reached nothing, so every MLX run trained on system and user turns, and the adapter metadata recorded mask_prompt: false regardless
training.optimizerEvery run built a bare AdamW. All 32 allowlisted names became AdamW (the allowlist is 24 names since v0.76.0)
training.schedulerNo schedule at all: a constant learning rate, whatever the recipe said
training.warmup_ratioIgnored, for the same reason
training.weight_decayIgnored
training.max_grad_normIgnored. The documented default clips every transformers run at 1.0; on MLX nothing clipped anywhere, and the MLX backend ignores: advisory did not even mention it
training.gradient_accumulation_stepsmlx-lm's own dataclass default of 1 always applied, so the effective batch size and the optimizer-update cadence were not the ones you configured. adapter_config.json also hardcoded 1, so the drift was not detectable from the output afterwards
training.gradient_checkpointingmlx-lm's default of False always applied, giving up the memory saving you enabled it for. adapter_config.json hardcoded false here too

All of them are honoured now, and three of the consequences are worth stating with their measurements rather than in the abstract.

Response-only masking is not comparable between the two backends, and MLX is the stricter one. Setting mlx-lm's own flag was not the fix: it masks a single prefix ending before the last message, so on multi-turn chat it supervises only the final assistant turn. Measured on Apple Silicon over 16 two-turn conversations: 772 supervised tokens unmasked, 71 with upstream's flag, 146 with a correct mask. Soup injects its own per-token mask for chat rows, uses upstream's flag for prompt-and-completion rows where it is correct, and warns on plain-text rows because upstream raises there. MLX excludes the assistant header from the loss where the transformers path includes it, and MLX refuses a chat template whose partial renderings are not prefixes of the full one rather than approximating. data.train_on_messages_with_train_field and data.train_on_prompt have no MLX equivalent and now appear in the MLX backend ignores: line instead of vanishing. (Since closed in v0.78.0 for data.train_on_messages_with_train_field and for data.mask_history: native MLX text SFT reads both, see Selective loss masks. data.train_on_prompt is still ignored there.)

max_grad_norm rescues a specific failure, not every run. One M1 step on a deliberately ill-conditioned batch moved SGD weights by 388.03 unclipped against 0.0085 at max_grad_norm: 1.0. AdamW moved 0.126505 against 0.126504, because Adam normalises by its second moment anyway. So this matters for optimizer: sgd and for gradient spikes, and barely registers on an Adam-family run. The norm that actually ran is recorded in adapter_config.json.

Warning:

Upgrade note, and it applies to anyone who never touched the field. gradient_accumulation_steps defaults to 4. An MLX run that used to update the optimizer on every micro-batch now accumulates over four first: a 4x larger effective batch size and roughly a quarter as many optimizer updates for the same iters. That is the schema default finally taking effect, so a differently-converging run after upgrading is expected rather than a regression. iters is also rounded down to a whole number of accumulation groups, with a floor of one group, because mlx-lm only updates on it % accum == 0 and never flushes a trailing partial group: without that, a dataset smaller than the accumulation window trained for zero optimizer updates.

Optimizers and schedules

Soup's optimizer allowlist is far wider than anything MLX ships, so most valid values have no equivalent here. Since v0.75.0 a value MLX cannot express is refused by name when the optimizer is built, rather than silently becoming AdamW.

SettingAccepted on MLX
training.optimizeradamw_torch, adamw_hf, adamw_torch_fused, sgd, adafactor, adagrad, rmsprop, muon — eight of the 24 on Soup's allowlist. adamw_hf and muon are the two names that work only on this backend: they are refused at config load on transformers and unsloth (v0.76.0)
training.schedulercosine, linear, constant, constant_with_warmup
training.weight_decayAny value, except that a non-zero decay on adagrad or rmsprop is refused, because those MLX constructors take no weight_decay at all and dropping it silently is the bug this module exists to fix

Run a recipe that needs anything else on backend: transformers.

Adafactor follows your learning rate since v0.77.2 (#2484, by @vaputa; the Adafactor slice of #1811). On backend: mlx with training.optimizer: adafactor, the configured learning rate, warmup and schedule are applied now. Through v0.77.1 they were not, so an existing MLX Adafactor run trains differently now. Only that slice of "settings a backend never applies" is fixed; upstream keeps the rest of #1811 open. See If you ran Adafactor on MLX before v0.77.2.

The schedule is built in optimizer-update units, not iterations, because that is what MLX drives a callable learning rate from. Your real warmup is warmup_ratio x (iters // gradient_accumulation_steps); building it against iterations would stretch the warmup by the accumulation factor and never reach the cosine floor. Measured on Apple Silicon, a cosine run with warmup_ratio: 0.2 now reports 10 distinct learning rates across 40 iterations where the old path reported one. A warmup_ratio that rounds to zero updates says so.

The effective plan is written into adapter_config.json — optimizer, scheduler, warmup_updates, total_updates, weight_decay, peak_lr — so what ran is recoverable from the output directory rather than inferred from the recipe.

This backend now drives the dashboard, the tracker and the stream

MLXSFTTrainerWrapper.train() accepted display, tracker and run_id and discarded them, so an MLX run showed mlx-lm's raw stdout while the same config on the transformers path got the Rich panel. Since v0.75.0 it drives all three: the live terminal dashboard, the soup ui SSE stream and the SQLite experiment tracker.

It is an adapter rather than a reuse of the transformers callback, and the reason is worth knowing: mlx-lm exposes only on_train_loss_report and on_val_loss_report, so bridging through a Hugging Face TrainerCallback would have meant faking trainer state. Two deliberate consequences: speed carries iterations_per_second to match the transformers path, because the panel hard-labels that field it/s; and grad_norm is left unset, because mlx-lm does not compute one and a field reading a plausible 0.0 on one backend is worse than an absent one. Verified against real mlx-lm on an 8 GB M1.

The native DPO, ORPO, SimPO and KTO loops (v0.77.0) drive the same three: loss and validation loss on the panel, the tracker and the stream. Their per-objective metrics are not on the panel (see Preference training on MLX), and they evaluate once per epoch and after the last update. The native GRPO loop (v0.77.1) is wired to the same display and tracker: it reports every logging_steps updates, and its per-update metrics (reward mean and spread, completion lengths, KL, clip ratios, skipped updates) print when there is no live panel and are returned in the run's history. val_reward is logged as its own row at the last update's step.

Validation loss is recorded at all for the first time, and MLX produces it too (unset, mlx-lm evaluates the validation split on its own cadence; since v0.77.0 training.eval_steps sets it on SFT, see Evaluation and small splits). Before v0.75.0 the callback read the training loss and never the evaluation loss, so an evaluation step left the last training loss in place and re-reported it: the evaluated number existed nowhere. (Since closed in v0.76.0 for the transformers backend: it never scheduled an evaluation at all until then, so its held-out split was withheld from training and unused; see Training methods.) The live panel gains a Val loss row, and the metrics table and the SSE frame each carry val_loss as its own series, never folded into loss. The panel carries the last measured value forward between evaluations; the stored and streamed values do not, so a step where no evaluation ran records NULL and a series read back has one point per measurement rather than one per logged step. Existing ~/.soup/experiments.db files are migrated in place, and rows written before this ship read NULL rather than a fabricated 0.0, because an unmeasured value must not read as a measured one.

soup doctor --config: the settings your backend does not read

bash
soup doctor --config soup.yaml

A field can be declared, validated and documented and still be read by nothing on the backend you chose. That is what this whole page is about, and v0.75.0 added the command that tells you before the run instead of during it.

It loads the config, prints Config check - task=<t> backend=<b>, and then either lists the settings your config switches on that the backend does not read, with the reason and the issue that recorded it, or says None of the N setting(s) known to be unread on task=<t> backend=<b> is switched on in this config. Only fields you actually set to an on value are listed, never the ones sitting at a schema default, written at their schema default, or written in their off position (loss_watchdog: false is not reported): a wall of hundreds of rows is not a pre-flight check.

The scope is deliberately narrow, and that is the honest framing. At v0.78.0 the table has eleven declared (task, backend, modality) entries, counted by running the binary: sft on mlx with text data, 8 settings, all reported as ignored (use_galore, use_ring_attention, use_flash_attn, data.train_on_prompt, use_liger, neftune_alpha, moe_lora, use_fsdp2_compile); sft on mlx with vision data and with audio data, 7 each (the same list less use_flash_attn, use_liger and moe_lora, plus data.mask_history and data.train_on_messages_with_train_field, which print as rejected there: native selective message masks support text SFT only); dpo, orpo, simpo and kto on mlx with 5 each (use_galore, use_ring_attention, neftune_alpha, moe_lora and use_fsdp2_compile: the SFT list less data.train_on_prompt, which is not listed for a preference task, and use_flash_attn and use_liger, which the loader refuses there); the same 5 for task: preference with preference_loss dpo, orpo or simpo (its heading still reads task=preference); grpo on mlx with 4 (use_galore, use_ring_attention, moe_lora and use_fsdp2_compile; the loader refuses the other MLX settings for GRPO, so only these four can print there); sft on unsloth with none left; and sft on transformers with vision or audio data, with one each (data.mask_history, printed as ignored). The counts are what the binary prints for a config with none of them switched on (None of the 8 setting(s) ... on MLX text SFT, None of the 7 ... on MLX vision and audio, None of the 5 ... on a preference task, None of the 4 ... on GRPO). Running soup doctor --config on an MLX text SFT config that switches all eight on prints an eight-row table. Every other task-and-backend pair has no table, so for those the command prints the None of the N setting(s)... line, which there means "not reviewed" and never "checked and fine" (a DPO config on the transformers backend setting use_ring_attention: true, which no trainer applies, gets that line). Upstream tracks that gap itself (#1815).

History of the table's size: at v0.77.2 it was nine entries, with 10 settings on MLX SFT (the eight above plus data.train_on_messages_with_train_field and data.mask_history), and an MLX vision or audio config fell back to that list of 10. v0.78.0 removed the two mask rows from MLX text SFT, because native MLX text SFT reads both now, and gave MLX vision and audio their own entries. At v0.77.1 it was the same nine entries with 12 settings on MLX SFT and 9 on each preference task; v0.77.2 removed the rows that could never print, because the loader refuses the setting first (use_lorafa and quantization_aware on every MLX task, and use_liger and use_flash_attn on the four preference tasks and on GRPO), so a config that sets one of those gets Config could not be loaded (see above). and exit 2 instead of a table row. At v0.77.0 it was eight entries, without GRPO, which the loader refused on MLX; at v0.76.x it was four entries, with 18 settings on MLX SFT (seed, data_seed and use_mod among them, and three marked rejected); it was seven entries on one pair through v0.75.2.

Backend support is declared by hand rather than inferred, because inference does not work: reachability over the import graph detected none of five independently-known MLX gaps, reading the trainer module alone invents gaps for fields that live in helper modules, and --dry-run exits before a trainer is ever constructed. A guard keeps the table honest in both directions, so an entry marked unread fails the suite once any declared module reads the field.

soup doctor --config exits 2 when the config cannot be read, parsed or validated — all three deliberately agree, so this leg can gate CI — and soup doctor exits 1 when a required core dependency is missing or out of range, while the optional [train] group stays advisory.

Two disclosures upstream publishes with it, and they belong here. Five entries were removed from that table before merge, because the same release wired those fields — the guard is what noticed. And the all-clear message overclaimed: the field-consumer guard behind it catches a field nothing reads, not a field something reads wrongly, and a CUDA-only kernel setting that nobody declared is absent from the table. use_liger was the example through v0.75.2, when the message read "Every setting this config writes is read on this backend"; since v0.76.0 use_liger is one of the ignored entries (one of the 8 on MLX SFT at v0.78.0, 10 at v0.77.2, 12 at v0.77.1) and the message is the narrower None of the N setting(s)... line. Read that line as "nothing in the declared table is switched on", which is a narrower statement than "every setting is read".

Limitations

  • Single-device only, no distributed MLX training.
  • Base models must be MLX-format (typically from the mlx-community HF org). GRPO takes a dense base or one pre-quantized at 4 bits in affine mode; any other quantized base is refused after it loads (see GRPO on MLX). Through v0.77.1 GRPO took a dense base only.
  • Upstream's Known Limitations for v0.77.2 say task: preference (DPO, ORPO and SimPO only) and MLX GRPO on 4-bit mlx-community bases are covered only by the hosted macOS MLX test job, that MLX itself was not exercised by hand before the release, and that the mlx extra's declared floor is tracked in #2471 (Since closed in v0.78.0: the extra declares mlx>=0.31.2, #2779). Upstream's Known Limitations for v0.78.0 say the same of every Apple Silicon feature of that release (chat, merge, caches, vocabulary expansion, RoPE extension, dense Llama SFT, preference and GRPO): covered only by the hosted macOS MLX test job and fixtures, by design, with no issue open for it. MLX GRPO still refuses --resume, 8-bit and mixed-bit bases, mxfp4, mxfp8 and nvfp4, quantized MoE and BitNet layers, lora.r: 0, custom or ensemble reward_fn settings and non-text modalities.
  • Base-revision binding (v0.78.0, #1902, #2884, by @vaputa). A single-process soup train on backend: mlx with a Hugging Face base is bound to one commit now: the RoPE configuration read, the model and the tokenizer load at that commit, and the run row and soup_run.json record it. A provider other than Hugging Face (ModelScope through mlx-lm) and a distributed launch are not bound and print Base revision: unknown (<reason>; existing loading behavior preserved); offline mode and a local directory are not bound either and print Base revision: unknown (existing loading behavior preserved), and a cache path prints Base revision: cache-path metadata; local bytes are unverified. MLX sweeps and the MLX inference, chat, serve, merge and export paths are outside it, and #1902 stays open for Unsloth loads and for local and cached-path hints. This was read from upstream's changelog and commit message and from the code; it was not run on Apple Silicon.
  • bitsandbytes is unused on this backend: quantization comes from the MLX model itself.
  • Unsloth backend is not MLX-compatible (they're separate execution paths).
  • Apple Silicon streaming and MPS training are experimental. v0.74.0 turned on BF16 autocast for hardware-validated resident supervised, DPO, reward-model, PRM and GRPO training on capable MPS runtimes behind a live capability probe, with the process-reward path deliberately keeping fp32 master weights to avoid a fatal Metal optimizer dtype mismatch, and unvalidated MPS and CPU staying fp32. Layer streaming keeps its host store genuinely on the CPU there, refusing any allocation that is not real CPU memory, and preserves a BF16 checkpoint instead of silently doubling the store and disk cache to FP32. No claim is made that streaming fits a larger model or runs faster than resident MPS training, and backend: mlx is still rejected with stream_layers because they are separate model-loading paths.
  • On the transformers backend on Apple Silicon MPS (not backend: mlx), soup train, soup sweep and soup bench train set HF_DEACTIVATE_ASYNC_LOAD=1 since v0.77.0 unless you exported a value, because transformers' threaded weight loader crashed soup train with SIGABRT on some setups (#2076, #2040). soup doctor shows the value in its MPS panel. An MLX run's device is mlx, so nothing is set there.
  • Seeded since v0.77.0 (#1855, by @dryn85-max). On SFT, training.seed seeds MLX's own RNG (mx.random, which draws LoRA A and dropout) before the adapter is built, and numpy's global RNG, which mlx-lm's batch shuffle draws from, is seeded with training.data_seed (or training.seed when that is unset) right before training. DPO, ORPO and SimPO seed mx.random and their batch order the same way; KTO runs in dataset order, as TRL's KTO does. GRPO seeds mx.random and shuffles its prompts each epoch from training.seed; its data_seed does not change the order (v0.77.1). An unset seed resolves to 42. Upstream's check is that two runs with the same seed reproduce each other's losses. Through v0.76.1 MLX seeded neither RNG and only warned MLX backend ignores: training.seed, so every run trained on a different batch order, and a run started before v0.77.0 cannot be reproduced. See seeds and reproducibility.
  • The settings refused at config load are listed under Refused at load on MLX above. use_flash_attn, use_liger, use_ring_attention and use_fsdp2_compile are listed as ignored by doctor --config, but soup train stops on each of them before the MLX trainer starts (their CUDA pre-flight checks run for every backend, --dry-run included, exit 1), so leave those four out. The other ones in the table that are only ignored (moe_lora, neftune_alpha and so on) still load: the MLX trainers print MLX backend ignores: training.neftune_alpha, for example, and soup doctor --config lists it. reasoning_effort and train_on_eot on MLX SFT are not in that group: they are refused at load since v0.77.2.

If you resumed an MLX run before v0.74.0, it started from scratch

--resume auto and a direct --resume <path> only recognised checkpoint-N directories, which is the shape the transformers and Unsloth paths write. mlx-lm's tuner saves step-numbered NNNNNNN_adapters.safetensors files instead, so an MLX run's own output never matched, and training silently restarted from zero every time.

The located checkpoint's adapter weights are loaded before training starts now, and what that is, is stated plainly: a weights-only warm start, not a full resume. mlx-lm's LoRA trainer exposes no optimizer state and no step count, so the step counter and the data position both restart at zero however far the checkpoint got, and the run says so rather than implying otherwise. The same fix also covers a config with experiment_name set, which the first attempt missed.

The same holds for the native preference tasks (v0.77.0). ORPO, SimPO and KTO refuse a checkpoint that has no adapter_config.json beside it, or that names another task or another base, before any tensor loads, and since v0.77.2 DPO does too (#2321), an MLX SFT adapter included. DPO and KTO compute their reference log-probs from the base model before the checkpoint's weights load, so the reference is always the base. A DoRA warm start refuses missing, extra or differently shaped tensors, magnitudes included. GRPO (v0.77.1) refuses --resume and --hf-resume outright, because it saves only the adapter and a restart would not continue the same run.

If you ran Adafactor on MLX before v0.77.2

Warning:

Re-run this if the learning rate mattered. Upstream's release notes say that MLX Adafactor (backend: mlx, training.optimizer: adafactor) now applies the configured learning rate, warmup and schedule, so an existing run trains differently (#2484). The changelog describes the old behaviour as Adafactor's "default relative steps and parameter scaling" instead of your settings.

If youWhat happenedWhat to do
Trained on backend: mlx with training.optimizer: adafactor through v0.77.1The configured learning rate, warmup and schedule were not applied (#2484, @vaputa; the Adafactor slice of #1811)Re-run if you wanted the schedule you configured. The same config on v0.77.2 trains differently, so its results change

If you set use_rslora or a rank pattern on MLX before v0.77.0

Both settings loaded on backend: mlx through v0.76.1 and were never applied, so the run finished and the adapter was not the one the config asked for.

If youWhat happenedWhat to do
Set lora.use_rslora: trueThe run trained plain-LoRA scaling, alpha / r: an 8x smaller update than asked at the default r: 64, alpha: 16 (#1899)Re-run if you wanted rsLoRA. On v0.77.0 the same config trains at alpha / sqrt(r) and its results change; drop the flag to keep the old scale
Set lora.rank_pattern or lora.alpha_patternThe config loaded, passed soup train --dry-run and trained a uniform adapter from the scalar lora.r and lora.alpha; soup doctor --config listed nothing (#1996)v0.77.0 refuses the keys on MLX. Deleting them changes nothing about what trains; if the per-module ranks mattered, train on backend: transformers, which applies them
History:

Known limitation, open through v0.75.2 and since closed in v0.76.0: soup doctor never reported MLX. The MLX version always read unknown, because _get_mlx_info() was defined in the doctor command and called from nowhere. soup doctor now prints the MLX panel described under Diagnostics. soup doctor --config soup.yaml was never affected: that leg reads the config rather than the runtime.

If you trained on this backend before v0.73.1, re-run it

Two defects meant an MLX run could complete successfully and be worthless, and both are repaired in v0.73.1.

  • backend: mlx never dispatched to the MLX trainer at all. It fell through silently to the transformers path. And without a freeze first, what it saved was not an adapter but a full fine-tune: 172 tensors where 24 were expected on a 1.2B model.
  • The MLX adapter_config.json saved target_modules unresolved, as {"keys": ["auto"]}. Loading that file dropped every LoRA tensor without a word, so generation with the adapter was bit-identical to the base model. Since auto is the schema default, this was every MLX run that did not name its modules by hand. The file cannot be repaired after the fact; the run has to be redone.

Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.