Skip to content

Data Mixing Optimizer & Dynamic Curriculum (v0.48.0 — BETA)

soup data mix --optimize

A search over per-dataset mixture weights. By default the objective is a synthetic proxy rather than your data; --live swaps in short training runs.

bash
# Offline dry run: exercises the budget tracker and the recipe writer only. The proxy loss
# is a fixed function of the weights and never reads your data, so the weights mean nothing.
soup data mix --optimize \
  --datasets sft.jsonl,preference.jsonl,instruct.jsonl \
  --output mix.yaml

# The real search: each candidate mixture runs a short soup train from your base config.
soup data mix --optimize --live --base-yaml soup.yaml \
  --datasets sft.jsonl,instruct.jsonl --budget 2h --num-probes 12 --output mix.yaml

# --apply does not write a dataset. It prints the data: block to splice
# into your soup.yaml, so the mixture is resolved at training time.
soup data mix --apply mix.yaml

Without --live the search is synthetic. The default proxy loss is a fixed function of the weights, smallest at the uniform mixture, and it never reads your datasets, so the recipe it writes says nothing about them. --live requires --base-yaml (a soup.yaml that supplies base, task, training and output) and trains each candidate for a short run, capped per candidate at the budget divided by the probe count, between 60 seconds and 30 minutes. --budget (default 1h), --num-probes (1 to 256, default 8), --seed and --overwrite (an existing --output is refused without it) apply to both modes; --output defaults to mix_recipe.yaml, and --datasets takes at least two paths under the current directory. Install soup-cli[mix] for the scikit-optimize loop; without it a seeded random sampler is used.

The emitted recipe now renders data.train as the full dataset list, index-aligned with interleave.probs, rather than collapsing to the single highest-weighted dataset the way it had to before data.interleave was read at training time. Each entry is written as the dataset's absolute path, because the paths you pass are resolved first, so the recipe is tied to the directory it was generated in: rewrite data.train as relative paths before you commit it or move it to another machine.

Since v0.77.2 soup data mix --apply prints each path in the train: list as a double-quoted YAML scalar, with non-ASCII characters as YAML escapes, so pasting the block into soup.yaml keeps a name such as on, #data or odd: name.jsonl exactly as it is, and a long path is not wrapped (#2502 by @Nari-Ab; read in the code at the tag, not run).

--apply exit codes (v0.78.0, #2905, #2946, by @Nari-Ab). A recipe whose YAML does not parse now exits 2 (apply failed: while parsing a flow sequence ...), and so does a data.interleave.probs that is not numeric (apply failed: invalid data.interleave.probs in mixbad.yaml (could not convert string to float: 'abc')), before any snippet is printed. Through v0.77.2 both exited 1, the second after it had printed the panel. A missing recipe file and a recipe with no data: mapping were already exit 2. Weights that are numbers are still not checked: a negative or zero weight in interleave.probs prints the snippet and exits 0 on v0.78.0 (run with -1), so do not read exit 0 as "the weights are valid". --apply also accepts an --output and ignores it: nothing is written (the run printed the block and exit 0, and no file appeared).

BudgetTracker caps wall-clock and token budget per search.

--output is the recipe file. An --output that already exists is refused unless you pass --overwrite (write failed: output_path already exists (use overwrite=True), exit 2).

--output must not be one of the inputs (since v0.77.2). soup data mix --optimize refuses an --output that is the same file as any --datasets entry, or as --base-yaml with --live, before it reads anything, even with --overwrite: exit 1 with --output 'a.jsonl' is the same file as --datasets 'a.jsonl'; choose a different --output (#2226, #2274 by @kok-o; run on v0.77.2). At v0.77.1 soup data mix was not among the eighteen commands that refuse an output that is an input, upstream listed it as not checked yet, and with --overwrite nothing stopped it from replacing one of your --datasets files. --apply only prints a recipe and writes no file. See Data tools.

Since v0.73.3 the emitted recipe loads. It names the single highest-weighted dataset in data.train and keeps the full ranked breakdown as a comment, because at the time data.train was typed as a single string. v0.74.0 closed that: data.train now accepts a list, and two or more local paths are combined through data.interleave before the validation split runs, with streaming and Hub-name lists covered too.

Dynamic curriculum learning

yaml
training:
  curriculum: true
  curriculum_dynamic: true
  curriculum_buckets: 5
  curriculum_metric: loss      # length | perplexity | loss

DynamicCurriculumPolicy recomputes per-bucket weights every N steps from per-bucket loss and gradient-norm statistics and records them in curriculum_history.jsonl. compute_bucket_weights clamps to a stable simplex. These weights are telemetry. Nothing feeds them back into the sampler, and since v0.77.1 upstream's schema descriptions, reference entries and training guide say so too: the weights are written only to curriculum_history.jsonl, for soup runs curriculum-curve, and they do not change which samples a batch contains (#808, #2142 by @Nari-Ab). The behaviour is unchanged, so curriculum_dynamic: true records a trajectory and does not reorder or re-weight the data. (Through v0.77.0 the schema description of curriculum_dynamic began "BETA: dynamically re-weight curriculum buckets every N steps"; the behaviour was the same.)

Three keys shape what that policy computes. curriculum_dynamic_recompute_steps (default 50, 1 to 100000) is how often the weights are recomputed. curriculum_dynamic_temperature (default 1.0, above 0 and at most 100) is the softmax temperature on the uncertainty signal: higher flattens the weights and lower concentrates them on the hardest buckets. curriculum_dynamic_floor (default 0.05) is the smallest normalised weight any bucket can fall to; it must be above 0 and no larger than 1 / curriculum_buckets, so curriculum_buckets: 4 allows at most 0.25 and a larger floor is refused at config load. curriculum_dynamic itself requires curriculum: true.

Static curriculum: true is applied by the SFT trainer only, and it only sorts the training rows by text length. curriculum_metric: loss or perplexity prints a notice that the metric needs pre-computed scores and does the same length sort, and curriculum_buckets only matters to the dynamic callback: it does not shape the order, it sets how many buckets curriculum_dynamic reports.

Since v0.78.0 the sorted order reaches the model (#2863, #2924, by @abdumutalipabay0). The SFT trainer sets train_sampling_strategy: sequential, so the length-sorted rows are trained shortest first. This holds for text, vision, audio and RAFT rows on the transformers and unsloth backends. A pre-tokenized dataset, packing: true, multipack: true and backend: mlx keep the shuffled order, and none of them is refused. (Since closed in v0.78.0: through v0.77.2 Soup installed no sampler of its own for the sorted rows and the Trainer's default sampler is random, so the order never reached the model and a curriculum: true run had no short-to-long schedule. Checked on transformers 5.17.) The loss curve of a curriculum: true SFT run changes, because it sees its rows in another order, so compare it with a v0.77.2 run only knowing that; upstream lists it among the runs that are not bit-comparable with v0.77.2. Per upstream's docs, a run resumed from a checkpoint that a v0.77.2 run wrote continues the sorted order from the batch it stopped at, so in that epoch some rows it already saw can repeat and others are left out. On task: grpo with backend: mlx (native since v0.77.1) a curriculum or curriculum_* setting away from its default is refused when the config loads: training.curriculum is not applied by task='grpo' on backend='mlx': curriculum ordering runs on the transformers path only.

bash
soup runs curriculum-curve <run-id>
soup runs curriculum-curve <run-id> --history ./runs/$LAST/curriculum_history.jsonl

Renders the per-bucket weight curve over training.

Both features are BETA in v0.48.0. Symlink containment hardening lands across all file paths.

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.