Configuration
EngineSurogate EngineEvery Surogate run is described by one YAML config file: the model, the data, how to train and where to write the results. You pass the file to a command such as surogate sft, and anything you leave out takes its default. This page shows what a config looks like; the config reference lists every option.
Start from an example
Section titled “Start from an example”The quickest start is to copy an example and edit it:
- SFT examples live in
examples/sft/ - Pretraining examples live in
examples/pt/ - Knowledge-distillation examples live in
examples/distillation/
Run it with the CLI:
surogate sft path/to/config.yaml# orsurogate pt path/to/config.yamlTo distill a larger teacher into the student during SFT, add a distillation: block and run surogate distill-capture before surogate sft. See Knowledge Distillation.
Anatomy of a config file
Section titled “Anatomy of a config file”This is examples/sft/qwen3/qwen3-lora-bf16.yaml, a LoRA fine-tune of a small Qwen3 model, with comments on what each group of keys does:
# Model and output: what to train and where checkpoints gomodel: Qwen/Qwen3-0.6Boutput_dir: ./outputs/sft/qwen3/qwen3-lora-bf16resume_from_checkpoint: false
# Batch size: effective batch = per_device_train_batch_size × gradient_accumulation_steps × gpusper_device_train_batch_size: 2gradient_accumulation_steps: 4
# Sequences: pack several samples into each sequence_len-token windowsample_packing: truesequence_len: 2048
# Training length and evaluation interval (in optimizer steps)max_steps: 100eval_steps: 25
# Optimizer and schedulelearning_rate: 2e-4warmup_ratio: 0.15
# Precision recipe; train_vision: false trains on text onlyrecipe: bf16train_vision: false
# LoRA adapters: which layers get one, and their sizelora: truelora_rank: 16lora_alpha: 32lora_dropout: 0lora_target_modules: - q_proj - k_proj - v_proj - o_proj - gate_proj - up_proj - down_proj
# Data: where it comes from and in which formatdataloader_num_workers: 4datasets: - path: "OpenLLM-Ro/ro_gsm8k" type: autoEach group maps to a section of the config reference:
model,output_dirand checkpointing: General Settings and Model Settings- batch size, steps and evaluation: Training Loop Settings
learning_rateand the schedule: Optimizer Settings, explained in Optimizersrecipe: Precision & Recipesloraand its options: LoRA Settingsdatasetsand packing: Dataset Settings, explained in Datasets
Other features add their own keys on top: gpus and zero_level for multi-GPU training, a distributed: block for multi-node training, qlora_* keys for QLoRA.
What to edit first
Section titled “What to edit first”For most runs you’ll edit:
modeloutput_dirdatasetsper_device_train_batch_size,gradient_accumulation_steps,sequence_lenlearning_rate- (optional)
lora,lora_rank/ QLoRA options
If the run doesn’t fit in GPU memory, Memory lists what to change, in order.
See also
Section titled “See also”- Config reference: every option, its type and default
- Datasets: the dataset formats and how to configure each
- Knowledge Distillation: train a student from a larger teacher
- Back to docs index