liveBook · Manning

SFTTrainer

SFTTrainer is a trainer component in the TRL library for configuring and running supervised fine-tuning of language models.

How 3 Manning books explain it

LLM Customization and Fine-Tuning

A trainer component in the TRL library for supervised fine-tuning of transformer language models.

How it is used
Provides the training loop for LoRA adapters and full-parameter supervised fine-tuning of an IT support assistant.
How deep it goes
Walks through configuration, training and loss monitoring, with separate adapter and full-parameter workflows.
Examples
Uses IT support message datasets and Qwen3-4B-Instruct-2507 for a 20-step adapter run and a full-parameter run.
What you can do after
Apply it via TRL to configure and run adapter or full-parameter training and inspect training signals.

Read how LLM Customization and Fine-Tuning explains SFTTrainer →

Building Specialized AI Systems

A training component in the TRL library that automates supervised fine-tuning of language models.

How it is used
Automates supervised fine-tuning after examples have been converted into trainer-ready prompt strings.
How deep it goes
Explains configuration and delegated training mechanics, but stops short of low-level gradient or optimizer internals.
Examples
Uses formatted credit-risk prompts, applicant profiles, LoRA settings, trainer arguments, generated output, and saved model artifacts.
What you can do after
Operate TRL-based supervised fine-tuning by preparing formatted data, configuring training arguments, training, testing, and saving artifacts.

Read how Building Specialized AI Systems explains SFTTrainer →

Rearchitecting LLMs

SFTTrainer is a training component that performs supervised fine-tuning of language models using a configured dataset and training procedure.

How it is used
Trains a LoRA-adapted language model on formatted clinical examples for supervised fine-tuning.
How deep it goes
Configures dataset field, epochs, batch size, learning rate schedule, warmup, precision, and sequence length; leaves trainer internals unspecified.
Examples
Uses formatted medical notes and structured labels for extraction, then evaluates schema compliance with an “Extract:” prompt.
What you can do after
Apply via TRL's SFTTrainer to fine-tune an adapted model on formatted examples, then evaluate schema compliance.

Read how Rearchitecting LLMs explains SFTTrainer →

Also covered in

What to know first

Related concepts

Questions about SFTTrainer

What is SFTTrainer?

SFTTrainer is a trainer component in the TRL library for configuring and running supervised fine-tuning of language models.

Which Manning books explain SFTTrainer?

LLM Customization and Fine-Tuning, Building Specialized AI Systems and Rearchitecting LLMs.

What should I know before learning SFTTrainer?

Manning books that teach SFTTrainer usually introduce language model and low-rank adaptation first.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.