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(training): state the shape behind "an 8B base fits a 4 GB card" (#1719)

Geovana G. Grigorio84b47956a8ab
diff --git a/docs/performance-and-quantization.md b/docs/performance-and-quantization.md
index 364d6235..ba638b0b 100644
--- a/docs/performance-and-quantization.md
+++ b/docs/performance-and-quantization.md
@@ -618,6 +618,12 @@ dominates everything else: measured on Qwen2.5-0.5B (vocab 151 936) at batch 8,
the logits alone are **8.71 GB — 146× the entire layer-buffer pool (0.060 GB)**. A
pre-flight that budgeted only weights and buffers would wave that configuration through.
+The same term decides what an 8B base needs on a 4 GB card. Llama-3.1-8B NF4 (vocab
+128 256), streamed, LoRA r=8: **3.448 GB at batch 1, S=512**, then **1.063 GB for every
+further 512 tokens per step** — 4.512 GB at 1024, already above the 4.294 GB card
+([probe v0.73.0, section 9](../benchmarks/probe-v0.73.0-what-bounds-streaming.md#9-peak-vram-and-the-microbatch-sweep)).
+`data.max_length` defaults to 2048, so the "8B on 4 GB" setup needs `data.max_length: 512`.
+
So `soup train` predicts peak VRAM before building the model, and **refuses a run it
expects not to fit**:
diff --git a/docs/training.md b/docs/training.md
index 597a33f3..824a68da 100644
--- a/docs/training.md
+++ b/docs/training.md
@@ -7,7 +7,10 @@
> **Training a model bigger than your GPU?** `training.stream_layers: true` streams the
> frozen base from CPU RAM (with NVMe disk overflow) one decoder layer at a time, so peak
> VRAM is bounded by one layer instead of the whole model. Add `quantization: 4bit` and an
-> 8B base fits a 4 GB card. Works for `sft` and, from v0.72.4, for `dpo` / `orpo` /
+> 8B base fits a 4 GB card at batch 1 and 512 tokens per step; on a 128k-vocabulary model
+> every further 512 tokens costs about 1 GB more (see
+> [Sizing a streaming run](performance-and-quantization.md#sizing-a-streaming-run-v0723)).
+> Works for `sft` and, from v0.72.4, for `dpo` / `orpo` /
> `simpo` / `kto` — DPO's reference model is the same streamed base with its adapters
> switched off, so it needs no second copy of the model (on an untied checkpoint `dpo` and
> `kto` still hold one copy of the output head per step) — see