Configuration
The training hyperparameters and their gotchas
All training parameters live in config.yaml → runtime_info.input.training. The block generates the LLaMA-Factory YAML from these values at runtime. This page documents the fields that matter most and the gotchas behind them.
Core fields
| Field | Meaning |
|---|---|
stage | Training stage (sft) |
finetuning_type | full for full fine-tuning |
deepspeed | DeepSpeed config path (ds_z3_config.json = ZeRO-3) |
template | Chat template (see below) |
cutoff_len | Max sequence length (tokens) |
rope_scaling | RoPE scaling method (see below) |
max_samples | Upper bound applied by LLaMA-Factory after loading |
output_dir | Run name / checkpoint directory |
per_device_train_batch_size | Batch size per GPU |
gradient_accumulation_steps | Gradient accumulation steps |
learning_rate | Learning rate |
num_train_epochs | Number of epochs |
lr_scheduler_type | LR schedule (e.g. cosine) |
warmup_ratio | Warmup fraction of total steps |
save_strategy | Checkpoint schedule: steps, epoch, or no |
save_steps | Checkpoint interval when save_strategy: steps |
save_only_model | Save only model weights, without resumable optimizer state |
The effective global batch size is per_device_train_batch_size × gradient_accumulation_steps × n_gpus.
Template
Match the template family to the model: Qwen3 uses qwen3 / qwen3_nothink; Qwen3.5 uses qwen3_5 / qwen3_5_nothink. Select a thinking-capable variant only when the dataset intentionally preserves reasoning content. The active Qwen3.5 profile uses qwen3_5. See Scaffolds.
Long context
Enable a model-supported RoPE scaling method such as yarn when cutoff_len exceeds the base model's native context window (max_position_embeddings or the documented context length). There is no universal 32K threshold: compare the requested cutoff with the selected model's own limit.
The checked-in Qwen3.5 profile uses rope_scaling: null: its native context
already covers the configured 128K cutoff, and this architecture ignores the
older top-level RoPE scaling option.
Checkpointing
save_only_model: trueskips saving optimizer state — it saves disk but prevents resuming.save_strategy: stepsusessave_steps;epochsaves at epoch boundaries.resume_from_checkpoint: null— set it to a checkpoint directory path to resume.- A non-empty
output_diris rejected by default. Destructive replacement requires bothoverwrite_output_dir: trueand the explicit runtime acknowledgementSFT_ALLOW_OVERWRITE_OUTPUT=1. - A relative
output_dirwrites toartifacts/model/<basename>; an absolute path is honored as-is by both training and the dashboard.
Performance toggles
| Field | Effect |
|---|---|
bf16: true | bf16 mixed-precision training |
enable_liger_kernel: true | Liger fused kernels |
use_unsloth_gc: true | Unsloth gradient checkpointing |
flash_attn: fa2 | FlashAttention-2, built against the installed PyTorch |
Experiment tracking
experiment.wandb_mode controls reporting: disabled generates report_to: none; offline logs locally without an API key; online requires WANDB_API_KEY in the private runtime environment.
Tunable parameters
The hyperparameters worth tuning between runs (all under runtime_info.input.training / .conversion):
| Parameter | Range / meaning |
|---|---|
learning_rate | 1e-5 to 1e-3 |
num_train_epochs | Number of epochs |
per_device_train_batch_size | Batch size per GPU |
gradient_accumulation_steps | Gradient accumulation steps |
max_instances | Harbor conversion cap or ready-made-source num_samples |
Common failure modes
| Symptom | Fix |
|---|---|
| Single-GPU run on an 8-GPU node | Ensure FORCE_TORCHRUN=1 (set by train.sh) and n_gpus_per_node is correct |
| Dataset key points to an old LF filename | Let train.sh update the mapping, or pick a new conversion.data_name |
Requested cutoff_len exceeds the model's native context window | Enable a RoPE scaling method supported by that model, such as yarn |
| Non-empty output directory rejected | Rename output_dir; only intentional destructive replacement should set both overwrite controls |
| WandB online mode without an API key | Export WANDB_API_KEY, or switch to offline/disabled |