Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

docs(config): add descriptions for 7 schema fields (#1794) (#1831)

Nariman Abdikarimbd963eaf1cd6
diff --git a/changelog.d/0.76.0/1831.fixed.md b/changelog.d/0.76.0/1831.fixed.md
new file mode 100644
index 00000000..4662e389
--- /dev/null
+++ b/changelog.d/0.76.0/1831.fixed.md
@@ -0,0 +1 @@
+- Seven fields in `soup.yaml` without schema descriptions (`data`, `training`, `training.gradient_accumulation_steps`, `training.warmup_ratio`, `training.weight_decay`, `training.max_grad_norm`, and `training.lora`) now carry descriptions in `SoupConfig` (#1794 by @Nari-Ab in #1831).
diff --git a/docs/config-reference.md b/docs/config-reference.md
index 60270e45..4dbf8d24 100644
--- a/docs/config-reference.md
+++ b/docs/config-reference.md
@@ -47,8 +47,8 @@ Sections:
| `task` | `str` | `"sft"` | one of `"sft"`, `"dpo"`, `"grpo"`, `"ppo"`, `"reward_model"`, `"kto"`, `"orpo"`, `"simpo"`, `"ipo"`, `"bco"`, `"preference"`, `"pretrain"`, `"embedding"`, `"prm"`, `"tts"`, `"classifier"`, `"reranker"`, `"cross_encoder"`, `"distill"`, `"unlearn"`, `"moe_lora_routing"`, `"online_dpo"`, `"asr"` | Training task type. v0.50.0 added 'prm'; v0.52.0 adds 'tts' (TTS fine-tuning), 'classifier' / 'reranker' / 'cross_encoder' (classification heads), and 'distill' (knowledge distillation). v0.61.0 adds 'unlearn' (NPO / SimNPO / RMU). v0.67.0 adds 'moe_lora_routing' (per-token gating over N task LoRAs). |
| `modality` | `str` | `"text"` | one of `"text"`, `"vision"`, `"audio"`, `"audio_out"` | Training modality: text (default), vision (multimodal), audio (audio-input), or audio_out (audio-output — paired with task='tts', v0.52.0). |
| `backend` | `str` | `"transformers"` | one of `"transformers"`, `"unsloth"`, `"mlx"` | Training backend: transformers (default), unsloth (2-5x faster on CUDA), or mlx (Apple Silicon M1-M4) |
-| `data` | `section` | **required** | | See [`data`](#data). |
-| `training` | `section` | section defaults | | See [`training`](#training). |
+| `data` | `section` | **required** | | Dataset source, format, tokenization, and preprocessing settings. See [`data`](#data). |
+| `training` | `section` | section defaults | | Training hyperparameters, optimizer, scheduler, and hardware settings. See [`training`](#training). |
| `output` | `str` | `"./output"` | | Output directory for trained model |
| `experiment_name` | `str \| null` | `null` | | Experiment name for tracking |
| `eval` | `section \| null` | `null` | | Evaluation configuration for auto-eval after training. See [`eval`](#eval). |
@@ -105,13 +105,13 @@ Sections:
| `training.lr` | `float` | `2e-05` | `> 0` | Learning rate |
| `training.batch_size` | `int \| "auto"` | `"auto"` | | Batch size. 'auto' = find max that fits in memory. |
| `training.auto_batch_size_strategy` | `str` | `"auto"` | one of `"auto"`, `"static"`, `"probe"` | How to pick the auto batch size: 'static' (fast formula), 'probe' (real OOM try/halve loop), 'auto' (probe on CUDA, static on CPU). Default 'auto' (v0.36.0). |
-| `training.gradient_accumulation_steps` | `int` | `4` | `>= 1` | |
+| `training.gradient_accumulation_steps` | `int` | `4` | `>= 1` | Number of micro-batches whose gradients are summed before each optimizer update. Effective batch size per device is batch_size \* gradient_accumulation_steps (times the number of GPUs). |
| `training.seed` | `int \| null` | `null` | `>= 0`, `<= 4294967295` | Training seed (weight init of new params, data order, dropout). Reaches TrainingArguments.seed and the multipack sampler. Unset = HF's default of 42. |
| `training.data_seed` | `int \| null` | `null` | `>= 0`, `<= 4294967295` | Separate seed for data sampling only (TrainingArguments.data_seed). Set it alongside `seed` to vary data order while holding initialisation fixed. Unset = follow `seed`. |
-| `training.warmup_ratio` | `float` | `0.03` | `>= 0.0`, `<= 0.5` | |
-| `training.weight_decay` | `float` | `0.01` | `>= 0.0` | |
-| `training.max_grad_norm` | `float` | `1.0` | `> 0` | |
-| `training.lora` | `section` | section defaults | | See [`training.lora`](#traininglora). |
+| `training.warmup_ratio` | `float` | `0.03` | `>= 0.0`, `<= 0.5` | Fraction of total training optimizer steps used for linear learning rate warmup. Resolved over real optimizer steps. |
+| `training.weight_decay` | `float` | `0.01` | `>= 0.0` | Weight decay factor (decoupled, AdamW-style) applied to weights during optimization; 0 disables it. |
+| `training.max_grad_norm` | `float` | `1.0` | `> 0` | Maximum gradient norm for gradient clipping. |
+| `training.lora` | `section` | section defaults | | LoRA (Low-Rank Adaptation) adapter architecture and target modules. See [`training.lora`](#traininglora). |
| `training.quantization` | `str` | `"4bit"` | one of `"4bit"`, `"8bit"`, `"none"`, `"gptq"`, `"awq"`, `"hqq:1bit"`, `"hqq:2bit"`, `"hqq:3bit"`, `"hqq:4bit"`, `"hqq:5bit"`, `"hqq:6bit"`, `"hqq:8bit"`, `"aqlm"`, `"eetq"`, `"mxfp4"`, `"fp8"`, `"bitnet_1.58"` | Quantization (v0.38.0 — Quant Menu): 4bit (BNB QLoRA), 8bit (BNB), none, gptq / awq (load pre-quantized checkpoint, train LoRA on top), hqq:Nbit (HQQ 1-8 bit, N in {1..6, 8}), aqlm (extreme 2-bit), eetq (8-bit fast), mxfp4 (MXFP4 pre-quantized base, dequantized on load), fp8 (load FP8 checkpoint with dequantize-on-load), bitnet_1.58 (reserved until BitNet trainer routing is available). |
| `training.gptq_disable_exllama` | `bool` | `true` | | v0.38.0 — disable exllama backend for GPTQ. PEFT requires triton backend; exllama silently breaks adapter training. |
| `training.bnb_4bit_quant_storage` | `str \| null` | `null` | one of `"uint8"`, `"float16"`, `"bfloat16"`, `"float32"` | v0.38.0 — BNB 4-bit storage dtype. FSDP+QLoRA resolves this automatically to the effective floating compute dtype; outside FSDP, None keeps BNB's legacy uint8 default. |
diff --git a/src/soup_cli/config/schema.py b/src/soup_cli/config/schema.py
index 9f7a86c4..6029d66e 100644
--- a/src/soup_cli/config/schema.py
+++ b/src/soup_cli/config/schema.py
@@ -1142,7 +1142,15 @@ class TrainingConfig(BaseModel):
"static on CPU). Default 'auto' (v0.36.0)."
),
)
- gradient_accumulation_steps: int = Field(default=4, ge=1)
+ gradient_accumulation_steps: int = Field(
+ default=4,
+ ge=1,
+ description=(
+ "Number of micro-batches whose gradients are summed before each optimizer "
+ "update. Effective batch size per device is batch_size * "
+ "gradient_accumulation_steps (times the number of GPUs)."
+ ),
+ )
# #341 — the general training seed. Before this there was none:
# `TrainingArguments` took HF's defaults on every run, so two runs of the
# same config differed only by GPU nondeterminism and "run it again with a
@@ -1187,10 +1195,32 @@ class TrainingConfig(BaseModel):
)
return v
- warmup_ratio: float = Field(default=0.03, ge=0.0, le=0.5)
- weight_decay: float = Field(default=0.01, ge=0.0)
- max_grad_norm: float = Field(default=1.0, gt=0)
- lora: LoraConfig = Field(default_factory=LoraConfig)
+ warmup_ratio: float = Field(
+ default=0.03,
+ ge=0.0,
+ le=0.5,
+ description=(
+ "Fraction of total training optimizer steps used for linear learning "
+ "rate warmup. Resolved over real optimizer steps."
+ ),
+ )
+ weight_decay: float = Field(
+ default=0.01,
+ ge=0.0,
+ description=(
+ "Weight decay factor (decoupled, AdamW-style) applied to weights "
+ "during optimization; 0 disables it."
+ ),
+ )
+ max_grad_norm: float = Field(
+ default=1.0,
+ gt=0,
+ description="Maximum gradient norm for gradient clipping.",
+ )
+ lora: LoraConfig = Field(
+ default_factory=LoraConfig,
+ description="LoRA (Low-Rank Adaptation) adapter architecture and target modules.",
+ )
quantization: Literal[
"4bit",
"8bit",
@@ -4959,8 +4989,13 @@ class SoupConfig(BaseModel):
"CUDA), or mlx (Apple Silicon M1-M4)"
),
)
- data: DataConfig
- training: TrainingConfig = Field(default_factory=TrainingConfig)
+ data: DataConfig = Field(
+ description="Dataset source, format, tokenization, and preprocessing settings."
+ )
+ training: TrainingConfig = Field(
+ default_factory=TrainingConfig,
+ description="Training hyperparameters, optimizer, scheduler, and hardware settings.",
+ )
output: str = Field(default="./output", description="Output directory for trained model")
experiment_name: Optional[str] = Field(default=None, description="Experiment name for tracking")
eval: Optional[EvalConfig] = Field(
diff --git a/tests/test_issue823_stale_feature_descriptions.py b/tests/test_issue823_stale_feature_descriptions.py
index 894eda47..196e057d 100644
--- a/tests/test_issue823_stale_feature_descriptions.py
+++ b/tests/test_issue823_stale_feature_descriptions.py
@@ -304,3 +304,25 @@ def test_named_docs_no_longer_promise_past_follow_up_releases() -> None:
f"{relative_path}: {fragment}" for fragment in fragments if fragment in text
)
assert offenders == []
+
+
+def test_all_soup_config_fields_have_descriptions() -> None:
+ """Every soup.yaml setting reachable from SoupConfig carries a description (#1794)."""
+ import typing
+
+ from pydantic import BaseModel
+
+ from soup_cli.config.schema import SoupConfig
+
+ missing: list[str] = []
+
+ def walk(model: type[BaseModel], prefix: str = "") -> None:
+ for name, info in model.model_fields.items():
+ if not info.description:
+ missing.append(prefix + name)
+ for member in (info.annotation, *typing.get_args(info.annotation)):
+ if isinstance(member, type) and issubclass(member, BaseModel):
+ walk(member, prefix + name + ".")
+
+ walk(SoupConfig)
+ assert missing == [], f"Config fields missing description: {missing}"