Skip to content

soup adapters — git for LoRA

After 6 weeks of running experiments you have 30 adapter folders and no idea which one to ship. soup adapters (v0.57.0, finished in v0.67.0) treats LoRA adapters as first-class versioned objects.

soup adapters has eighteen subcommands. The table covers the git-for-LoRA set from v0.57 and v0.67 plus soup lock; list, info and compare are the basic inspection commands, arithmetic is v0.71.34, and check and audit are new in v0.76.0 and have their own page.

CommandWhat it doesShipped
soup adapters diffPer-layer Frobenius + relative drift + SVD effective rankv0.57
soup adapters merge5 strategies: linear / TIES / DARE / SVD / CMA-ESv0.57 + v0.67
soup adapters blameDataset-row attribution: the plan is real, the scores the CLI prints are synthetic (see below)v0.57 + v0.66
soup adapters branchName a LoRA config with SHA-pinned hashesv0.57
soup adapters checkoutCopy the branch's config back out; refuses if that file has changedv0.57
soup adapters branchesList everythingv0.57
soup adapters prGitHub-shaped PR markdown with eval-delta + sample diffsv0.67
soup adapters bisectBinary-search checkpoint history for regression boundaryv0.67
soup lock write / show / checkSHA256 closure over base, dataset and env; check exits 2 on drift (3 for a missing or unreadable lock)v0.67
soup adapters checkIs a LoRA adapter saved by the transformers path trained at all? One verdict line, alive or inactive: <reason>, exit 0 or 2. See the check pagev0.76
soup adapters auditDid the run use the settings in soup.yaml? Compares the config with what the adapter recorded, exit 2 on a divergencev0.76
(v0.60 supply chain)scan / sign / verify / check-safetensors; sign also takes --backend sigstore since v0.76v0.60

All adapter math is pure numpy, no torch. .bin adapters are rejected with an actionable "re-save as safetensors" message. See Adapter lifecycle (v0.67) for the v0.67 surfaces.

soup adapters diff

bash
soup adapters diff adapter-a/ adapter-b/ --top-k 10 --format markdown

For each layer:

  • Frobenius norm of the delta
  • Relative drift (Frobenius / norm of a)
  • SVD effective rank — effective_rank(s) = exp(H(s²/Σs²)) where H is Shannon entropy. Tells you whether a high-rank adapter actually used its rank.

--top-k ranks layers by drift. --format accepts table / json / markdown and routes through render_report_*.

