Supervised fine-tuning (SFT) is ordinary gradient-descent training applied to a pretrained model on labeled input-output pairs. Mechanically:
Each example (typically a chat conversation) is rendered into a token sequence using the model's chat template, with special tokens marking roles and turn boundaries.
A forward pass computes the model's predicted probability for each next token, and cross-entropy loss compares predictions to the actual tokens.
Backpropagation computes gradients, and an optimizer (almost always AdamW) updates the weights: all of them in full fine-tuning, or a small adapter in parameter-efficient methods.
Repeat for a few passes over the dataset, using a small learning rate, a short warmup, and a decay schedule.
A held-out validation split is scored periodically to catch overfitting.
The objective is identical to pretraining; what changes is the data, the scale, and the learning rate.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.