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.

1.3 KB
Raw Blame
  • training.stream_loss_chunk: N runs the output head and the loss N tokens at a time under layer streaming, so the logits no longer grow with the context length. Unset, the head builds the full [batch, seq, vocab] logits and the loss works on all of them, which is what ran a 4 GB card out of memory from about 1024 tokens. Set, each chunk runs the head, takes its cross-entropy and the gradient on its own hidden states, and drops its logits; one [batch, seq, hidden] tensor carries the gradient to the backward pass. The loss and the gradients match the unchunked step within 1e-5 of the largest value, not bit for bit. The entropy, mean_token_accuracy and num_tokens columns and rewind.jsonl are written as before; a labelled forward returns no logits. task: sft only; refused without stream_layers, beside use_cut_ce, with data.format: raft, with a trainable output head, and for a model that changes its logits after the head (Gemma 2's soft-capping). The pre-flight charges the logits on min(seq, N) tokens plus two hidden-sized tensors. Not measured on a GPU: the peak-VRAM table #1693 asks for is still open. Try: soup train --config soup.yaml with training.stream_layers: true and training.stream_loss_chunk: 128 (#1693 by @ybai08 in #1880).