AI for UX · Step 1 · 13 min read
How a model learns: train one on your laptop
A step-by-step explanation, for designers new to AI, of what a language model is, how it is trained in three stages, what fine-tuning and LoRA change, and how to read a real training run done on a laptop, with the mistakes it made.
You don't need to code to follow this note. It explains, in plain words, what happens inside a language model when it "learns", using a small experiment done on a laptop: teaching a model to write error messages in a fixed UX pattern. The commands are there for anyone who wants to repeat it, but every step is explained in words first.
What you'll be able to do after reading:
- Explain the difference between pre-training, instruction tuning and preference tuning
- Say what fine-tuning and LoRA change in a model, and what they don't
- Read a training report (loss, validation, overfitting) without being an engineer
- Decide, with your team, whether a problem needs fine-tuning or just better prompts and context
The experiment was run on a MacBook Pro (M3 Max, 36 GB) in November 2026. Tools and models change quickly; check versions before you repeat it.
1. First, what is a model?
A language model is, at heart, a very large set of numbers (its parameters) and a fixed recipe for combining them. A "4B" model has about 4 billion of these numbers. Nothing in it is a sentence, a rule or a fact stored in a database: everything it "knows" is spread across those numbers.
The model does one thing: given some text, it predicts what comes next. Text is cut into small pieces called tokens (whole words, parts of words, punctuation). For each position, the model gives a probability to every token it knows. An illustrative example:
"Your payment was declined because the card has …"
- expired62%
- insufficient21%
- been9%
- other tokens8%
The app picks one token, adds it to the text and asks again. A whole answer is this loop, hundreds of times.
The app picks one token (usually one of the most likely; temperature controls how adventurous that choice is), adds it to the text, and asks again. A whole answer is this loop repeated hundreds of times. That's why a model can sound fluent and still be wrong: it is producing likely text, not checking facts.
2. Three stages of training
Models you use every day went through three stages. Each one nudges the same sliders, with different material and a different goal.
Stage 1: Pre-training (learning the language and the world)
- Material: trillions of tokens from web pages, books, articles and code.
- Goal: predict the next token, again and again, across all that text.
- Result: a base model. It writes fluent text and has absorbed a huge amount of general knowledge, but it doesn't really "answer" you: it continues whatever you give it. Ask a classic base model "What's a good error message for a declined card?" and it may continue with three more questions, as if it were completing a forum page.
- Cost: months of work in large data centres. This is the stage only a few companies can afford, and the one that makes the model large.
Stage 2: Instruction tuning, or SFT (learning to be an assistant)
- Material: thousands to millions of example conversations: a request and a good answer, written or checked by people. SFT stands for supervised fine-tuning.
- Goal: the same next-token prediction, but now only on the answers, so the model learns what an assistant's reply looks like.
- Result: an instruct or chat model. It follows requests, uses formats (lists, tables, steps), and has a consistent tone.
- Analogy: an apprenticeship. "Here is a question; here is how a good professional answers it."
Stage 3: Preference tuning (learning which answer people prefer)
- Material: pairs of answers to the same request, where people (or another model) picked the better one. Methods have names like RLHF (reinforcement learning from human feedback) and DPO.
- Goal: make preferred answers more likely and rejected ones less likely.
- Result: a model that is more helpful, more careful, refuses unsafe requests, and matches what people find useful.
- Analogy: a design critique. Not "right or wrong", but "this version works better, and here's why".
- 1Pre-training
Predict the next token across trillions of tokens of text. Learns language and general knowledge.
Months, huge data centres. Result: a base model - 2Instruction tuning (SFT)
Learn from example conversations what a good assistant answer looks like.
An apprenticeship. Result: an instruct model - 3Preference tuning
Learn which of two answers people prefer (RLHF, DPO).
A design critique. Result: a helpful, careful model
Knowledge mostly comes from step 1 · behaviour (tone, format, refusals) from steps 2 and 3
3. Fine-tuning and LoRA
Fine-tuning means continuing to train an existing model on your own examples, so it adopts a behaviour, style or narrow task. Stage 2 above is a large fine-tuning; a product team's fine-tuning is the same idea at a tiny scale.
There are two ways to do it:
- Full fine-tuning nudges every parameter. For a 4B model that means 4 billion numbers to update and store: it needs a lot of memory and produces a whole new copy of the model.
- LoRA (low-rank adaptation) leaves the original model frozen and trains a small set of extra numbers that sit on top of it. At the end you get a small file, the adapter, that you load together with the original model.
How small? In our experiment LoRA trained 0.2–0.5% of the parameters, and the adapter files were 14 MB and 32 MB, next to models of about 1.6 and 3 GB.
Billions of parameters. Nothing changes here during LoRA training.
Qwen3.5 4B, about 3 GB on diskA thin layer on top that steers the model: 0.2–0.5% of the parameters.
Our adapter: 32 MB, trained in about 2 minutesModel + adapter = new behaviour · remove the adapter = the original model again
Why does such a small layer work? Most of what a task needs is already in the model; the adapter only has to steer it. Technically, LoRA describes the change to each large table of numbers as the product of two very thin tables, which is far cheaper to train ("low rank" refers to that thinness).
QLoRA is LoRA on a quantised model: one whose numbers are stored with less precision (for example 4 bits instead of 16). It's like saving an image as a good-quality JPEG instead of a raw file: a little detail is lost, the file is about four times smaller, and it now fits on a laptop.
4. The vocabulary of a training run
You'll meet these words in any fine-tuning discussion. Each one has a UX parallel.
| Term | What it means | UX parallel |
|---|---|---|
| Dataset | The examples the model learns from: inputs and the answers you want | The pattern library with do/don't examples |
| Training set | The examples the model actually studies | The cases you design with |
| Validation set | Examples kept aside to check progress during training | A pilot test with people who didn't help design |
| Test set | Examples kept aside until the very end, for the final check | The real usability test |
| Step (iteration) | One small update of the sliders, after looking at a few examples | One design iteration |
| Batch | How many examples the model looks at per step (4 in our runs) | How many screens you review before revising |
| Epoch | One full pass through the training set | Going through every case once |
| Learning rate | How big each nudge is. Too big: it jumps around; too small: it barely learns | How much you change between iterations |
| Loss | How surprised the model is by the correct answer. Lower is better; 0 means never surprised | Error rate in a test |
| Checkpoint | A saved copy of the adapter at a given step | A saved version in the file history |
| Overfitting | Fitting the training examples so closely that new cases get worse | Designing for the five people in your last test instead of everyone they represent |
5. The experiment: teach a model your error-message pattern
The task
Many content design guides have a rule for error messages. Ours: every error becomes three lines, a title that says what happened, a message that says why or what's still safe, and one action.
Input: HTTP 413 Payload Too Large: max 10MB
Output: Title: File too large
Message: Files can be up to 10 MB.
Action: Choose a smaller file
This is a good fine-tuning case: it's a behaviour (a format and a tone), not knowledge, and it's easy to judge by eye.
The data
36 hand-written examples covering connection problems, permissions, payments, uploads, validation and logistics. They were split:
- 28 for training, the examples the model studies
- 4 for validation, to watch progress during training
- 4 for testing, to check at the end
Each example is one line in a file, written as a tiny conversation: an instruction ("You rewrite technical error messages into user-facing microcopy"), the technical error, and the answer we want.
The tools
- mlx-lm, Apple's open-source library for running and training models on Apple silicon (MIT licence).
- Two open models from the Qwen3.5 family (Apache 2.0, free to use and modify): 0.8B (800 million parameters) and 4B, the second compressed to 4 bits.
The steps
# 1. Install the library
pip install mlx-lm
# 2. Ask the model before training (the "before" picture)
mlx_lm.generate --model mlx-community/Qwen3.5-4B-MLX-4bit \
--system-prompt "You rewrite technical error messages into user-facing microcopy." \
--prompt "NotAllowedError: Permission denied (camera)"
# 3. Train a LoRA adapter on the examples in the data/ folder
mlx_lm.lora --model mlx-community/Qwen3.5-4B-MLX-4bit --train --data data \
--iters 30 --batch-size 4 --learning-rate 5e-5 --mask-prompt --adapter-path adapters/microcopy
# 4. Ask again, now with the adapter on top (the "after" picture)
mlx_lm.generate --model mlx-community/Qwen3.5-4B-MLX-4bit --adapter-path adapters/microcopy \
--system-prompt "You rewrite technical error messages into user-facing microcopy." \
--prompt "NotAllowedError: Permission denied (camera)"
In words: --iters 30 is the number of steps, --batch-size 4 the examples per step, --learning-rate the size of each nudge, and --mask-prompt tells the model to learn only from the answers, not from the questions. Each training run took about 2 minutes.
6. Reading the results
Before training
Both models ignored the pattern. Given NotAllowedError: Permission denied (camera), they began a long reasoning monologue ("Thinking Process: 1. Analyze the request…") and never reached a three-line answer. They knew what microcopy is; they just didn't behave the way we wanted.
After training: the small model memorised
The 0.8B model was trained for 120 steps, so it saw each example about 17 times. It learned the format perfectly and stopped "thinking out loud". But look at the content, for errors it had never seen:
| Input (never seen) | Answer |
|---|---|
NotAllowedError: Permission denied (camera) |
Message: "Allow location access to see nearby depots. Archive them instead." |
HTTP 402 Payment Required: subscription lapsed |
Title: "Sign-in cancelled", copied word for word from a training example |
It stitched together pieces of training answers. It learned what an answer looks like, not how to write one.
After training: the larger model generalised
The 4B model was trained for only 30 steps (each example seen about 4 times). It kept the format and wrote new, sensible copy:
| Input (never seen) | Title | Message | Action |
|---|---|---|---|
NotAllowedError: Permission denied (camera) |
Camera is off | Allow camera to take photos. | Open settings |
HTTP 402 Payment Required: subscription lapsed |
Check subscription status | Subscription ended. | Renew subscription |
MemoryError: worksheet exceeds 1,048,576 rows |
Sheet too big | Too many rows in worksheet. | Reduce rows or use pivot table |
SSL_ERROR_BAD_CERT_DOMAIN |
Check the domain name | It doesn't match the one in the certificate. | Edit email address ✗ |
Two lessons in one table:
- A bigger model brings more knowledge from pre-training. It already "knew" what a camera permission or a spreadsheet limit is; the adapter only had to teach the pattern.
- The last row is a confident mistake. None of the 28 examples was about certificates, so the model filled the gap with an action that sounds right and isn't. That is a hallucination in miniature, and why every fine-tuned model still needs people to review its output.
7. Overfitting you can see
During training, the tool reports the training loss (how well the model fits the examples it is studying) and, every few steps, the validation loss (how well it does on the examples kept aside). This is the 4B run:
Validation lossTraining loss
How to read it:
- Training loss falls towards zero. The model is getting very good at the examples it is studying.
- Validation loss falls until step 10, then rises. After that point, every extra step makes it worse at new cases. It has started to memorise.
- The best adapter is the one from around step 10, not the last one.
8. What fine-tuning can and can't do
| You want the model to… | Reach for | Why |
|---|---|---|
| Follow your team's tone, format or pattern | Better prompts and context files first; fine-tuning if that fails at scale | Prompts are cheaper to change, review and roll back |
| Know your product, policies or latest data | RAG or tools | Fine-tuning doesn't add reliable facts, and facts go out of date |
| Run offline, on a device, or very cheaply | A small fine-tuned model | A 0.8B model with an adapter runs on a laptop |
| Stop a behaviour (rambling, unsafe answers) | A system prompt and guardrails | Deep behaviour changes are the vendor's preference tuning |
Hidden costs to mention when someone proposes fine-tuning: collecting and cleaning examples, keeping a test set, re-training when the base model or the product changes, and someone owning the adapter over time. For most UX teams the honest answer is still "not yet": good prompts and context files get further, faster. Fine-tuning earns its place when the same narrow task runs thousands of times, or must run where a large model can't.
9. Where designers make the difference
Fine-tuning looks like an engineering task, but most of the decisions that make it work are design decisions:
- Defining "good". The three-line pattern, the tone, what an action label looks like: that's content design. A vague definition produces a vague model.
- Writing the examples. The model copies what it sees. Inconsistent examples teach inconsistency; examples without empathy teach coldness. Our model only learned "Open settings" because the examples used it consistently.
- Covering the edge cases. The certificate error failed because no example looked like it. Designers are good at listing the cases nobody thought of.
- Writing the test cases and reviewing the output. Validation numbers catch memorisation; only people catch "technically fine, but wrong for our users".
- Designing for the model being wrong. Even a good adapter will sometimes produce the "Edit email address" kind of mistake. The interface needs a way to see, correct and report it. See Agentic design.
10. Try it yourself (no code needed)
- Pick one pattern your team already has (error messages, empty states, button labels) and write it down as a rule in three lines.
- Write 10 examples by hand, then 3 more that the rule doesn't obviously cover. Those 3 are your test set.
- Give the rule and the 10 examples to any AI assistant as a prompt, and ask it to handle the 3 test cases. This is "few-shot prompting", and often all you need.
- Note where it fails. Would more examples fix it, or a clearer rule? That question is exactly what a team should ask before choosing fine-tuning.
Reflection questions: Which of your team's patterns are behaviour (good for fine-tuning) and which are knowledge (better as context)? Who would own an adapter in your organisation?
11. The UX lead's checklist
Learn more
- Papers: LoRA (Hu et al., 2021) · QLoRA (Dettmers et al., 2023) · Training language models to follow instructions with human feedback (Ouyang et al., 2022)
- Hands-on: mlx-lm LoRA guide · MiniMind, a 64M-parameter model trained from scratch in plain PyTorch, to see the tokenizer and pre-training loop (hours per stage on a laptop)
Books, courses and videos to go deeper
Related
Module 12: AI and the UX Lead · Fine-tuning · Evals · Retrieval-augmented generation (RAG) · Context files · Few-shot prompting · Hallucination · Agentic design · AI governance and data protection