Anatomy of an AI system
Training produces settings you can save. Answering a question produces temporary values specific to that question. The distinction explains what changes when you start a new conversation.
Open this chapter with experiments and audio
What goes into one prediction?
Suppose a small model estimates a price in thousands of euros. Its rule is prediction = weight × floor area + bias. Give it an area of 70 m², a weight of 3 and a bias of 10. The multiplication yields 210. Adding the bias yields 220, which means €220,000 in this model’s units. These invented values make each role visible.
| Item | In this calculation | When it changes |
|---|---|---|
| Architecture | Multiply, then add | When the model design changes |
| Parameters | 3 and 10 | During training or when loading other weights |
| Input | 70 m² | For each home |
| Intermediate value | 210 | When the input or parameters change |
First move only the floor-area control. The prediction changes with exactly the same model settings. Then load checkpoint B. A different slope and bias now apply to the same property. These actions separate supplying new evidence to a saved model from replacing the model itself.
Why does training need a target?
If a known sale closed at €235,000, the prediction of 220 falls short by 15 in the model’s units. Squaring the difference gives a loss of 225. This number evaluates the current settings on one case. It does not identify which setting is responsible. A gradient supplies local information about how the loss responds to each parameter.
Use current weights to obtain a prediction.
Compare prediction with the known target.
Compute sensitivity of loss to each weight.
Let the optimizer adjust the weights and repeat.
A single sale provides few constraints. Many combinations of slope and bias pass through that one point. Examples with different areas provide independent information. Later chapters use this fact to explain what a fitted model can infer and what the data leaves uncertain.
Which values survive a restart?
A saved checkpoint contains the model’s parameters and may include additional state for resuming training. To make a new prediction you also need the compatible architecture and input preparation. Supplying 70 in square feet to a model trained on square metres silently changes the meaning of the number. A valid array shape cannot catch that mistake.
weight, bias = 3.0, 10.0
for area in [70, 80]:
value = weight * area
prediction = value + bias
print(area, value, prediction)The intermediate values change from 210 to 240. The weight and bias retain their values across both calls. This is inference. A language model uses many more intermediate values, including token representations and attention outputs, under the same distinction.
How can an answer change overnight?
A document assistant can use the same checkpoint on Monday and Tuesday. If a retrieved handbook changed, the input token sequence changes and so can the answer. A persisted chat history has a similar effect when the application includes it in the next prompt. For reproducibility, record model version, input context, decoding settings and tool results.
The prompt includes a newly written policy. Which values respond immediately?
The input IDs and intermediate activations can change. Changing stored weights would require a separate update, such as another training run.
A sensor changes units. What breaks first?
An inspection system measures the diameter of a component. During training, the mean diameter was 10 millimetres and the standard deviation was 2 millimetres. The input step subtracts 10 and divides by 2. A measurement of 12 mm therefore becomes (12 − 10) / 2 = 1. That 1 means “one training standard deviation above the mean”. The fitted mean and scale must be saved alongside the model or reproduced exactly.
Suppose the model computes score = 3 × scaled diameter + 2, and the application sends parts with a score above 4 to manual inspection. Our part scores 5 and goes to inspection. A replacement sensor reports the very same part as 1.2 centimetres. Feed that number straight into the old pipeline and the scaled value becomes −4.4, the score −11.2. The part passes. Every multiply and add still works as specified.
Which comparison can locate the error before any retraining?
Measure the same reference part with both sensors. Record the raw value and unit, the standardized model input, the model score and the application decision. Converting the new reading from centimetres to millimetres before standardization restores 1, 5 and manual inspection. That experiment isolates the unit change for this reference part. Other diameters test for scale or calibration errors.
Compare an input change with a change to a saved weight →
Further reading · scikit-learn · StandardScaler