What Fine-Tuning Is
A language model is a program that has read a great deal of text and learned to predict what comes next. Out of the box it writes in an average of all the styles it has seen — competent, generic, and not quite yours. Fine-tuning is showing the model a set of examples of what you want, and letting it adjust itself a little on each one, until the behaviour you demonstrated becomes the behaviour it reaches for first.
The adjustment is the whole point, and also the whole cost. You are not editing text; you are changing the model. A fine-tuned model does not look up your examples when it answers. It has been nudged, example by example, so that answers like yours are the ones it finds easy to produce.
This guide teaches one particular way of doing that nudging, called LoRA, on a small model, on an ordinary computer, with a dataset small enough to read in one sitting: 24 invented answers from a fictional kettle's support desk, written in one fixed house style. The kettle is not the point. The point is a complete run — dataset, training, saving, testing — that you can check at every step, on hardware that will not hide anything from you.
The other two tools, honestly compared
Fine-tuning is the third tool people reach for, and often it should be the last. The first two are cheaper.
Prompting is asking well: clear instructions, a few worked examples pasted into the request itself, a firm statement of the format you want. It costs nothing, changes nothing, and can be revised in seconds. A surprising amount of what people fine-tune for — a tone, a format, a structure — a good prompt already gets.
Retrieval-augmented generation, or RAG, is giving the model your facts at question time: search your documents, paste the relevant pages into the prompt, let the model answer from them. RAG is the right tool when the problem is knowledge: prices change, manuals are revised, stock comes and goes. A fine-tuned model freezes whatever it was shown on training day; a RAG system reads today's page.
Fine-tuning is the right tool when the problem is behaviour: the model knows enough, but will not reliably answer the way you need — the same opening, the same shape, the same habits, every time, including when the prompt is short and the user gives it nothing to work with. Style, format, and routine judgement calls that you can demonstrate but find hard to specify: that is fine-tuning's ground.
A rough test before you train anything: if you can fix the answer by editing the prompt, do that. If you can fix it by handing the model the right page, do that. If you have fixed it neither way and find yourself writing the same correction for the hundredth time, you have a behaviour problem, and this book is about your tool.
The rule about data, stated early
Everything in this guide follows from one rule, and it belongs before any procedure:
Train only on data you have the right to use.
Your own writing, your organisation's documents used with its permission, public data whose licence allows it: yes. Somebody else's book, a scraped support inbox, another company's manual, a dataset of unclear origin that "everyone uses": no — not because the software will stop you (it will not), but because the rights were never yours to spend. Chapter 3 returns to this, because the dataset is where the rule does its work. The lab in this guide obeyed the rule the easy way: every example was invented for the occasion, about a product that does not exist, from a company that does not exist.
What the lab did
The lab behind this guide ran the real thing, small: distilgpt2, a model of about 82 million parameters — tiny by modern standards — trained on a laptop-class CPU with no graphics card involved. 24 examples, 20 passes over them, an adapter file smaller than a single photograph. The trained model was then asked questions it had not seen, and its answers printed next to the untrained model's, for you to judge. Chapter 8 shows both, including the comparison that did not go the guide's way. Nothing here is a demonstration of power; it is a demonstration of mechanism, at a scale where the mechanism cannot hide.
Who it is for
The person with a small, real job: a support desk whose answers should all sound like one careful person wrote them, a tool that must emit one strict format, a local model that must behave like the house expert on one narrow subject. The common thread is behaviour that can be shown better than it can be specified, and data that is yours to show it with.
What it is not
Fine-tuning is not a way to pour facts into a model. It can teach facts, after a fashion — chapter 12 is honest about how unreliable that is — but facts belong in documents a RAG system can read, where they can be corrected. Fine-tuning is not a substitute for a bigger model: a small model trained beautifully is still a small model, with a small model's grasp. And it is not free of risk: a model can be trained into bad habits as obediently as good ones, which is why this guide tests on questions the model never saw and prints what it finds.