Supervised Learning
Learn from “input + target” samples and make reliable predictions on unseen data.
Supervised Learning · supervised learning
- What it is—where “supervision” actually comes from, and why labels do not necessarily equal absolute truth.
- Two types of tasks—the difference between classification and regression, and what their answers look like.
- What learning actually learns—abstractly, what training is actually doing.
- Success criteria—why “getting everything right on the training set” does not count as success.
- Its weakness—how the labeling bottleneck gave rise to unsupervised and self-supervised learning.
- Its place today—why, in the era of large models, we still cannot do without it.
1What Is Supervised LearningIntuition
This section answers: To make a machine “learn” something, what is the most direct approach?
The most direct approach is somewhat similar to using worked examples to teach people to generalize rules: give the model manyinputs and corresponding targets, and make the predictions gradually approach these targets. The recorded target value here is calledlabel; “supervised” means that during training each input has a comparable target signal, not that there is a teacher watching in real time.
Therefore, supervised learning can be understood asusing “input–target” examples to learn a prediction rule. It aims to solve: given a new email not seen during training, how to make a checkable judgment based on past examples. During training, theinputis the email content and the corresponding label,outputis a model that can produce categorical or numerical predictions for new emails.
| Element | In the spam email example |
|---|---|
| Input x (feature) | the content of an email |
| Label y (training target) | the “spam” or “normal” recorded in the data |
| Training set | tens of thousands of “email → label” examples |
| Goal | learn a rule so that, fornew emails that have not been labeledit can also classify accurately |
Its basic process is to first have the model predict the training examples, then compare the predictions with the labels, and then adjust the rule based on the error and repeat. When the model gives a “spam probability of 0.8” for a new email, it means that under the current rule it leans toward the spam category; this does not prove that the label is absolutely correct, nor can it guarantee that it will remain reliable when the source of emails changes.
2Two Types of Tasks: Classification and RegressionIntuitionMath
The labels in the previous section were “spam/normal.” But answers are not always this kind of “choose one of several.” What the answer looks like divides Supervised Learning into two major categories.
| Task | What the answer is | Examples |
|---|---|---|
| Classification | Discrete categories (choose one of several) | spam/normal, cat/dog/bird, positive/negative reviews |
| Regression | Continuous numerical values | House prices, tomorrow’s temperature, product sales |
Scroll horizontally to view the full diagram on small screens.
Classification and regression describethe two basic forms of Supervised Learning output, used to avoid mixing up categories, probabilities, and continuous numerical values.
Given sample features and training targets, classification outputs a class or probabilities for each class, and regression outputs a continuous numerical value. During training, both first produce predictions, then use a task-appropriate loss to compare the prediction with the target, and finally adjust the model.
3What Does “Learning” Actually Learn?Math
Classification and regression look different, but when abstracted into mathematics, what training does isthe same thing. What is it?
Think of the rule to be learned as aparameterized function f_θ: feed in the input x, and it outputs a prediction f_θ(x). Here θ is the set of parameters that the model needs to learn,n is the total number of training samples,i is the sample index,xᵢ and yᵢ are the input and label of the i-th sample, respectively. Learning means finding a set of parameters θ, which makes the average error on the training samples as small as possible:
L is the loss function, which turns the disagreement between a prediction and the label into a number; for now just understand its role. See 1.2 for specific losses and 1.3 “Gradient Descent” for how parameters are updated.
Here “learning” refers tofinding a set of parameters from the candidates that has a relatively small average loss. The input is the training samples, the current parameters, and the loss rule; the output is the updated parameters and the prediction function determined by them. During training, first use the current parameters to compute predictions, then compute the loss for each sample, then aggregate the batch average and update the parameters; after repeating for many batches, use independent data to judge whether the rule has actually improved.
3.1 Work Through a Binary Classification Batch by Hand
First, unify notation: let y=1 represent spam, and y=0 represent normal email; the model always outputs the same quantity p=P(y=1|x), that is the probability that “this email is spam.” Now consider a small batch with only two emails:
- The first is actually spam (
y=1), and the model outputsp=0.80, so the probability it assigned to the true class isq=0.80. - The second is actually normal mail (
y=0), and the model outputsp=0.30; the probability of normal mail is1-p, so the true class probabilityq=0.70.
The full form of binary cross-entropy is:
When y=1, the second term becomes 0, and the loss is −ln(p); when y=0, the first term becomes 0, and the loss is −ln(1−p). In other words, both cases can be written uniformly as −ln(q), where q is the probability that the model assigns to the true class.
| Sample | Model output p: spam probability | True class probability q | Loss −ln(q) |
|---|---|---|---|
| Spam, y=1 | 0.80 | q=p=0.80 | 0.223 |
| Normal mail, y=0 | 0.30 | q=1−p=0.70 | 0.357 |
| Batch average | — | — | (0.223+0.357)/2=0.290 |
q is closer to 1, −ln(q) is closer to 0; the smaller the probability assigned to the true class, the faster the penalty grows. For example, q=0.9 gives a loss of about 0.105, and q=0.1 gives a loss of about 2.303. It especially penalizes predictions that are “very confident but wrong,” while also being a continuous function that is easy to optimize.A decreasing average loss means the model is closer to the labels under the current sample and loss definition, but it does not mean every sample is predicted correctly, nor does it automatically imply that it can generalize. Parameter update methods vary by model; the binary classification mini-batch in this section only explains “how probability becomes loss” and cannot replace the later gradient derivation or test set acceptance.
4Success Criterion: Not Memorization, but GeneralizationIntuitionEngineering
Since training is about “making predictions close to the labels,” does getting all the labels in the training set right mean success?
So the standard practice is to split the data into three parts, each with its own role:
Scroll horizontally to view the full diagram on small screens.
- Training set
- Used to tune parameters
- Validation set
- Used to select model/hyperparameters
- Test set
- Final acceptance once
4.1 Metrics Must Correspond to Error Costs
Suppose there are only 100 spam emails among 10,000 emails. A model that classifies all emails as “normal” still has 99% accuracy, but it misses all spam emails. Therefore, acceptance testing cannot only ask “how many overall are correct”; it must also look separately at:
| Metric | What it answers in the spam email task | Main risk |
|---|---|---|
| Precision | Of the emails that are blocked, how many are really spam? | Low precision will mistakenly block normal emails |
| Recall | Of all spam emails, how many are successfully blocked? | Low recall will miss spam emails |
| Slicing by scenario | Are new senders, different languages, and phishing emails all reliable? | Overall averages can hide failures in key subgroups |
The model outputs probabilities, and finally classifying them as “spam/normal” still requires choosing a threshold. The lower the threshold, the more are blocked and the more false positives; the truly appropriate threshold depends on the business cost of the two types of errors.
Generalization evaluation describeswhether the model remains effective on data that did not participate in training and selection, and it solves the problem that training scores cannot represent real-world performance.
The inputs to evaluation are a frozen model, independent samples and their targets; the outputs are acceptance evidence such as loss, precision, recall, and business slices. The specific procedure: first use the training set to fit parameters, then use the validation set to select the approach, and finally use the test set only after the approach is frozen.
When validation error starts to increase while training error continues to decrease, it indicates the model is more like memorizing training details. But a single high test score is still affected by sample representativeness, temporal changes, and data leakage, and cannot prove reliability in all future scenarios.
5The Cost of Supervision: Labeling BottleneckEngineering
Where does such a direct and effective method fall short? The answer lies in the word “supervision”.
The fuel for supervised learning isdata with target values. Targets may come from manual labeling, or from transaction results, sensor measurements, user behavior, or rule systems. What is truly difficult is not just increasing the number of labels, but obtaining data that is consistent with the real target, covers deployment scenarios, and whose quality can be verified:
- Expensive, slow: large-scale labeling is a huge amount of human effort, and many fields still require experts (medical imaging, law).
- The target may be a proxy: clicks do not necessarily equal liking, and historical approval results may also replicate past biases.
- Noisy and ambiguous: some tasks are difficult for people themselves to label consistently, and automatic logs may also record errors.
- Distributions change: training emails come from the past, while attack methods, users, and language will continue to change.
The “labeling bottleneck” recordsthe limitations of reliable target signals in cost, quality, and coverage, used to determine whether a supervised scheme can support real deployment.
When evaluating, input the labeling source, sampling scope, consistency results, and deployment scenarios; output the usable label scale, noise slices, coverage gaps, and priorities for continued collection.
The approach is not just to count the total number of labels, but to first sample and review labeling consistency, then compare coverage across different populations, times, and sources, and subsequently check whether the labels align with the true business objective. A high consistency rate indicates that the labeling rules are relatively stable, not that the target itself is unbiased; cheap automatic logs do not mean they are trustworthy, while expert review is more accurate but may be expensive and slow.
6It's Not the Only Paradigm: Four Ways of LearningIntuition
If no external target values are provided, what signal can a machine still learn from? Put supervised learning into a bigger map.
| Paradigm | What it learns from | Typical tasks |
|---|---|---|
| Supervised Learning | Labeled samples | Classification, regression |
| Unsupervised Learning | No labels; discovers structure on its own | Clustering (automatic grouping), dimensionality reduction (using a few coordinates to summarize multiple features, facilitating compression or observation) |
| Self-supervised Learning | No need for manual annotation; uses the data itself to construct answers | Large model pre-training (predicting the next word) |
| Reinforcement Learning | Trial and error in an environment, relying on reward signals | Playing chess, robotics, RLHF in alignment |
This comparison table describeswhere the training signal comes from and what is produced after learning, used to choose an appropriate paradigm when no manual labels are available.
The input is the data available for the task, the feedback method, and the interaction conditions; the output is the choice of a supervised, unsupervised, self-supervised, or reinforcement learning path, along with the corresponding model, structural representation, or policy.
When making a judgment, first check whether there is an external target value; then check whether the data can construct targets on its own; finally, check whether the problem requires delayed rewards obtained through actions. The classification result indicates the main source of supervision, not that an algorithm can only belong to one traditional category; self-supervised learning can be like supervised training in computational form, and RLHF also mixes supervised fine-tuning, reward models, and reinforcement learning, so the boundaries allow combinations.
7In the era of large models, does it still matter?EngineeringSynthesis
Since large models rely on self-supervised pre-training, why still learn supervised learning?
Because it is thecommon language, and it is still everywhere today:
- Turning a base model into an assistant: Instruction fine-tuning (SFT) is supervised learning—"instruction" is the input and "ideal answer" is the label (see the "Fine-tuning" deep-dive page).
- Many downstream tasks: For classification, scoring, and extraction in vertical domains, many are still cheapest and most stable when using labeled data for supervised learning.
- Evaluation philosophy: Evaluation sets with reference answers follow the idea of held-out testing; but evaluating a model on a dataset does not mean the model has undergone supervised training on that dataset.
The role of supervised learning in the era of large models can be understood asusing high-quality target signals to constrain the specific behavior of a general-purpose model. It addresses the problem that a model with broad pre-training capabilities may not necessarily answer according to task requirements.
Inputs can be instructions and ideal answers, domain samples and labels, and the output is a supervised fine-tuned model or a task-specific predictor.
In application, first define the behavior you want the model to exhibit, then collect representative input–target pairs, then minimize the loss between predictions and targets, and validate on an independent slice. An improvement in downstream scores indicates the model is more suitable for the current objective and distribution, but it cannot be inferred that its foundational knowledge has increased comprehensively; when demonstration data is narrow, labels are biased, or deployment tasks change, supervised adaptation can still fail.
8Connecting the entire causal chainSynthesis
From samples paired with inputs and targets to reliable predictions on unseen samples, how is the evidence chain built step by step?
- Give the model samples of 'input + target value' to let it learn the rule from input to output—this is supervised learning. Target values may be noisy, so data quality is also part of the mechanism.(§1)
- Discrete answers mean classification; continuous ones mean regression.(§2)
- Abstractly, training = adjusting parameters to make 'predictions' close to 'labels', i.e., minimizing the loss.(§3)
- The criterion for success is not memorizing the training set, but being accurate on unseen data (generalization), so we should split into training/validation/test.(§4)
- It requires target values paired with inputs; sources can be manual labeling or observational records such as transaction outcomes and sensor measurements. The bottleneck lies in the cost, quality, target consistency, and scenario coverage of the supervision signal; it cannot be attributed solely to manual labeling.(§5)
- When comparing other paradigms, examine the signal source and learning objective separately: unsupervised learning seeks structure from unlabeled data; self-supervised learning constructs targets from the data itself, reducing dependence on manual labels and supporting large-scale pre-training; reinforcement learning learns sequential decision-making from rewards brought by actions. These differences do not mean that all three emerged to circumvent the labeling bottleneck.(§6)
- In the era of large models, it has not been replaced; instead, it is redirected to calibrate behavior (SFT), adapt to downstream tasks, and perform evaluation.(§7)
9Common MisconceptionsIntuition
This section only disambiguates: which statements sound reasonable but would directly lead to wrong data, training, or acceptance decisions?
| Misconception | More Accurate Understanding |
|---|---|
| Supervised Learning = Neural Network | It is atraining approach; Neural Network, decision trees, and SVM can all be trained with it. |
| If the training set is accurate, it's successful. | The goal isgeneralizationto new data; a perfect score on the training set may just be overfitting. |
| Labels are objective truth. | Labels are training targets; they may have noise, disagreement, or just be business proxies. |
| More data is always better. | Data'squality, representativeness, and target consistencycannot be replaced by quantity |
| In the era of large models, it is outdated. | Pre-training heavily uses self-supervised learning; SFT and many downstream adaptations still use supervised learning, and evaluation borrows the held-out test principle. |
| Self-supervised learning is just automatically generating manual labels. | It constructs supervisory signals from data structure; the computational form may resemble supervised training, but the paradigm classification and learning objective are more complex. |
10Check whether you really understandSelf-test
The questions move step by step from definitions to real acceptance; each scenario question uses only concepts already established on this page.
- Where does 'supervision' come from? Why is the label not necessarily equal to objective truth?
- What is the fundamental difference between classification and regression? Give one example of each.
- Explain in one sentence: abstractly speaking, what is supervised learning training doing?
- Why does 'predicting the entire training set correctly' not mean the model is successful? How should it be correctly evaluated?
- The data bottleneck of supervised learning is not just 'expensive manual labeling.' What other problems does it include?
- What are the connections and differences between self-supervised and supervised learning, respectively, in terms of computational form and the source of the supervisory signal?
- In the era of large models, in which stages does supervised learning still play a role?
- Among 10,000 emails, only 100 are spam. The model predicts all as normal. What is the accuracy? Why does this result not show that the model is effective?
- You find that duplicate versions of the same email appear in both the training set and the test set. Why does the test score become inflated? How should you re-split the data?
- Design three acceptance slices for the spam model, and for each slice explain the errors or metrics to observe.
Reference answers
- Supervision comes from the target values paired with inputs in the training samples; labels are used to compute loss and adjust the model, but they may contain mislabeling, subjective disagreement, measurement error, or proxy bias, so they do not naturally equal objective truth.
- If the answer is a discrete category, it is classification (spam/normal); if it is a continuous numerical value, it is regression (house price).
- Adjust the model parameters so that its predictions on the training samples are as close to the labels as possible, that is, minimize the loss.
- Because when there are enough parameters, the model may memorize the training set but fail to generalize; you should use a validation set to select the model and hyperparameters, and after the approach is frozen, use a test set that did not participate in selection for acceptance. If the test results are used for further modification, new independent test data is needed afterwards.
- It also includes label noise and ambiguity, targets that are only business proxies, insufficient data coverage, and distribution shift over time between the training distribution and the deployment distribution. Methods such as self-supervised, unsupervised, semi-supervised, and weakly supervised learning reduce reliance on high-quality human labels from different angles.
- In computational form, both may construct inputs, targets, and minimize loss; the difference is that ordinary supervised learning uses externally provided targets, while self-supervised learning constructs the supervisory signal from the data's own structure. This allows large models to leverage massive amounts of data without human annotation for pre-training.
- Typical stages include supervised fine-tuning (SFT) with demonstration data, and using domain labels to adapt classification, extraction, or scoring tasks. Evaluation with reference answers borrows the held-out test principle of supervised learning, but evaluation itself is not training.
- The accuracy is 99%, because 9,900 normal emails are all predicted correctly; but all 100 spam emails are missed, so the spam recall is 0%. You should report spam recall and the precision of blocked emails at the same time, and choose the threshold based on the cost of false positives and missed detections.
- Duplicate samples make the test set no longer representative of unseen data, and the model may obtain inflated scores by memorization. You should first deduplicate by original email or email thread, then split using email source, thread, or time as grouping units, ensuring that variants from the same source fall into only one set.
- You can design: ① slice by true class, and look at spam recall and the false positive rate on normal emails separately; ② slice by source and language, checking precision/recall on new senders, different domains, and different languages; ③ slice by time, using more recent emails to test performance after attack methods change. The miss rate for high-risk phishing emails should have an independent upper limit and cannot be offset by the high accuracy on normal emails.
11Concept Dependencies and Extended LearningPath
As page 1 of the official path, which content must be mastered now, and which content only needs to be encountered now and left for later nodes to expand?
| Learning level | Concepts involved |
|---|---|
| Before this page | Only need to know that a function means "input passes through rules to produce output"; vectors can for now be understood as a set of numbers |
| Core of this page | Labels, classification and regression, generalization, training/validation/test, four learning paradigms |
| Next step | Information theory, loss functions, gradient descent; this page's cross-entropy and parameter updates will be formally developed at those nodes |
| Immediate extensions | Overfitting, regularization, unsupervised learning, reinforcement learning; self-supervised learning will continue to be expanded in the model architecture stage |
| Further | Pre-training, fine-tuning and instruction fine-tuning, large language models, evaluation |
- Deep Learning, Chapter 5: Machine Learning Basics: supervised learning, empirical risk, generalization, and the training/validation/test boundary.
- The Elements of Statistical Learning: classification, regression, model selection, and the statistical learning framework.
- Stanford CS229 Lecture Notes: input–target, hypothesis function, classification/regression, and loss optimization.
- Learning from Noisy Labels with Deep Neural Networks: A Survey: how label noise affects generalization and its evaluation boundaries.
- A Survey on Self-supervised Learning: the sources of self-supervised signals and their classification relationship to unsupervised learning.
- Training Language Models to Follow Instructions with Human Feedback: an example of supervised fine-tuning of large models and the subsequent reinforcement learning stage.