method key.
praisonai-train llm supports four objectives selected by the method config key: sft (default), dpo, orpo, and kto. SFT clones behaviour from single completions; DPO and ORPO learn from chosen vs rejected pairs; KTO learns from per-example thumbs-up / thumbs-down labels.
Quick Start
1
Install the training stack
2
Pick a method in config.yaml
Switch from SFT to preference tuning by setting
method and pointing dataset at a preference dataset. Everything else stays the same.- DPO
- ORPO
- KTO
Needs
prompt, chosen, rejected columns. Uses the frozen base model as an implicit reference (ref_model=None).3
Train
lora_model/ — publishing stays opt-in.Which method should I use?
Dataset shapes
Each method fails fast before training if the required columns are missing — the error names both the missing columns and the columns your dataset actually has.- DPO / ORPO
- KTO
Columns:
prompt, chosen, rejected.Preference datasets are kept as-is — the trainer does not flatten them to a
text column the way SFT does. shuffle: true on a dataset entry still applies.Config keys
All preference keys are optional and, apart frommethod, apply only to preference methods.
What happens under the hood
No loss masking
No loss masking
Response-only masking is an SFT concept — preference losses compare whole sequences, so
assistant_only_loss is skipped for dpo / orpo / kto.Dataset kept as-is
Dataset kept as-is
process_dataset() short-circuits for preference methods: your prompt / chosen / rejected (or prompt / completion / label) columns are passed straight through, un-flattened. SFT keeps its flatten-to-text behaviour.SFT-only fields dropped
SFT-only fields dropped
For preference methods the trainer drops
dataset_text_field, packing, and dataset_num_proc, sets max_length = max_seq_length, and defaults max_prompt_length to max_seq_length // 2.Reference model uses frozen base weights
Reference model uses frozen base weights
DPO and KTO run with
ref_model=None — the trainer uses the frozen base weights as the reference. This works cleanly with a PEFT adapter and avoids doubling VRAM. ORPO needs no reference model at all.Preference imports are lazily guarded
Preference imports are lazily guarded
Each trainer / config pair is imported individually. An older TRL missing one method (e.g.
KTOTrainer) still lets the others run.Errors you might see
Missing preference columns
Missing preference columns
TRL version too old for the method
TRL version too old for the method
pip install -U "praisonai-train[llm]".Unknown method name
Unknown method name
An unrecognised
method raises a ValueError listing every supported method (sft, dpo, orpo, kto) with a one-line summary. method is case-insensitive, so DPO and dpo both work.Related
Train
Full fine-tuning setup, config reference, and the response-masking section.
Assistant-only Loss
How SFT masks prompts out of the loss (skipped for preference methods).
praisonai-train Package
The standalone training package and its CLI subcommands.
Train CLI
Full flag and config-key reference for
praisonai train llm.
