Suppose our fictional cafe starts with this estimate: preparation time equals 2 minutes per sandwich, plus 1 minute to pack the order. Two sandwiches produce a guess of 5 minutes. The recorded answer is 7.
We have an error. What can change?
The recipe for learning and the thing learned
A model is a mathematical structure used to turn inputs into predictions or generated outputs. Our tiny model multiplies the sandwich count by a number and adds another number. A model can be much simpler than a chatbot.
An algorithm is a specified procedure for carrying out a task. A training algorithm tells us how to adjust a model. The model is what we then use to estimate a new order. Think of the difference between instructions for adjusting a recipe and the resulting recipe.
Parameters are values that belong to the model and can be learned during training. In our example, 2 and 1 are parameters. A weight is a parameter that scales an input or connection. Our weight of 2 scales the sandwich count.
A bias parameter is an added offset. Our packing allowance of 1 is an offset even for an order with no sandwiches. This mathematical use of “bias” differs from unfairness or skew in data.
Put a number on the miss
Inference is using a model with its current parameters to produce an output. Making our 5-minute guess is inference. Training adjusts model parameters using data and a learning procedure. Updating the recipe after comparing guesses with recorded times is training.
A loss is a numerical penalty used to measure mismatch for a training objective. Our estimate misses by 2 minutes. If we choose squared error, the loss for this example is 2 × 2 = 4. Squaring makes larger misses count more strongly.
Loss is a training signal, not a complete definition of quality. A timing model can have a low average loss while regularly making poor predictions on large orders. We must check the situations we care about separately.
Adjust the knobs
Optimization is the process of searching for parameter settings that improve an objective. Gradient descent is one method that uses the local slope of the loss to choose a direction for parameter changes.
Imagine standing on a hillside in fog. The slope under your feet suggests a downhill direction. A small step may lower your position, but it does not reveal the whole landscape. Neural-network loss surfaces can be complicated, and this method does not guarantee the best possible model.
A learning rate scales how large each gradient-based update is. Huge steps can overshoot; very small steps can make progress slow. We judge settings with evidence, not a universal perfect number.
A hyperparameter is a setting chosen for the learning process or model design rather than an ordinary weight fitted by that process. The learning rate is one example. Hyperparameters can be tuned with another search procedure; “chosen” need not mean chosen by hand forever.
Practice in portions
A batch is a group of examples processed together for a training step. An epoch is one pass through the training dataset. Like checking a stack of order cards in handfuls, several batches can make one pass. Streaming and other training setups may organize progress differently.
Changing our weight to 3 would make the two-sandwich estimate 7, matching this one card. But perhaps it worsens ten other cards. Learning must consider more than the most recent mistake.
Work it out: what does the original model predict for three sandwiches?
2 × 3 + 1 = 7 minutes. This is inference with fixed parameters. Comparing that prediction with a label does not change the model until an update is actually applied.