Theory of Intelligence
DEEP LEARNING•Sequences And Transformers•Working With Pretrained Transformers•5.2 Fine-Tuning Transformers

Introduction

Adapting a pretrained transformer to your own labelled data: adding a classification head, training with the Trainer API or a custom PyTorch loop, and evaluating NLP models properly.

Introduction

A pretrained transformer already "understands" language in general, but it doesn't know your task: your categories, your customers' vocabulary, your definition of "urgent". Fine-tuning continues training the model on your labelled examples for a short time, so it specializes. Even with a few thousand examples, a fine-tuned transformer usually beats models trained from scratch by a wide margin.

Think of hiring a fluent, well-read graduate and giving them a week of on-the-job training. They don't need to learn the language again; they learn your company's specific job.

This topic walks through fine-tuning a text classifier end to end, in two ways: with Hugging Face's Trainer, and with a plain PyTorch loop.

Discuss theoretical concepts, mathematical formulas, and architectural foundations.

Supports inline code with `backticks`
No comments yet. Be the first to start the discussion!