Evaluating Trained Models
Evaluation is a process that produces a number from a collection of model outputs. Each step hands a slightly different collection to the next step, and the final number only makes sense if you understand what each step did to the collection.
A Spam Filter Before It Goes Live
Imagine an email service that must decide, for every incoming message, whether it is spam or not spam. The service has never seen the message that just arrived, so it cannot look up an answer. What it needs is a system that has learned from earlier examples what spam tends to look like, and can then apply that learning to a message it has not encountered before.
Training such a system is only part of the story. Once training has finished, you still have to find out how well the model performs on the task you cared about. A changed model is not automatically a better one. This article follows a fine-tuned model from the end of training to a single performance number, and it shows what each step does to the information along the way.
Evaluation is a process that produces a number from a collection of model outputs. Each step hands a slightly different collection to the next step, and the final number only makes sense if you understand what each step did to the collection.
Training and Inference Side by Side
The supervised learning workflow for predictive modeling is a sequence of stages that run in a fixed order. Stage one is training. A learning algorithm uses a labeled dataset to produce a trained model. Stage two is inference, in which the trained model is applied to new observations whose labels are unknown and returns predicted labels.
In the spam case, the training dataset is a collection of emails, and each email comes with a label of either spam or not spam that a human has identified. The emails are the inputs the model looks at, and the labels are the answers it is supposed to learn to produce. Without the labels, the dataset would contain only emails, and nothing would signal to the learning procedure which emails were right or wrong.
The two stages use data in opposite ways. During training, both the examples and their labels are known, and the learning algorithm uses that complete pairing to build the model. During inference, the model receives only the new observations. Their labels are unknown, and the model's job is to predict them. The trained model is the hinge of the whole process: training produces it, and inference uses it.
| Stage | What goes in | What is known | What comes out |
|---|---|---|---|
| Training | Labeled dataset (emails plus spam or not spam labels) and a learning algorithm | Both examples and their labels | A trained model |
| Inference | New observations, such as an incoming message | Only the observations; labels are unknown | Predicted labels |
The two stages of the supervised workflow, using the spam example
Where Evaluation Sits in the Workflow
A trained model is not automatically ready for use. Training produces a model that has fit the labeled examples, but the workflow requires one more check before the model is applied to real observations. A model evaluation step is placed between the training and inference stages to check that the model satisfies the performance criteria we care about before it is used in a real-world application.
Read the diagram from left to right. The labeled dataset and the learning algorithm together make up the training stage, and their result is a trained model. The model is then evaluated. Only after that does the workflow move to inference. The evaluation step is the gate: its purpose is to confirm that the model meets the criteria before the model receives real observations.
Following the Collection Through Each Step
Evaluation starts with a test set, which is a set of inputs the model was not trained on. The fine-tuned model is run on each item in the test set, and its responses are collected. At this point the collection holds raw responses, and nothing has been judged yet. The next step is scoring, in which each response receives a score. Finally, the scores are averaged, and the average is the number that quantifies performance.
Trace the state at each point. Before any step runs, the evaluation holds only the test inputs. After the model runs, it holds raw responses. After scoring, the collection is a list of responses with a score attached to each. After averaging, the collection has become a single value. Each transition changes what the collection is, not just what it contains.
From Responses to One Score
The source gives one concrete tool for the scoring step. The Ollama application, paired with an 8-billion-parameter Llama model, can automatically score the fine-tuned model's responses on the test set. The source also notes that another LLM can serve as the scorer, so the scoring role is not tied to one particular model.
Notice that the number of items shrinks from many to one at the last step. The test set may contain many examples, but the reported performance is a single number. Any question about one particular example can be answered only by going back to the scored collection that existed before the averaging took place. This is why the per-item scores are worth keeping when you need detail.
Why the Test Set Stays Separate
The test set is made of inputs the model was not trained on. This separation matters because a score computed on examples the model learned from would say how well it memorized them, not how well it handles new observations. The evaluation therefore draws its inputs from a portion of the data that training did not use.
In data-flow terms, a labeled dataset is divided into a training portion and a test portion. The training portion flows into the learning algorithm and shapes the trained model. The test portion flows into evaluation, where the fine-tuned model runs on it, its responses are scored, and the scores are averaged. Each example goes to one of the two roles, and the evaluation depends on keeping them apart.
Same Workflow for LLM Classification and Generation
The same workflow describes how Large Language Models are trained and used. The general pattern of training, evaluation, and inference stays the same. What changes is the inference behavior, which depends on the kind of task. The source distinguishes two kinds of LLM task: text classification and text generation.
| Aspect | LLM text classification | LLM text generation |
|---|---|---|
| Stage pattern | Train, evaluate, then infer | Train, evaluate, then infer |
| Inference output | A label for the input text | New text produced by the model |
| Evaluation input | Test set of texts the model was not trained on | Test set of inputs the model was not trained on |
| Scoring | Each response is scored, then averaged | Each response is scored, then averaged |
The same workflow applied to two kinds of LLM task
The source states the workflow applies to both cases, while noting that inference behaves differently between them. When reading evaluation results, keep track of which kind of task produced the responses, because the responses being scored look different in each case.
A Small Evaluation Traced by Hand
Tracing a five-item evaluation
A fine-tuned spam classifier is run on a test set of five emails that it did not see during training. Each response is scored as 1 when it is correct and 0 when it is wrong. Trace the collection through each step and find the single reported score. This is an illustrative example invented for teaching, not a result from the source.
- 1Start with test inputs
The collection holds five emails. Nothing has been run or judged yet.
- 2Run the model
The model returns five raw responses. The collection is now five text outputs, still unjudged.
- 3Score each response
The scorer attaches a score to each response: 1, 1, 0, 1, 1. The collection is now five numbers, each tied to one response.
- 4Average the scores
Four of five responses scored 1, so the average is 0.8. The collection has shrunk to a single value.
The reported performance is 0.8. The single number hides which email was wrong; the per-item scores still show that the third response scored 0.
Reading an Averaged Score Carefully
Common mistake Treating the average as a full description of the model's behavior
What it looks likeA model reports 0.8 and the team assumes it handles every kind of email equally well.
Why it failsAn average summarizes the test set but hides the spread of individual scores.
Do this insteadKeep the per-item scores when you need detail about which examples failed.
Common mistake Assuming two models with the same average behave the same way
What it looks likeTwo models both average 0.8 on the same five emails, but one misses a different email than the other.
Why it failsThe average is one number, so two very different sets of per-item results can produce it.
Do this insteadCompare the scored collections item by item before choosing between the models.
Common mistake Forgetting that the averaged number cannot be traced back to an example
What it looks likeA reviewer asks why one specific email was handled poorly and the team looks only at the 0.8.
Why it failsThe last step collapses many items into one number, so the question about one example can only be answered from the earlier scored collection.
Do this insteadGo back to the scored responses before averaging to investigate a single example.
Common mistake Mixing up the test set with the training data, so the score reflects memorization rather than performance on new inputs
Practice Tracing an Evaluation
A fine-tuned LLM is evaluated on a test set of four responses. The scorer gives them the scores 1, 0, 1, and 1. Before computing anything, describe what the evaluation collection holds after each of the four steps: test inputs, raw responses, scored responses, and the average. Then state the reported average and explain what information it hides.
Hints
- Ask what the collection looks like at each step: unjudged text, then numbers attached to responses, then one value.
- An average of the four scores is a single number; think about which response was the zero and whether the average reveals it.
Key Takeaways
- Supervised learning has two main stages: training turns a labeled dataset into a trained model, and inference applies that model to new observations whose labels are unknown.
- A model evaluation step sits between training and inference to check that the trained model meets the performance criteria before it is used in a real application.
- Evaluation runs the fine-tuned model on a test set of inputs it was not trained on, collects the raw responses, scores each one, and averages the scores into a single number.
- The collection changes at every step, from inputs to raw responses to scored responses to one average, and the average hides the spread of individual scores.
- The same workflow applies to LLM text classification and text generation, though inference behaves differently for each task.