Loading…
Glossary term
Further training a pretrained model on specific data to specialize its behavior.
Fine-tuning continues training a pretrained model on a smaller, specialized dataset. The weights shift to match your examples, so the model adopts a style, format or skill in a lasting way.
It differs from prompting, which changes behavior only for one request.
Fine-tune with Hugging Face Trainer
from transformers import Trainer, TrainingArguments
trainer = Trainer(
model=model,
args=TrainingArguments(output_dir="out", num_train_epochs=3),
train_dataset=train_dataset,
)
trainer.train()Fine-tuning turns a general model into a specialist for a company, task or tone.