# Pretraining

Source: https://docs.surogate.ai/engine/examples/recipes/pt/

<!-- From examples/pt/README.md in the engine repo; configs and scripts it names are linked on GitHub. -->
These two configs train on raw text (`Trelis/tiny-shakespeare`, column `Text`) and
compute the loss on all tokens. Run them from the repository root. The small corpus
shows the workflow; it is far too little data to train a useful 0.6B model from scratch.

```bash
# Randomly initialize Qwen3's architecture and train all weights with NorMuon.
surogate pt examples/pt/qwen3.yaml
# Continue from Qwen3's pretrained weights with raw-text SFT and AdamW 8-bit.
surogate sft examples/pt/qwen3-continue.yaml
```

`surogate pt` always sets `from_scratch: true` and initializes projections to zero,
so use `surogate sft` for continued pretraining. Both configs use `lora: false`,
`loss_scale: all`, packing, a cosine learning-rate schedule, explicit validation,
and checkpoints. Replace `model` with a compatible checkpoint or architecture and
`datasets` with your corpus. If full-model training runs out of memory, reduce the
sequence length or batch size, or use the [offload and multi-GPU recipes](/engine/examples/recipes/training/).

Next: the [pretraining quickstart](/engine/getting-started/quickstart-pretraining/)
walks through a first run, and [optimizers](/engine/guides/optimizers/) explains
NorMuon and AdamW 8-bit.
