Skip to content

Backends & Performance

Soup has three training backends: transformers (default), unsloth (Unsloth's own speed claim, not measured here; CUDA), and mlx (native Apple Silicon, new in v0.25.0).

Apple Silicon MLX Backend (v0.25.0)

Train on M1–M4 Macs without CUDA or emulation:

bash
pip install "soup-cli[mlx]"
yaml
base: mlx-community/Llama-3.1-8B-Instruct-4bit
backend: mlx
task: sft       # sft, dpo, orpo, simpo, kto or grpo (or preference with preference_loss dpo, orpo or simpo); every other task is refused on mlx

See the MLX backend guide for the six supported tasks (native DPO, ORPO, SimPO and KTO since v0.77.0, GRPO since v0.77.1; since v0.77.2 task: preference with preference_loss dpo, orpo or simpo runs the same native trainers, and GRPO also trains on a 4-bit mlx-community base, both covered upstream only by its hosted macOS MLX test job), what each refuses, diagnostics and MLX-native recipes. Since v0.78.0 soup chat --backend mlx and soup merge --backend mlx run natively, and MLX text SFT takes lora.r: 0 on an unquantized dense Llama model, linear rope_scaling_type, vocabulary expansion, freeze_layers / freeze_ratio on a full fine-tune, both selective loss masks and an existing pre-tokenized cache, each with conditions; upstream covers all of it only with its hosted macOS MLX test job and fixtures, and the guide has the details and the refusals.

Unsloth Backend

Unsloth's own documentation claims 2 to 5 times faster training and about 80% less VRAM; Soup publishes no measurement of either.

Use the Unsloth backend for significantly faster training and up to 80% less VRAM:

bash
pip install "soup-cli[fast]"

Add one line to your config:

yaml
base: meta-llama/Llama-3.1-8B-Instruct
task: sft
backend: unsloth    # Unsloth's own claims (2-5x faster, -80% VRAM), not measured here

data:
  train: ./data/train.jsonl
  format: alpaca

training:
  epochs: 3
  lr: 2e-5
  quantization: 4bit
  gradient_checkpointing: true   # keeps Unsloth's checkpointing kernel on (v0.77.0)
  lora:
    r: 64
    alpha: 16

Works with the tasks that have an unsloth setup: SFT (text only: since v0.77.0 SFT with modality: vision or audio on backend: unsloth is refused at config load, where it used to run the transformers setup without a word, #2015), DPO, GRPO, PPO, KTO, ORPO, SimPO, IPO, BCO, preference, Pretrain, Embedding and TTS. The other ten (reward_model, prm, classifier, reranker, cross_encoder, distill, unlearn, moe_lora_routing, online_dpo and asr) have no unsloth setup, so backend: unsloth is refused at config load for them (#1357). Before v0.76.0 seven of them (reward_model, prm, classifier, reranker, cross_encoder, unlearn and moe_lora_routing) loaded and trained on plain transformers while soup train printed unsloth (fast mode); distill was refused by #1186 in the same release, and asr and online_dpo already had their own refusals.

On the unsloth backend lora.use_dora, use_vera and a non-random init_strategy, moe_lora, freeze_layers, freeze_ratio, rope_scaling_type, quantization_aware: fp8, fp8_attention and nvfp4 are refused at load: unsloth builds its own adapter and kernels and never reads them. Since v0.77.0 so are quantization: 8bit (Soup's Unsloth loader passes load_in_4bit only, so 8bit loaded the model in 16-bit with no word, #1946; use 4bit, none, or backend: transformers for 8-bit), a non-default moe_aux_loss_coeff (that setup never applies the auxiliary loss, #1749), and lora.rank_pattern / alpha_pattern (the loader attaches every adapter from one scalar lora.r and lora.alpha, #2153; an empty {} still loads). Since v0.77.2 so are training.use_flash_attn and training.use_liger on task: sft with backend: unsloth (#2278, by @abdulwaarith0): the Unsloth setup loads its own model, with no Liger patch and no attn_implementation, so through v0.77.1 the config loaded and the run ignored them. soup train exits 1 and soup doctor --config exits 2; use backend: transformers or leave the keys out (false loads too, but null is not a boolean and fails with Input should be a valid boolean). reasoning_effort and train_on_eot still load on the Unsloth path.

Since v0.77.2 (#2376, by @ryznren) the VRAM pre-flight prices a backend: unsloth run with the seven automatic LoRA targets (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj) when lora.target_modules is auto, and prices the embedding and output head of a 4-bit load at 2 bytes a parameter instead of the Transformers backend's fp32. That rests on one load-and-inject observation on an RTX 5090 (unsloth/Meta-Llama-3.1-8B-bnb-4bit, the record) that ran no forward or backward pass, so there is no Unsloth training-peak measurement behind it.

Gradient checkpointing is honoured on Unsloth since v0.77.0 (#1981). It was hardcoded to Unsloth's checkpointing kernel, so training.gradient_checkpointing: false changed nothing. Now false, the schema default, turns checkpointing off, and true (or a tier) enables Unsloth's kernel; layer streaming keeps it off because it already checkpoints every layer. A config that leaves the key unset now trains without checkpointing on Unsloth: set gradient_checkpointing: true to keep the memory you had. lora.use_rslora is applied on Unsloth since v0.77.0 too; see rsLoRA below.

Tip: Soup auto-detects unsloth. When it is installed, soup train prints a hint if you haven't enabled it yet and your config would load with it: there is no hint for a task with no unsloth setup, or for a config using freeze_layers, rope_scaling_type or moe_lora.

Performance Optimizations

yaml
training:
  use_liger: true             # Liger Kernel fused ops (gains depend on the workload and the stack)
  use_flash_attn: true        # FlashAttention v2/v3 auto-detection
  gradient_checkpointing: true  # Required for long sequences

Both keys are read by the SFT trainer only (and by tts, which trains through it); on any other task they are refused at config load (v0.76.0, #806), and with stream_layers: true too, because streaming builds the model itself and never reaches either kernel. Since v0.77.2 they are also refused inside task: sft on the paths that never read them: modality: vision or audio (the vision and audio setups build their own dataset and model), and backend: unsloth. On backend: mlx the loader accepts them, but soup train stops on them before the MLX trainer starts (a CUDA-only check, exit 1, --dry-run included): leave them out. A value of false loads (#2278, by @abdulwaarith0); null is not a boolean and fails with Input should be a valid boolean; the full path table is on Settings Soup refuses at load. Two end-to-end training measurements of Liger exist, and neither is a promise. The v0.73.0 H100 point (12.9% less VRAM, 1.051x throughput, one setup) replaced an earlier "20-60% memory savings" claim that upstream corrected in the same release. Since v0.78.0 a second record, one shared H200 (Llama-3.1-8B bf16 resident, LoRA r16, batch 4, ratios of five-run medians to the native SDPA step), reads Liger alone at 1.197 to 1.229x the throughput with 21.6 to 54.7% less allocated peak, and FlashAttention 2 alone at 0.929 to 0.989x with about the same peak; the record says the SDPA baseline already ran fused cuDNN flash kernels, that the card was shared, and that these are "not universal speedups or a training-quality recommendation". It also notes that the Liger path disables Soup's logits-based rewind recorder, because its fused loss exposes no logits. Upstream's own yaml comment dropped the 12.9% figure and now says gains depend on the workload and the stack. See Speed and memory.

use_flash_attn needs a CUDA device and asks transformers which implementation is installed: FlashAttention 3 if it reports one (that is the separate flash_attn_3 package, not flash-attn), otherwise FlashAttention 2, otherwise nothing. Before v0.73.0 the FlashAttention 3 branch tested flash_attn.__version__ for a 3.x number, which no real install reports, so on Hopper hardware the setting silently fell back to FlashAttention 2 or SDPA while the docs advertised 3. v0.73.0 fixed the detection (#334). Upstream is explicit that this makes detection honest and does not make FlashAttention 3 measurable on its test hardware, so this site publishes no FlashAttention 3 speed or memory figure.

Install optional packages:

bash
pip install "soup-cli[liger]"       # Liger Kernel
pip install flash-attn --no-build-isolation  # FlashAttention
pip install "soup-cli[ring-attn]"   # Ring FlashAttention

Long-Context Training (128k+)

yaml
training:
  rope_scaling_type: yarn       # linear, dynamic, yarn, llama3
  gradient_checkpointing: true

data:
  max_length: 131072            # Up to 1M tokens supported

rope_scaling_type is read by task: sft, tts and pretrain on backend: transformers (for sft, the plain text path without stream_layers), and it only does something when data.max_length is larger than the model's native context: the scaling factor is that ratio, worked out for you. Since v0.76.0 the RoPE configuration is built before the model is constructed, because transformers 5 derives the rotary frequencies in the model constructor. Through v0.75.2 the trainer wrote the factor into model.config after the model had loaded, which in a check on a small randomly initialised Llama changed neither the rotary frequencies nor the outputs while the run printed Long-context enabled (#793). On any other task, on backend: unsloth, on vision or audio SFT, or with stream_layers: true, the key is refused at config load (#1697), and so is it on backend: mlx except for one case: since v0.78.0 native MLX text SFT accepts rope_scaling_type: linear with quantization: none (any other type, and any training.quantization other than none, stay refused; covered only by the hosted macOS MLX test job and fixtures), and longrope is refused everywhere (#1239). yarn_factor, yarn_attn_factor, yarn_beta_fast and yarn_beta_slow are read, with rope_scaling_type: yarn only. See Long context for the details and the Llama 3.1 composition rule.

use_ring_attention is different: it is accepted and checked before training (CUDA, at least two GPUs, ring-flash-attn installed, max_length of 8192 or more), and nothing in v0.78.0 applies Ring FlashAttention to the model afterwards, so sequence parallelism does not happen.

Multi-GPU Training

DeepSpeed

bash
soup train --config soup.yaml --deepspeed zero2          # ZeRO Stage 2
soup train --config soup.yaml --deepspeed zero3          # ZeRO Stage 3
soup train --config soup.yaml --deepspeed zero2_offload  # Stage 2 + optimizer offload
soup train --config soup.yaml --deepspeed zero3_offload  # Stage 3 + CPU parameter offload only, the optimizer stays on the GPU (v0.73.0)
soup fetch deepspeed_configs zero3-cpu-offload  # writes the bundled ZeRO-3 CPU-offload JSON to edit and pass to --deepspeed

FSDP2 (PyTorch Native)

bash
soup train --config soup.yaml --fsdp full_shard    # Like ZeRO-3
soup train --config soup.yaml --fsdp shard_grad    # Like ZeRO-2
soup train --config soup.yaml --fsdp full_offload  # With CPU offload

To span several machines, soup train takes --nodes, --node-rank, --master-addr and --master-port (v0.76.0); see Multi-GPU Mastery.

No GPU at all: train on a serverless cloud one

The rest of this site is about making a small card work. If you have no card, --cloud modal renders a self-contained Modal app from your soup.yaml and runs it on a per-second-billed GPU. --cloud lambda and, since v0.77.0, --cloud runpod are described below.

bash
pip install "soup-cli[modal]"    # only needed to submit live

# Plan-only, the DEFAULT: write the stub and print the modal run command.
soup train --config soup.yaml --cloud modal --gpu a100

# Submit live (authenticate once with `modal setup`, or set
# MODAL_TOKEN_ID and MODAL_TOKEN_SECRET).
soup train --config soup.yaml --cloud modal --gpu a100 --cloud-submit

--gpu accepts t4, l4, a10g, a100 (the default), a100-80gb, l40s and h100.

Plan-only is the default and that is deliberate: nothing is submitted, and nothing is billed, until you add --cloud-submit. You get the generated soup_modal_app.py and the exact command, so you can read what would run before it does. Since v0.77.1 --cloud-submit finds the modal command the same way as the other external programs, in an absolute PATH directory; if it is not there, Soup stops with a message that says the Modal CLI was not found on PATH, how to install it (pip install "soup-cli[modal]") and to make sure its scripts directory is on PATH.

Your effective config (the file with every command-line override applied, since v0.78.0) is base64-embedded as data, not interpolated as code, so nothing in the YAML can execute in the generated stub and no secret is written into it. The image pins soup-cli[train] to the version you are running locally, writes the embedded config inside the container, and runs soup train on the chosen GPU.

Where the checkpoints end up is the part that was missing until v0.75.1, and the answer used to be nowhere. The container is ephemeral, so when the run finished it took the outputs with it, while the entrypoint printed a line telling you to download checkpoints from a directory that had none. Outputs now go to a Modal volume named soup-outputs, created on first use, in a directory named after the run, committed in a finally so a crashed run keeps what it produced, and downloaded into your local output directory at the end including after a failure. When the download completes, the command also prints a modal volume get soup-outputs /<run name> <output dir> --force line that fetches the files again (they land under <output dir>/<run name>). Since v0.78.1 the command is on its own line and the path in it is quoted: a path with spaces or punctuation goes in double quotes, and a nested Windows path gets forward slashes. A path that needs shell-specific quoting, such as one with $, gets instructions in prose and a separate path display instead. If the download fails after a failed run, it prints Could not download outputs after the failed run: ... and re-raises the training error, which is the one to read.

Both cloud paths now refuse an output that leaves the working directory, at plan time. An absolute path, or one reaching upward with .., is rejected before anything is provisioned rather than after. That matters most for the case it was written for: a soup.yaml shared between people, where the output path was written on somebody else's machine.

A cloud plan refuses what a remote machine could not run (v0.78.0, #2627). --cloud ships only the config, not your files. For every provider the plan stops with Cloud plan failed: ... and exit 2 when the config points at local input files: data.train, an image, audio or video directory, a replay set, a tokenized path, a reward .py file, an eval-gate suite or baseline, or a local model path (base, training.teacher_model, reward_model and the like). Hub dataset and model ids and scheme:// URIs pass. All 21 built-in soup init templates set a local data.train (./data/train.jsonl for chat, another ./data/*.jsonl name for most of the others), so soup init --template chat followed by soup train --cloud ... exits 2 until data.train is a Hugging Face Hub dataset id; the message says so. --push-as and --gate are refused with --cloud, also exit 2 (--push-as is not supported with --cloud: it runs locally, against local files and a local HF repo, and a cloud run would silently ignore it. Run without --cloud, or drop the flag.). The stub carries the effective config, so --reward-hack-detector, --replay* and the other command-line overrides now reach the remote run; through v0.77.2 it carried the file's text and an override was dropped (upstream's description). The effective config is loaded again before the stub is written, so a combination the schema refuses stops at plan time (read from commands/train.py, and run with --reward-hack-detector info_rm on an sft config: Cloud plan failed: the effective config ... would be refused on the remote machine, exit 2). Uploading the files is out of scope.

Lambda Cloud (v0.74.0)

bash
soup train --config soup.yaml --cloud lambda

--gpu takes one of exactly four Lambda instance types: a10, a6000, a100 and h100. That list is shorter than Modal's, so a value that works there (t4, l4, a10g, l40s) is refused here. You need LAMBDA_API_KEY, LAMBDA_SSH_KEY_NAME and LAMBDA_SSH_PRIVATE_KEY in the environment, with the public key already registered in your Lambda account; LAMBDA_REGION is optional and defaults to us-tx-1. Output paths must be relative, without .. and, since v0.77.1, without a path part that starts with - (Cloud plan failed: Lambda output_dir parts must not start with '-', exit 2, as --cloud runpod already refused it). Keep the local controller running until it reports termination: shutting down the guest does not stop the billing, the controller does. Since v0.76.0 the controller polls training status over short SSH connections with keepalive probes instead of holding one session open. It tolerates network drops for up to 15 minutes, with exponential backoff capped at 60 seconds, before it terminates the instance to prevent runaway billing, and the checkpoint copy back is retried for the same window. Since v0.77.0, when soup train on the instance exits non-zero, the controller fetches the last 50 lines of /home/ubuntu/soup/train.log over SSH (at most 50,000 bytes, control characters stripped) and prints them under Remote log tail (last 50 lines): before it terminates the instance (#1774); if that fetch fails it prints Could not fetch remote log tail: ... and terminates the instance anyway. Since v0.77.2 that log is created before the first step that can fail and also holds the apt-get and pip install output, so a failure in the instance setup or the install shows in the tail instead of Could not fetch remote log tail (#2282, by @EtherealMelon). Through v0.77.1 the log held only soup train's own output, so such a failure was not in it.

Plan-only by default, like Modal. Since v0.77.0 --cloud-submit starts the local controller with an isolated interpreter (python -I) and only the environment it needs: the Lambda settings, the variables ssh and scp use, and the proxy, certificate, SSH-agent and library-path settings; the printed manual command is python -I <stub> (#2091). Since v0.77.1 the controller runs ssh and scp by the absolute path found in an absolute PATH directory, with its environment minus LAMBDA_API_KEY, and passes -- before the source of the checkpoint copy; if either program is missing it prints OpenSSH ssh and scp must be installed and on PATH before Lambda submission. and exits 2 before an instance is launched. The design decision worth knowing is where the credential lives: the API key never enters the instance. Termination belongs to a local controller, and its finally both terminates the instance and polls to confirm that the termination actually happened, rather than firing the call and assuming.

That guarantee had a hole until v0.75.1, and it cost money rather than data. Pressing Ctrl+C during --cloud-submit killed the controller a quarter of a second later, while it was still inside the finally that terminates the paid instance, so the instance could keep running and keep billing. Two narrower windows survived the first fix and were closed after it: a signal arriving between the process being spawned and the guarded region being entered, and one landing on the "still waiting" notice, which is written from the interrupt handler itself. soup now waits for the controller across the interrupt. Check your Lambda console for a still-running instance if you ever interrupted a submit on an earlier version. Two scopes upstream states rather than implies: the fix is Linux and macOS, because the POSIX signal test needs a real process group and is skipped on Windows, and the one way left to skip the cleanup is to kill the controller process itself from another terminal, which can still leave the instance running. Upstream is explicit that the Lambda submission path still needs a paid live-validation pass before it can be described as provider-validated; plan-only rendering and the lifecycle boundaries are covered by offline tests.

RunPod (v0.77.0)

bash
# Plan-only, the default: writes soup_runpod_app.py and contacts nothing
soup train --config soup.yaml --cloud runpod --gpu rtx4090

# Submit live (both variables are required; the second is a path)
export RUNPOD_API_KEY=...
export RUNPOD_SSH_PRIVATE_KEY=~/.ssh/id_ed25519
soup train --config soup.yaml --cloud runpod --gpu rtx4090 --cloud-submit

--gpu takes a100 (the default, an 80 GB SXM card), h100, a40, rtx3090 or rtx4090; any other value exits 2 with that list. No extra is needed: the controller uses Python's standard library and your local OpenSSH ssh and scp. RUNPOD_SSH_PRIVATE_KEY is the path of a private key whose OpenSSH public key sits beside it as <path>.pub; only the public key goes into the Pod. Without both variables --cloud-submit prints RunPod not configured. Set RUNPOD_API_KEY, RUNPOD_SSH_PRIVATE_KEY and exits 1.

A live run creates one Secure Cloud Pod reachable over SSH, creates a virtual environment at /workspace/venv that sees the image's installed packages (--system-site-packages), installs soup-cli[train] at the version you are running into it, runs /workspace/venv/bin/soup train --config soup.yaml --yes there, copies the configured output directory back and deletes the Pod. Before v0.77.2 the script installed into the image's system Python, which Ubuntu 24.04 can refuse as externally managed, and started soup by bare name (#2352, by @kok-o). That bootstrap has not been validated on a live Pod (#2192, #2098); a failed environment or install stops the script before training. Choose a fresh relative output: the plan refuses one that already exists (Cloud plan failed: output_dir already exists; choose a fresh directory for retrieval, exit 2) and one outside the working directory. As with Modal, your config is embedded as data, and the plan refuses one that carries your RUNPOD_API_KEY value or an inline credential field (api_key, token, hf_token, password and the like). Local files are not uploaded, and since v0.78.0 the plan refuses them (exit 2, Cloud plan failed: naming the field; see above): give base and data.train as Hub ids or scheme:// URIs. The local controller starts with an isolated interpreter (python -I) and an allow-listed environment, and runs ssh and scp by the absolute path found on PATH, without RUNPOD_API_KEY in their environment. If either is missing it prints OpenSSH ssh and scp must be installed and on PATH before RunPod submission. and exits 2 before a Pod is created (the v0.77.0 message did not say "and on PATH").

The controller makes one attempt and copies the results once, with a 15-minute limit, into a new directory next to the output path; a failed or timed-out copy removes that directory when it is empty and names it in the error otherwise. When the remote training command exits non-zero, the controller prints RunPod remote stderr tail (last 50 lines): (at most 50,000 bytes) before it deletes the Pod, with terminal controls removed and URL user information and four token shapes replaced by <redacted> before truncation (#2256, by @Nari-Ab). Upstream states what that masking does not cover: scheme-less user:pw@host, a raw # or ? in URL user information, and other token families such as a standalone GitHub ghp_ or AWS AKIA token, so do not treat the tail as scrubbed. The SSH readiness probe times out after 30 seconds and the remote training command after 25 hours, each with a message naming the step. It deletes the Pod afterwards, on failure and on Ctrl+C too, and since v0.78.0 treats it as gone only on evidence (RunPod reports it TERMINATED, the DELETE was accepted, or it is absent from the Pod list: a 404 to the DELETE is no longer proof that a billed Pod is gone, and the notice names the evidence); an unconfirmed deletion exits non-zero and names the run to look for in the RunPod console. A failed copy still deletes the Pod, so what did not come back cannot be fetched from it later.

Upstream's release notes say RunPod announced the retirement of REST API v1 for 2026-11-15 (#2854), and its changelog says an older Soup could then no longer create a Pod; before a RunPod job, upgrade a Soup older than v0.78.0 with pip install -U soup-cli. v0.78.0 talks to REST API v2 (https://api.runpod.io/v2, #2877, reported by @noncalan); the command line and the environment variables are unchanged. Read from the code at the tag: the create body is the nested v2 one; the wait reads status (a Pod in ERROR stops it with its own message) and takes the SSH address from ssh.direct or runtime.ports; a create whose reply was lost is looked for in the paginated Pod list; a 429 waits for an integer Retry-After of at most 60 seconds; a redirect, or a 404 or 410 without RunPod's own problem body, on the create is one message saying RunPod has probably retired or moved that API, with no Pod created. /workspace lives on the 80 GB container disk shared with the venv and the model cache, because v2 attaches no volume unless asked. This rests on RunPod's published reference, not on a real account.

It has not been run against a real RunPod account yet (tracked as #2098; upstream also lists that the remote script still depends on the Pod image's system Python, #2192): upstream's checks use mocked API and SSH transports, so the provider's behaviour, the copy back and the billing termination are still to be validated live. Watch the RunPod console on a first run.

--cloud takes modal, lambda or runpod. Any other value exits 2 with Invalid --cloud: <value>. Supported: modal, lambda, runpod. Through v0.76.1 --cloud runpod was a recognised name with no implementation behind it, and exited 2.

Quantization-Aware Training (QAT)

training.quantization_aware: true (int8 QAT) is refused at config load on every task and backend as of v0.76.0 (#1222). It never ran quantization-aware training. Where it was applied, it ran torchao's post-training int8 weight-only quantization over every Linear layer after LoRA, the adapter's own layers included, and froze them all, so a LoRA run had zero trainable parameters; elsewhere (backend: mlx, backend: unsloth, the other tasks' trainers, layer streaming) it was not applied at all. Remove the key. The "5-10% slower, better quality" claim that stood on this page described a feature that did not train.

Two other values of the same key are separate features with their own code paths:

  • quantization_aware: fp8 is FP8 training, covered on Speed and memory. Install pip install "soup-cli[qat]" for it.
  • quantization_aware: quest is an experimental mixed W4/A4 plus A16 route retained from an evaluation-only result. It requires task: sft, backend: transformers, modality: text, quantization: none, lora.r: 0, an explicit integer batch_size and auto_mixed_precision: false, and it refuses layer streaming, nvfp4, activation_offloading, freeze_layers, freeze_ratio, unfrozen_parameters, lisa_enabled and expand_layers. Upstream's own record of the strict W4A4 route is a failed gate (see Measurement records); the mixed route makes no packed-INT4, efficiency or training-quality claim. It also needs exactly one visible CUDA GPU of compute capability 8.0 or newer, checked when the trainer is set up (so soup train --dry-run does not catch it); on a multi-GPU box select one card with CUDA_VISIBLE_DEVICES.

To ship a smaller model, train normally and quantize at export: soup export --format gguf --quant q4_k_m.

Advanced LoRA Variants

DoRA (Weight-Decomposed LoRA)

yaml
training:
  lora:
    r: 64
    alpha: 16
    use_dora: true

use_dora is refused at load on backend: unsloth (it builds no DoRA, and the run used to train plain LoRA), and with quantization gptq, awq, aqlm or eetq (peft cannot apply DoRA to those layers and raised after the model had loaded). 4bit, 8bit, hqq:Nbit and an unquantized base are allowed. On backend: mlx DoRA is native since v0.77.0, for text SFT only (#1920, by @Amix29): dense linear targets on an unquantized or pre-quantized 4-bit base, with scalar lora.r and lora.alpha. use_rslora, rank_pattern, alpha_pattern, quantization: 8bit, a non-text modality and the MLX preference tasks are refused at load. See DoRA on MLX.

LoRA+ (Differentiated Learning Rates)

yaml
training:
  lr: 2e-5
  loraplus_lr_ratio: 16.0    # lr_B = lr x 16
  lora:
    r: 64
    alpha: 16

The ratio is applied on every LoRA task since v0.76.0 (through v0.75.2 only sft, pretrain and embedding read it, and the others trained B at the base rate). It is refused on prm, moe_lora_routing and unlearn, on classifier, reranker, cross_encoder and asr unless their LoRA flag is on with lora.r > 0, on backend: mlx, with lora.use_vera, with use_lorafa, with use_galore, and with optimizer apollo_adamw, lomo or adalomo. See Configuration. To freeze the A matrices instead, see LoRA-FA.

GaLore (Memory-Efficient Full-Parameter Training)

yaml
training:
  quantization: none          # Required: incompatible with quantization
  use_galore: true
  galore_rank: 128
  galore_update_proj_gap: 200
  galore_scale: 0.25

Note: GaLore requires quantization: none and backend: transformers (not unsloth).

NEFTune (Noisy Embeddings)

Add noise to embedding vectors during training for better generalization:

yaml
training:
  neftune_alpha: 5.0    # Noise magnitude (0.0–50.0, typical: 5–15)

NEFTune has been shown to improve instruction-following quality without extra data or compute. It is applied by the SFT trainer (and task: tts, which trains through it) and by the DPO, IPO, KTO, ORPO, SimPO and BCO trainers, so also by task: preference. Since v0.77.0 it is refused at config load on the 14 other tasks, any value including 0.0 (#1883); through v0.76.1 it was accepted there and never applied. On backend: mlx it loads and is not applied: the MLX trainers print MLX backend ignores: training.neftune_alpha, and soup doctor --config lists it.

rsLoRA (Rank-Stabilized LoRA)

Scale LoRA outputs by 1/sqrt(r) instead of 1/r for better training at high ranks:

yaml
training:
  lora:
    r: 128              # Higher ranks benefit most from rsLoRA
    alpha: 64
    use_rslora: true

The scale is alpha / sqrt(r) on every backend: PEFT's use_rslora on transformers, the scale Soup hands mlx-lm on MLX, and get_peft_model(..., use_rslora=True) on Unsloth. Through v0.76.1 backend: mlx and backend: unsloth loaded the flag and never read it, so an rsLoRA run there trained at the plain-LoRA scale alpha / r, an 8x smaller update at the default r: 64, alpha: 16. Since v0.77.0 they apply it, so the same config's results change: re-run if you wanted rsLoRA, or drop the flag to keep the old behaviour (#1899). MLX DoRA refuses it.

Tip: Combine NEFTune + rsLoRA + Unsloth backend for the best training quality and speed (rsLoRA reaches Unsloth since v0.77.0).

MoE Model Support

Fine-tune Mixture of Experts models (Mixtral, Qwen3-30B-A3B, DeepSeek V3):

yaml
base: Qwen/Qwen3-30B-A3B
task: sft

training:
  moe_lora: true               # Target expert + attention layers
  moe_aux_loss_coeff: 0.01     # Router load-balancing loss
  quantization: 4bit
  lora:
    dropout: 0.0               # required on a fused-expert MoE such as this one

Soup auto-detects MoE architectures. moe_lora is read by sft, tts, pretrain, dpo, kto, orpo, simpo, ipo, bco, grpo, ppo, online_dpo, reward_model, embedding, distill and unlearn, by the classifier family with classifier_lora: true, and by the shared layer-streaming setup. It is refused at load on asr, prm, moe_lora_routing, SFT with vision or audio, and backend: unsloth. Through v0.75.2 only SFT and pretrain read it (#798), so the DPO and GRPO MoE recipes that set it (eight in the v0.75.2 catalog, fifteen at v0.76.0; upstream's changelog says "8 DPO and 7 GRPO") trained attention-only LoRA, and on transformers 5 they could not attach LoRA at all (peft: No target_modules passed but also no target_parameters found). If you ran one of them, re-run. Expert adapters attach through peft's fused-parameter path (target_parameters) on qwen3_moe, deepseek_v3, glm4_moe, olmoe, qwen2_moe, qwen3_5_moe_text, minimax and mixtral (#1421; measured on tiny stand-ins with transformers 5.16.1 and peft 0.20.0, never on a real 30B+ checkpoint). minimax-m3-sft still trains attention-only LoRA, but because it sets no moe_lora: it loads through SFT's vision path, which never runs the MoE step. The seven kimi-k2.x recipes that set moe_lora are untested rather than known-good: through v0.77.2 no tiny stand-in for them built in the installed transformers. Since v0.77.0 one of them, kimi-k2-sft, is marked unavailable and soup recipes use kimi-k2-sft exits 3: the recipe sets quantization: 4bit, and the guarded resident route that v0.78.0 adds for Kimi-K2-Base and -Instruct admits task: sft and task: grpo at quantization: none only, with tiny-checkpoint evidence only and no K2 training run (kimi-k2-thinking-grpo stays refused: Thinking and Instruct-0905 have no supported route). See Streaming a Mixture-of-Experts base. moe_aux_loss_coeff is read by sft (text), tts and pretrain, and a non-default value is refused on every other task and, since v0.77.0, on backend: unsloth and with training.stream_layers: true, whose setups never apply the auxiliary loss (#1749).

Since v0.77.0 moe_lora: true keeps a string target_modules and adds the MoE targets to it (#2095), as it already did for a list. Through v0.76.1 a string was replaced by the MoE list: all-linear (what target_modules: auto resolves to on qwen4_exp) lost every linear layer the MoE list does not name, and a regex was dropped outright. Now all-linear is kept and only the fused expert parameters are added, and a regex becomes (?:<your regex>)|(?:<the MoE names>); a regex that does not compile is refused at setup, naming training.lora.target_modules, and one that matches no module is warned about. Under moe_lora a string never adapts a MoE router or shared-expert gate, even one your regex names: to adapt a router, name it in an explicit list. This did not hold on v0.78.0 with peft 0.22.0, where a string target could adapt the routers (#3133, #3150, fixed in v0.78.1): check such a run. The ScatterMoE LoRA: setup line says which of these happened. Under layer streaming the same rule applies, and an explicit list is no longer replaced (#2072). Before v0.77.0 such a run trained adapters on fewer modules than its config named (with a string target, every module the MoE list does not name; under streaming, every target the MoE list does not repeat, and an explicit list entirely): re-train it on v0.77.0 if those modules mattered. Separately, target_modules: auto on a DeepSeek-V3 base whose config sets q_lora_rank: null, such as Moonlight-16B-A3B, put adapters on the key/value and output projections and none on the query path, without a warning, through v0.76.1; since v0.77.0 the query projection is adapted (#2071).

On a transformers 5 fused-expert MoE (every in-library MoE family on the supported stack, Qwen3-30B-A3B included) moe_lora needs lora.dropout: 0.0, because peft adapts the fused expert tensors through a wrapper that refuses dropout; with the default 0.05 the attach stops with a message naming the flag. moe_lora with lora.use_vera is refused on such a model, and moe_expert_quant is refused on one at setup, naming the architecture.

Adapting routed expert tensors directly (v0.74.0)

moe_lora targets expert and attention modules. Some architectures keep their experts as raw 2-D or 3-D nn.Parameter tensors instead, which a module-level target cannot reach, so lora.target_parameters adapts those tensors through PEFT:

yaml
training:
  lora:
    r: 16
    alpha: 32
    dropout: 0                 # required: PEFT cannot wrap a raw parameter with dropout
    target_modules: auto
    target_parameters: auto    # routed gate_up_proj + down_proj tensors
    rank_pattern:
      experts.gate_up_proj: 2
      experts.down_proj: 2

auto resolves the architecture's registered parameter mapping, currently Qwen4-Exp routed experts, and fails closed when an architecture has none; an explicit list of parameter-name suffixes is also accepted, capped at 256 entries. The scope is narrow and every bound is refused when the config is read, not minutes into a run: task: sft or pretrain, backend: transformers, modality: text, plain LoRA or rsLoRA with init_strategy: random and use_dora: false, and not with training.stream_layers: true, which stays resident-only for now.

Two operational notes upstream states rather than leaves to be discovered: torch.compile may recompile or graph-break around parameter wrappers, and a parameter-targeted MoE adapter materializes a contribution for every expert at inference, so merge it into the base for deployment unless you need to hot-swap adapters.

Curriculum Learning (v0.23.0+)

Sort the training rows by length, shortest first, before they reach the trainer (the note under the example says what the trainer then does with that order):

yaml
training:
  curriculum: true
  curriculum_metric: length       # Sort by sequence length
  curriculum_buckets: 5           # 1-20 difficulty buckets

This sort is applied by the SFT trainer only, and it always orders rows by length, shortest first. curriculum_metric: perplexity or loss is accepted but prints a notice and falls back to the same length sort, and curriculum_buckets only appears in that printout. Only the curriculum_dynamic callback reads the other two metrics. Through v0.77.2 the sort reordered the list handed to the trainer, but Soup did not change the trainer's default sampler, which is random (checked on transformers 5.17, the stack v0.75.2 installs), so the model did not see the rows in that order. Since v0.78.0 (#2924) the SFT trainer keeps that order for text, vision, audio and RAFT rows on the transformers and unsloth backends. A pre-tokenised dataset, packing: true, multipack: true and backend: mlx keep the shuffled order, and nothing is refused. The loss curve of a curriculum: true SFT run changes with it, so compare it with an older run only knowing that.

Freeze Training (v0.24.0+)

Freeze bottom layers to reduce compute while preserving base knowledge. Only task: sft (and tts, which trains through it) applies this, on the text path with backend: transformers and no layer streaming; since v0.76.0 any other task, mlx, unsloth, vision, audio or stream_layers refuses the keys at config load instead of training every layer (#1497, #1581):

yaml
training:
  freeze_layers: 16               # Freeze bottom 16 layers
  # freeze_ratio: 0.5             # Or freeze 50% of layers

With LoRA, the adapter follows the freeze since v0.77.0 (#1432, #2145). A frozen layer gets no adapter, so freeze_layers: 16 with LoRA trains adapters only on the layers above the bottom 16. Through v0.76.1 the freeze was set before peft attached the adapter, which then put a trainable adapter on every targeted module in every layer, the frozen ones included, so the freeze did nothing on a LoRA run; such a config now trains fewer layers than before, which is what the option always documented, and its results change. Since v0.78.0 (#2201, by @xiemocun) this works with a list of module names in lora.target_modules and with a string target too (all-linear, a regular expression, or what auto resolves to): Soup resolves the string to the module names peft would pick, drops the ones outside the trainable layers, and prints Freeze-scoped targets: N module(s) resolved from target_modules='all-linear' inside layers C..T-1. A string that reaches no trainable layer, a list target that resolves only outside a numbered decoder layer (such as embed_tokens; a top-level lm_head entry is accepted), lora.target_parameters, lora.use_vera and a plan that freezes every layer are refused when the model is built, after the config loads, so soup train --dry-run does not catch them. (Since closed in v0.78.0: through v0.77.2 a string target was refused here.) Full fine-tuning (lora.r: 0) is unchanged.

Loss Watchdog (v0.24.0+)

Automatically stop training if loss spikes or diverges:

yaml
training:
  loss_watchdog: true
  loss_watchdog_threshold: 5.0    # Stop if loss exceeds threshold
  loss_watchdog_patience: 3       # Wait N steps before stopping

The watchdog is attached by every trainer that attaches the live training callback, which includes task: tts because it runs SFT's training loop. task: prm, task: unlearn and task: moe_lora_routing refuse loss_watchdog, loss_spike_recovery and grad_accum_auto_tune at config load (v0.76.0), naming the reason. backend: mlx refuses loss_spike_recovery and grad_accum_auto_tune, and since v0.77.0 accepts loss_watchdog on text SFT only, with its own watchdog that stops at a completed optimizer update and saves the last adapter (the MLX page). Training stability lists the trainers that do.

Sample Packing (v0.23.0+)

Pack multiple short samples into one sequence for efficient training:

yaml
training:
  packing: true                   # Enable sample packing (SFT and Pretrain)

Packed SFT keeps the assistant-only loss mask since v0.76.0 (#1236). Through v0.75.2 a packed SFT run trained on every non-first token, prompt and system tokens included; see Re-run this.

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.