wAIpoint
Italiano

Fine-tuning & alignment

Level: Advanced

What it is

Fine-tuning continues the training of a pre-trained model on a smaller set of examples, to specialise it. Alignment is the broader goal of making a model do what people actually want and avoid harm. For chat assistants this is often done by training on human-written answers and on human rankings of answers, as in InstructGPT. LoRA is a cheap way to fine-tune: it trains only a few small added matrices and leaves the original weights untouched.

What it is for

Making a model follow a format or tone consistently, teaching it a specialised task or vocabulary, shrinking the cost of a task by specialising a small model, and making assistants more helpful and safer. It is not the right tool for adding fresh facts: for that, retrieval is usually better.

How to do it

The process, step by step. Libraries and tools change; these steps stay.

  1. First try prompting and retrieval of your documents; fine-tune only if they are not enough.
  2. Collect examples of the exact behaviour you want, as input and ideal-output pairs, and keep quality above quantity.
  3. Hold out some examples for testing, and write down how you will judge whether it got better.
  4. Choose the method: full fine-tuning when you have the resources, or LoRA when you want to train on modest hardware.
  5. Train, then compare against the original model on your held-out examples and on a few general questions to catch things it forgot or broke.
  6. Deploy the tuned model, keep the data and settings recorded, and plan to redo it when the base model changes.

Lately

Timeline

  1. 2021LoRA: adapt a huge pre-trained model by training only small low-rank matrices, freezing the original weights (Hu et al.). source
  2. 2022InstructGPT: aligning language models with user intent by fine-tuning with human feedback (Ouyang et al.). source

Sources