Since v0.77.0 soup adapters diff reads a bfloat16 adapter, widened to float32 exactly, through the same reader as soup adapters check; through v0.76.1 it failed with data type 'bfloat16' not understood (#2058, #2063). It needs NumPy (not PyTorch, and since v0.77.0 not the safetensors package). Without NumPy it exits 1 with numpy package required; pip install "soup-cli[train]" (or pip install numpy) since v0.77.1; through v0.77.0 it stopped with a Python traceback ending in ModuleNotFoundError: No module named 'numpy'. The read-only commands check, diff and scan need NumPy only; merge and arithmetic write an adapter, so they need NumPy and the safetensors package, and say so before any adapter file is read: numpy and safetensors packages required; pip install "soup-cli[train]" (or pip install safetensors numpy), exit 1 (#2141 by @Nari-Ab).

soup adapters merge — 5 strategies

-o must not be one of the input adapters (since v0.77.2). soup adapters merge and soup adapters arithmetic refuse an --output that is the same file as an input adapter, under any spelling, with exit 1 and Output path refused: --output 'x' is the same file as adapter ...; choose a different --output, instead of overwriting that adapter's weights and config in place (#2358, fixed in #2379 by @ShryukGrandhi). The check runs before any adapter is read. Through v0.77.1 neither command checked, so write the result to a new directory.

bash
soup adapters merge a/ b/ c/ -o merged/ \
  --strategy ties --weights 0.4,0.3,0.3 --density 0.7 --seed 0

# v0.67 — evolutionary search over the simplex
soup adapters merge a/ b/ c/ -o merged/ \
  --strategy cmaes --eval ./tasks.jsonl --budget 1h

Strategies:

  • linear — weighted average. Baseline. Since v0.78.0 each input's own term is scaled by its weight (each factor takes the square root of it; see below).
  • ties (Yadav et al. 2023) — trim by density → elect majority sign → disjoint average. Tied-sign defaults to +1.
  • dare (Yu et al. 2024) — Bernoulli drop with density, rescale by 1/density, deterministic via --seed.
  • svd — linear-merge then low-rank SVD reconstruction (--rank), with the same weight rule as linear.
  • cmaes (v0.67, Sakana-style) — rank-mu CMA-ES (pure Python, no cma dep) over N-1 softmaxed logits on the simplex. Population [2..256], generations [1..10K], plateau-detects after 3 no-improvement gens. An eval-fn failure scores a sentinel so one broken eval does not crash the run; since v0.77.0 a search in which every evaluation failed stops instead (below).

The weights changed in v0.78.0

A number that moved in v0.78.0 (#2927). Through v0.77.2 linear, dare and svd applied each input's normalised weight to both its lora_A and its lora_B, so an input's own delta carried the weight squared: --weights 0.7,0.3 kept 0.49 and 0.09 of the two inputs' own deltas, and the default equal weights kept a quarter of each of two inputs. Since v0.78.0 each factor takes the square root of the weight, the rule soup adapters arithmetic uses, so the same command keeps 0.7 and 0.3, and half of each. The numbers of every linear, dare and svd merge of two or more inputs change; ties is unchanged; and the weights printed by an earlier --strategy cmaes run reproduce a different adapter. Upstream's instruction: re-run merges whose output you compare or ship. Inputs that use the same rank slots still add cross terms, so a merged adapter is not the exact weighted sum of the deltas: that sum is soup adapters arithmetic ... --rank N.

On a pair of tiny rank-2 adapters, one with every element 1.0 and one with every element 2.0, --weights 0.7,0.3 on linear gave every merged element 1.93211 on v0.78.0 (0.7 to the power 0.5 times 1, plus 0.3 to the power 0.5 times 2) and 1.3 on v0.77.2. That fixture only shows the rule; it is not a quality measurement.

Adapters it cannot merge are refused (v0.78.0)

soup adapters merge now refuses inputs it cannot merge, with exit 2 and nothing written (#2926). The check runs on every strategy, svd --rank N and cmaes included (for cmaes it is reached before any evaluation, and the message is prefixed cmaes merge failed:). It stops: a LoRA rank that differs on a shared module (cannot merge: module '<name>' has LoRA rank 4 in adapter 1, rank 8 in adapter 2. soup adapters merge needs the same rank on every module; for mixed ranks use soup adapters arithmetic ... --rank N. Nothing was written.), inputs that share no tensor name (cannot merge: the adapters share no tensor name, so the merged adapter would hold no weights (the inputs target different modules). Nothing was written.), and a shared tensor of the same rank with two shapes (the message asks whether the adapters were trained on the same base model). Adapters of equal rank whose module sets only partly overlap still merge, on the shared modules only.

Warning:

Re-run this. Through v0.77.2 a soup adapters merge of inputs it could not merge exited 0 and wrote an adapter with no tensors (or, when the rank differed on some modules only, as with rank_pattern, an adapter without those modules): the panel read Merged layers: 0 Skipped layers: 2 and the weights file was empty (#2907, #2926). Merge again: use soup adapters arithmetic ... --rank N for mixed ranks, or merge adapters of one rank, and check the result with soup adapters check. The same shape of failure on a different command is described on An empty adapter.

--eval must be a .jsonl file of eval tasks: one JSON object per line with a prompt and optionally expected, scoring and category, the same file soup eval custom --tasks reads. A .yaml suite is not read; since v0.77.0 the "requires --eval" error text says so (path to a .jsonl eval suite; the loader accepts .jsonl only), where through v0.76.1 it said "YAML/JSONL". Any failure while scoring a candidate (an unreadable suite, or a base model that fails to load) scores -1e9 instead of stopping the run. Since v0.77.0 a search in which every evaluation failed exits 2 and writes no adapter (#1808, #1905), with cmaes merge failed: every evaluation failed: N evaluation(s) over M generation(s), none returned a finite score. First failure: ... No merge is written; fix the eval suite or the scorer and run again. Through v0.76.1 that case wrote a "converged" merge built from the first random sample and exited 0, with a Best score of -1000000000.0000 in the final panel. A search where only some candidates failed still finishes, so check the Best score line before you use the result.

Warning:

Re-run this. A soup adapters merge --strategy cmaes run from before v0.77.0 whose final panel's Best score: line read -1000000000.0000 had no evaluation that returned a score: the merge it wrote was the first random sample's weighting, not a search result (#1905). Fix the eval suite and run the merge again.

Live as of v0.71.4 — --canary <canary.json> scores the merged adapter OK/MINOR/MAJOR via the Quant-Lobotomy taxonomy (--strict-verdict exits 2 on MAJOR), and --strategy cmaes runs the full evolutionary eval-suite loop (merge → materialise → score → write best). The canary file holds precomputed scores shaped {"baseline_scores": [...], "candidate_scores": [...]}, not an eval suite, and --canary and --strict-verdict are refused with --strategy cmaes (exit 2): the --eval suite already drives that search. The backdoor-scan + license-conflict gates run for every strategy.

soup adapters blame — dataset-row attribution (the plan is real, the CLI scores are not)

bash
soup adapters blame adapter/ --dataset eval.jsonl --layer q_proj.7 --budget 5m --shards 4 --plan-only

The plan half is real. It splits the dataset into --shards hold-out ranges (2 to 100) and checks they fit a wall-clock budget. parse_budget accepts 60s / 5m / 2h (bounds [60s, 24h], default 4h). _MIN_PER_SHARD_SECONDS = 30 checks feasibility, so if the budget can't cover shards × 30s the plan is reported infeasible and nothing runs. It returns a frozen BlamePlan with one BlameShardWork per shard, and --plan-only prints it and stops.

Without --plan-only the command goes on to print a ranked influence table (--top-k rows, 1 to 10,000, default 50; -o also writes JSON). At v0.78.0 that table is not measured from your adapter (utils/blame.py is unchanged since v0.76.0, and soup adapters blame still calls run_blame(plan, top_k=top_k) with no probe function). The v0.66.0 runner implements a DataInf-style influence score (cosine of a row gradient against a probe gradient, times the row norm) and takes a caller-supplied probe function that returns real per-row gradients, but the CLI never passes one. With no probe function the runner falls back to a deterministic synthetic probe: random per-row vectors seeded from the adapter path, dataset path and --layer string. The adapter is never opened and the dataset is only counted, so the run finishes in a fraction of a second, and an adapter directory that does not exist still prints a table and exits 0. Use the row_id and influence columns as placeholders, not as evidence about your data. --layer is a label recorded in the output (up to 256 characters), not a selector.

soup adapters branch — named, SHA-pinned configs

bash
soup adapters branch chat-llama-v3 -c soup.yaml --base meta-llama/Llama-3.1-8B --dataset data.jsonl

Records a frozen Branch:

text
name              chat-llama-v3
config_path       soup.yaml
config_sha256     a3f1...
dataset_sha256    7c92...
base_model        meta-llama/Llama-3.1-8B
created_at        2026-05-15T23:14:02Z
soup_version      0.58.0

Branch-name regex: ^[A-Za-z0-9][A-Za-z0-9._\-]{0,127}$. Config files capped at 1 MiB. Pointer file capped at 1,024 entries. Atomic write + POSIX 0o600. SOUP_BRANCHES_DIR env override containment-checked to $HOME / $CWD / $TMPDIR.

soup adapters checkout — copy the branch's config back out

bash
soup adapters checkout chat-llama-v3 -o restored-soup.yaml

Copies the config file the branch points at to -o, but only if that file still hashes to the recorded config_sha256. A branch stores a pointer and hashes, not a copy of the config. Edit soup.yaml after making the branch and checkout exits 2 with branch config drifted from snapshot SHA, and because the original contents were never stored, the earlier version cannot be restored from the branch at all: keep a copy or a commit of any config you may want back. The dataset hash is recorded for provenance but is not re-checked, so editing the dataset does not make checkout fail.

See also

  • Is the adapter alive — v0.76 soup adapters check and soup adapters audit: whether a LoRA adapter saved by the transformers path is trained at all, and whether the run used the config's settings.
  • Adapter algebra — v0.71.34 adds soup adapters arithmetic: add, scale and negate LoRA deltas.
  • Registry — lineage DAG of full training runs
  • Soup Cans — package an adapter + config + data ref into a portable bundle
  • Adapter lifecycle (v0.67) — soup adapters merge --strategy cmaes evolutionary search, soup adapters pr GitHub-shaped reviews, soup adapters bisect regression history, and soup lock shared SHA256 closure
  • Supply-chain security (v0.60) — soup adapters scan / sign / verify for backdoor detection + Merkle-root tamper protection

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.