An email arrives: “Congratulations, you have won a prize! Claim it right now.” The application sends it to spam. The filter’s developer probably never saw this exact text. How did the computer decide that the message was unwanted?
One approach is to train a model on examples, so it finds features useful for recognizing new messages. But those same features can mislead it: congratulations on winning a school tournament also contain the word “winning.”
This small task will help us understand what artificial intelligence means, how training works and why even a useful output needs checking. All messages below are invented for explanation.
From an email rule to a broader idea
Let’s write a rule: if an email contains “winning,” mark it as spam. Simple and understandable. Then an expected message arrives from a friend: “I’ll show you photos of us winning the tournament.” The rule fires even though we want the message.
Should we add an exception for the friend? Then what about other senders? Check links too? A link alone is not enough either: it might lead to a document we need. Each refinement requires deciding which features to consider together.
Artificial intelligence, or AI, is a broad field concerned with building systems for tasks such as recognition, language processing, planning and decision-making. It is not the name of one algorithm. It includes approaches with explicitly represented knowledge, rules and searches through possible solutions, as well as machine learning: obtaining useful patterns from data. Systems can combine these approaches. This broad framework is described in the OECD memorandum on the definition of an AI system, pp. 6–9.
The dividing line is therefore not between “ordinary programs with rules” and “AI without rules.” Training is performed by a program too. Our example makes a narrower distinction: we want to obtain part of the way messages are distinguished from examples, instead of manually anticipating every combination of features.
What actually learns?
First define the task: choose one of two categories for each email, “spam” or “not spam.” Choosing a category is called classification.
For training, collect messages whose answers are already known: unwanted advertisements and expected messages, for instance. The category attached to an email is a label. Together, the email and label form a training example. This approach is called supervised learning: supervision means that answers are available for comparison.
A model is a computational construction that transforms inputs into an output. Imagine a simple version that considers words, links and other selected features of an email. Numerical settings called parameters determine how much each feature influences the answer.
During training, an algorithm compares model outputs with known labels and changes parameters in an attempt to reduce errors. This describes one common training approach, not every possible AI system. The basic concepts are explained in Google’s supervised-learning course.
People still frame the task. What counts as spam: every advertisement or only unwanted advertising? Did the person subscribe to the mailing list? If that distinction matters but is absent from the data, the task already has a gap. Calling the process “learning” does not remove the need to formulate the question well.
Why use emails the model has not trained on?
A model can perform very well on familiar examples and poorly on new ones. Excessive adaptation to training data is called overfitting. The desired ability to apply learned patterns to new cases is generalization. Google on overfitting and generalization.
Suppose every spam message in our small training set uses capital letters. The model might latch onto that. But a friend sometimes writes “CONGRATULATIONS!”, while an advertisement can be quite restrained. Success on that dataset does not establish that we taught the filter the distinction we wanted.
We therefore hold some examples aside for evaluation. The model receives messages without labels; evaluators compare its outputs with known categories. Repeatedly choosing a model using the same dataset can inadvertently adapt the choice to that dataset too. A validation set guides selection, while a separate test set is kept for final assessment. Google on dividing datasets.
Evaluation must relate to future operating conditions. A collection of short advertisements says little about filtering long work conversations in another language. Even an honest test answers a limited question: how this model behaved on these data.
A new email belongs to a different stage
After training and evaluation, a new message arrives. We give it to the model and obtain an output. Applying a trained model is called inference.
Training changes model parameters; inference uses the model to produce an answer. In our simplified filter, parameters stay fixed during use. A system can be designed to keep learning, but receiving a new email does not itself imply this. The distinction between stages and the possibility of later updates are explained by the OECD, pp. 8–9.
In the diagram, trace where known answers help change the model and where they only help evaluate it. At the final step, we no longer supply a ready-made correct answer along with the message.
One model: from examples to a new email
Training
Emails + known labels“Claim your prize!” → spam “Meeting at three” → not spamThe algorithm changes parametersCompares model outputs with labels.Trained modelSave the resulting settings.Evaluation
Other emailsNot used for training. Labels are hidden from the model.The same modelParameters stay fixed during evaluation.Outputs ↔ known labelsAssess missed spam and incorrect blocking.Use
New email“Congratulations on winning the school tournament!”Evaluated modelUses parameters already set during training.Suppose the output is “spam”A possible mistake: this is an expected message from the school.
The model is also not the whole email application. The application receives messages, runs the required checks and decides where to put them. The model’s output is one part of that process. This is why “AI rejected the email” hides several different decisions worth examining separately.
Where do neural networks and generative AI fit?
We now have two concepts: AI as a broad field, and machine learning as a group of methods. A neural network is one type of model that can be trained.
In a typical network, computational nodes receive numbers, transform them using parameters and pass results onward. Groups of nodes form layers. The name “neuron” does not make a node a biological cell; having a network does not establish human-like thinking or consciousness. Its computational structure is shown in Google’s course on nodes and layers.
Generative AI describes another aspect of a system: it creates content such as text, images or sound. Our filter chooses an email’s category. A generative system could be given a different task: drafting a reply. Google on machine-learning tasks and generation.
These names answer different questions:
| Name | What does it clarify? |
|---|---|
| Artificial intelligence | Which broad field of systems and tasks are we discussing? |
| Machine learning | Are we obtaining patterns from data? |
| Neural network | Which type of computational model are we using? |
| Generative AI | Does the system create new content? |
Generation is therefore not a compulsory “next step” for every neural network. A network can classify emails. And a model’s ability to write text does not by itself tell us how well it will handle a particular request.
Usefulness depends on the output and how we check it
Return to email. Categorizing a message, estimating response time and writing a reply are three different tasks. Each needs appropriate data and a success criterion. The same reasoning helps us understand other applications.
| Task | What goes in | What comes out | How to assess usefulness |
|---|---|---|---|
| Recognition or classification | An email or photograph | A category or detected object | Compare with a verified answer; examine error types |
| Numerical prediction | A route and traffic data | An estimated journey time | Compare with actual times across many trips |
| Recommendation | Preferences and listening history | A selection of music | Check whether it helps find music the listener wants |
| Generation | A task, context and requirements | Text, images or other content | Check requirements; verify claims in factual text |
These are examples of task classes described in Google’s introduction to machine learning, not assessments of particular products.
For “make this email more polite,” usefulness may mean preserving meaning while improving tone. For “add the event date,” good style is insufficient: the date must be correct. The check depends on the task, even when both outputs look like a few sentences.
Two spam-filter errors we should distinguish
An expected school congratulations message goes to spam: a false positive. An unwanted advertisement reaches the inbox: a false negative. Both are wrong, but their consequences for the reader differ.
We could send every message to spam: no unwanted messages would reach the inbox, but all useful mail would disappear too. We could block nothing: wanted emails would remain, but the filter would not do its job. Asking only “does it find spam?” is therefore insufficient. We also need to see how much wanted mail it takes away. This distinction is formalized in classification quality metrics.
An error need not have a single cause. Our model might rely too heavily on “winning.” Ordinary congratulations might be missing from its data. Or the label itself might be uncertain: one person subscribed to an advertisement, another did not. These are possible explanations for an educational example, not diagnoses of a real filter.
Finding the cause requires data about how the filter works. One failed message demonstrates a particular mistake; a series of successful messages does not establish error-free performance in every setting either. Assessment needs a collection representing different cases, not just convenient examples.
Why a convincing sentence can be false
Generation errors look different: instead of a wrong category, we may get an invented fact expressed in entirely natural language.
A language model estimates patterns in sequences of text units called tokens. A token can be a word, part of a word or a character. When generating a continuation, a system uses the model to select successive tokens in the available context. This can produce sentences, translations or summaries. Google on language models and tokens.
But a plausible continuation and a verified fact are different criteria. Imagine asking for the date of the school tournament when it is absent from the supplied email. The answer can have a flawless form: day, month, year, even an explanation. Form cannot create missing evidence.
Generative systems can indeed confidently present false content and add fabricated references or explanations. NIST describes this as confabulation; the informal term “hallucination” is also used. Here it is a technical term for erroneous output, not a claim about human experiences within the model. NIST, Generative AI Profile, §2.2.
Asking the same system to “check yourself” again therefore does not itself provide independent confirmation. For the tournament date, that would be an announcement from the organizers or another appropriate primary source.
Begin with the task and finish with a check
Instead of a general “help with this email,” make a specific request: “Draft a short, polite reply confirming participation. Take the date and location only from this announcement. If they are missing, leave questions for the organizers.” We now know what the system received, what it should return and what a person will check.
A useful sequence is:
- Name the result. A category, prediction, selection and draft are different expectations.
- Provide relevant context. Include conditions and inputs needed to make the task unambiguous.
- Decide the check in advance. Comparison with the original, a calculation, a test or a suitable primary source.
- Consider the consequences of error. Editing an awkward phrase and losing an important email have different costs.
A spam filter can recognize an unfamiliar message because training adjusted its model to patterns in examples. Those patterns can be useful but may not fit the new case. Generation broadens the possible outputs without eliminating the gap between a system’s answer and checking it.
Try inventing two messages now: a wanted one with “winning,” and an unwanted one without it. This pair already shows why a single word is insufficient. The next question is what data and evaluation would help distinguish these particular cases.