Module 1 · When and why to fine-tune
Choosing your open-weights base model
6 min read
Fine-tuning means starting from an existing model and modifying it. The choice of that base model sets the quality ceiling, the cost of every training run and every request, the languages you can serve, and the legal terms of use. Changing base models mid-project means starting over: this lesson gives the criteria for choosing well from the start.
Open-weights: what you get
An "open-weights" model publishes its weights: you can download it, run it on your hardware, fine-tune it and serve it yourself. That is not necessarily "open source" in the strict sense: the training data and code often remain private, and the license may restrict use. A few representative families:
| Family | Publisher | Typical sizes | License (check for each version) |
|---|---|---|---|
| Qwen | Alibaba | 0.5 B to several hundred B | Apache 2.0 for most sizes; some (Qwen2.5-3B for example) under a research license |
| Llama | Meta | 1 B to 405 B and more | Llama community license, with conditions (user threshold, attribution) |
| Mistral | Mistral AI | 7 B to over 100 B | Apache 2.0 for some models, restrictive licenses for others |
| Gemma | 1 B to 27 B | Gemma-specific terms of use | |
| Phi | Microsoft | 3 B to 15 B | MIT |
| SmolLM | Hugging Face | 135 M to 3 B | Apache 2.0 |
| OLMo | Ai2 | 1 B to 32 B | Apache 2.0, training data and code published |
These families release new versions several times a year: the table gives landmarks, not a ranking. Always read the license of the exact version you fine-tune, and that of the data that comes with it.
Base or Instruct?
Each model often comes in two versions:
- Base: trained only to predict the next token. It continues a document; it does not know how to "answer".
- Instruct (or chat): the base model, fine-tuned and aligned to follow instructions in conversation, with a chat template (lesson 2.3).
| Situation | Choice |
|---|---|
| A few hundred to a few thousand examples, conversational format | Instruct: you adjust an existing behavior |
| Tens of thousands of examples or more, a format very different from a conversation | Base: you teach an entirely new format |
| Need to keep general instruction following | Instruct |
Forge starts from Qwen2.5-0.5B-Instruct: few examples, a conversational task, and a model that can already read an instruction in French.
The criteria, in order
- The license: commercial use, redistribution of fine-tuned weights, attribution obligations.
- The language: a model trained mostly in English has a tokenizer that splits French poorly, and thinner knowledge in other languages.
- The size: it sets inference memory and latency for the whole life of the project (lesson 1.3).
- The starting quality on your task: measure the baseline (lesson 1.4) of two or three candidates.
- The context: the maximum length must cover your longest prompts.
- The ecosystem: support in TRL, PEFT, vLLM, llama.cpp, and availability of quantized versions.
The tokenizer, a discreet criterion
The same customer message is 23 tokens with the Qwen2.5 tokenizer (vocabulary of 151,665 tokens, multilingual) and 35 with SmolLM2's (49,152 tokens, trained mostly on English). Forge's system instruction goes from 101 to 127 tokens. A tokenizer suited to your language lowers training and inference costs, and leaves more room in the context.
On the other hand, a large vocabulary makes the model heavier: in Qwen2.5-0.5B, the embedding matrix (151,936 × 896) alone accounts for about 136 million parameters, more than a quarter of the model. For a small model, that is a significant memory item, and the logits (one value per vocabulary token, at every position) weigh heavily during training (lesson 1.3).
Small specialized model or large generalist model?
Fine-tuning often lets a small model match a large generalist model on a narrow task — it is even one of its main economic justifications (lesson 1.1). But a small model has less knowledge and reasoning capacity: it learns shortcuts more easily (lesson 2.4) and generalizes less well to new phrasings. The practical rule: start from the smallest model that meets your success criteria after fine-tuning, trying one size up first to know the ceiling.
Checks before committing
- Download the model, display its chat template and the rendering of an example (lesson 2.3).
- Measure the baseline on the test set (lesson 1.4).
- Estimate training and inference memory (lesson 1.3).
- Run a short training (a few dozen steps) to check that the whole chain works on your hardware.
That last point is not a formality. On the course's GPU (a GTX 1060, under Windows), TRL 1.15 crashes at the first step for lack of Triton (missing outside Linux); and its default setting, bf16, does not exist natively on that card: PyTorch emulates it silently, and each step takes 1.28 s instead of 0.97 s in fp32 on SmolLM2. Both workarounds are in Forge (forge/compat.py and sft.supports_bf16); a few minutes of testing reveal this kind of surprise before committing to the project.
Key takeaways
- Open-weights = downloadable weights, not necessarily open source: read the license of the exact version.
- Little conversational data: start from an Instruct model.
- Criteria: license, language, size, measured starting quality, context, ecosystem.
- The tokenizer affects cost: 23 tokens with Qwen2.5 versus 35 with SmolLM2 for the same French message.
- Choose the smallest model that meets your criteria, and validate the whole chain with a short training run.
Practice
- For two candidate models, compare the number of tokens of ten messages from your domain.
- Measure the baseline of
examples/01_baselines.pywithFORGE_BASE_MODELset to another Instruct model. - Note the exact license of your candidate model and list what it requires for commercial use.