github MakazhanAlpamys/Soup v0.39.0
v0.39.0 — LoRA Quality

latest releases: v0.78.0, v0.77.2, v0.77.1...
6 months ago

What's New

Five PEFT-surface improvements that LlamaFactory and Axolotl maintain. Faster init, periodic adapter refresh, per-module rank, surgical architecture patches, and a cleaner template registry.

  • PiSSA init — set training.lora.init_strategy: pissa for SVD-initialized LoRA pairs. Faster early convergence vs random init at the cost of one extra SVD pass on the first epoch. init_strategy: olora is also accepted (equivalent to legacy use_olora=True, which auto-aligns for back-compat).
  • ReLoRA callback — set training.relora_steps: 500 to magnitude-prune LoRA adapter weights every 500 steps and clear optimizer state. Useful for very long training runs where the LoRA capacity saturates. Bounds: relora_warmup_ratio [0,1], relora_prune_ratio (0,1), relora_reset_optimizer: true.
  • Per-pattern LoRA rank — training.lora.rank_pattern: {q_proj: 8, v_proj: 16} and alpha_pattern give different ranks per target module pattern. Useful in MoE configs where expert FFNs need lower rank than attention. Caps: 256 keys × value 1024.
  • Surgical PEFT patches — Gemma 4 ClippableLinear is auto-swapped to plain nn.Linear so PEFT's matcher recognises it; fused-MoE 3-D expert weights have lora_dropout zeroed to dodge ParamWrapper crashes. Both are gated by architecture detection (regex word boundary on the model name) and never run on unrelated models.
  • Template registry — the 16 built-in templates now live as soup_cli/templates/*.yaml with a manifest.json index. soup init --template <name> reads the YAML; the inline copies in schema.py stay as a back-compat fallback (deprecated in favour of the YAML registry).

Net +164 tests (4374 → 4538). All five review-agent waves clean before tag.

Install / Upgrade

pip install --upgrade soup-cli
# or
pip install soup-cli==0.39.0

Docker image (auto-published to GHCR ~10 min after this release):

docker pull ghcr.io/makazhanalpamys/soup:0.39.0

Security

  • LoraConfig.init_strategy Literal["random","pissa","olora"] rejects unknown strategies; PiSSA + DoRA / VeRA combinations rejected at config-load. Back-compat alignment of use_olora=True → init_strategy="olora" uses dict-copy in model_validator(mode="before") (no caller mutation).
  • rank_pattern / alpha_pattern capped at 256 keys × value (0, 1024], rejects bool / null-byte / empty key. Cross-validator rejects with use_vera=True.
  • ReLoRAPolicy is @dataclass(frozen=True); bounds steps ∈ [1, 1e7], warmup_ratio ∈ [0,1], prune_ratio ∈ (0, 1) (strict — prevents zero-everything footgun). magnitude_prune_tensor rejects non-Tensor input with TypeError; empty / single-element tensor short-circuits (avoids kthvalue(_, 0) crash). _validate_relora_supported_tasks cross-validator restricts relora_steps to task=sft on transformers backend with distinct MLX-backend error message.
  • is_gemma4_model uses a word-boundary regex (?:^|[^a-z0-9])gemma-?4(?:[^a-z0-9]|$) so "ungemma4ed" / "my-gemma4ish" no longer over-match (the previous substring match would have triggered the ClippableLinear swap on unrelated custom models). apply_gemma4_clippable_patch is gated by is_gemma4_model(cfg.base) in the SFT trainer before invocation; failed weight-copy logs at DEBUG instead of silent random-init.
  • templates/load_template containment: filename re-validated via _validate_name (rejects .. / / / \ / null / empty); os.path.realpath + os.path.commonpath containment check on the resolved path against _templates_dir() so a tampered manifest.json cannot read files outside the package directory. Tampered-manifest ValueError from _validate_name caught and falls back to inline (no propagating exception). 256 KB file-size cap. Inline TEMPLATES carries an explicit deprecation comment pointing at the canonical YAML registry; full inline ↔ YAML byte-equality drift-guard test for all 16 templates.

Known Limitations

  • ReLoRA wired in the SFT trainer only. The 10 other transformer-backend trainers (DPO / GRPO / KTO / ORPO / SimPO / IPO / PPO / RewardModel / Pretrain / Embedding) reject relora_steps at config-load with an explicit error message naming the actual reason. Multi-trainer expansion is tracked for v0.39.1, mirroring v0.27.0 MII / v0.37.0 multipack / v0.38.0 quant menu stub-then-live pattern.
  • Surgical patches wired in the SFT trainer only. Same multi-trainer follow-up scope.
  • Inline TEMPLATES dict still ships alongside the YAML registry for back-compat. A drift-guard test asserts byte-equality of all 16 inline ↔ YAML pairs on every CI run, but a contributor editing one source without the other will need to wait for CI to catch the drift. Planned removal: v0.41.0+.
  • License (advisory): Soup migrated from MIT to Apache-2.0 in 2026-04-21. Downstream redistributors must retain NOTICE per §4(d) of the Apache-2.0 license. No code change required from end users.

Don't miss a new Soup release

NewReleases is sending notifications on new releases.