In this lesson
AI turns knobs to make fewer mistakes.
On the inside, almost every AI is made of input numbers, adjustable knobs and a measure of error. You will do the math of one neuron by hand and see why correcting the assistant in the chat does not teach it.
- Add up inputs with weights and decide, in an example done by hand
- Explain "learning" as reducing error
- Tell training, testing and use apart
The simplest part: add up and decide
The smallest part of an AI multiplies each input by a weight, adds everything up and compares the total with a cutoff. A weight is how much each input counts in the decision.
Example: a spam filter with three inputs. The word "free" counts +2. Lots of capital letters count +1. A sender who is in your contacts counts −3. The cutoff is 1.5. An email with "free" and capital letters, from a stranger, adds up to 3. It went over the cutoff: spam.
Learning means turning the knobs
Nobody writes the weights. Each weight is like a knob on a mixing desk. The machine sees an example that comes with the right answer, compares it with what it said and turns the knobs a tiny bit to make fewer mistakes. It repeats this millions of times, with millions of examples. That is training.
A single layer is not enough for things that look very much alike. That is why layers are stacked. In an image network, the first layer usually sees edges, the next one joins edges into shapes, and the last ones recognize parts of objects. Nobody taught it that order: it comes out of the adjusting.
Training, testing and use
| Phase | What happens | Do the weights change? |
|---|---|---|
| Training | Examples with answers; the error adjusts the knobs | Yes |
| Testing | New examples, only to measure the error | No |
| Use | The finished model answers you | No |
The goal is to get right what the machine has never seen. If it memorizes the training examples and fails the test, that is overfitting. It is the student who memorizes last year's exam and does badly on this year's. So when you hear "it is 95% accurate", ask: on which examples?
The assistant predicts the next piece
To the machine, text is numbers. It cuts words into pieces called tokens. The Portuguese word "inteligência" may become two or three. That is why the assistant sometimes gets it wrong when counting letters: it does not see letters, it sees pieces.
After that, it does just one thing: it gives a probability to each token that could come next. In "The sky is", "blue" has a high probability and "green" almost zero. The answer is that choice repeated, piece by piece. Attention, an idea from the 2017 Transformer, helps decide which earlier words weigh the most. In "the bank closed because the river rose", "bank" looks at "river" and understands riverside, not money.
Correcting in the chat is not training
The weights only change during training. When you correct the assistant, the correction goes into the context: the text of the conversation, which it reads again for every answer. It looks like it learned, but it is the same model. Open a new conversation and the mistake can come back.
What the pros know
People who build a spam filter do not just choose to "get more right". The two kinds of mistake do not cost the same. Marking a real email as spam is worse than letting a spam email through, because you may miss an important notice. Back in 1998, the researchers' filter only marked an email as junk above 99.9% certainty. A professional always asks which mistake costs more and sets the cutoff by that, not just by the average.
Be careful with the average
Training measures the average error. A group with few examples weighs little in that average. In 2018, a study tested commercial systems that guess gender from photos: the error reached 34.7% for darker-skinned women, against at most 0.8% for lighter-skinned men. The average was hiding the difference.
Practice · 5 min
- Take ten of your own emails, five spam and five legitimate. For each one, mark 1 or 0 for the three inputs of the filter.
- Work out the total with the weights +2, +1 and −3. Above 1.5 is spam. Count how many it got right.
- Change one weight by 0.5 and count again. Did it get better or worse?
Summary
- The basic part multiplies inputs by weights, adds them up and compares the total with a cutoff.
- Training means turning the weights, millions of times, to make fewer mistakes.
- Only training changes the weights. Correcting in the chat does not train the model.
- The assistant picks the next token, one piece at a time.
- A high average can hide groups the AI gets wrong a lot.
Sources
Read on October 30, 2026.
- LeCun, Bengio and Hinton. Deep learning (Nature, 2015): weights, training and layers.
- Sahami et al. A Bayesian Approach to Filtering Junk E-Mail (1998).
- Vaswani et al. Attention Is All You Need (2017).
- Buolamwini and Gebru. Gender Shades (2018).
Lesson quiz
Three situations to apply what you learned.
Isaque Victor free courses