A learning algorithm is a procedure that takes training data and produces a model whose behavior improves on a defined task, usually by adjusting internal parameters to minimize a loss. In artificial intelligence, it is the component that separates systems that improve from experience from systems whose rules are written entirely by hand.
Among AI fundamentals, the concept is precise: the learning algorithm is not the model itself but the method that searches a space of possible models. Gradient descent training a neural network, the splitting procedure that grows a decision tree and the policy update rule of a reinforcement learning agent are all learning algorithms.
What a learning algorithm consists of
Every learning algorithm combines three ingredients: a hypothesis space of candidate models, an objective function that scores each candidate and an optimization procedure that searches for a good candidate. Changing any one of the three produces a different algorithm with different strengths.
The table describes these building blocks with concrete examples from widely used methods.
| Element | Role | Example |
|---|---|---|
| Hypothesis space | Defines which models are possible | All linear functions, all trees of depth 10 |
| Objective function | Measures how good a model is | Mean squared error, cross-entropy, reward |
| Regularization | Penalizes overly complex models | L2 weight penalty, tree pruning |
| Optimization procedure | Searches the hypothesis space | Stochastic gradient descent, greedy splitting |
| Stopping rule | Decides when to end training | Fixed epochs, early stopping on validation loss |
The assumptions built into these elements form the algorithm’s inductive bias. A convolutional network assumes local spatial patterns matter, while a linear model assumes additive effects. Without some inductive bias, the no free lunch theorem implies that no algorithm can outperform random guessing across all possible problems.
Main families of learning algorithms
Learning algorithms are usually grouped by the type of feedback they receive. The feedback determines what the objective function can measure and therefore what the algorithm can learn.
| Paradigm | Feedback available | Representative algorithms | Typical output |
|---|---|---|---|
| Supervised learning | Labeled input-output pairs | Logistic regression, gradient boosting, backpropagation | Classifier or regressor |
| Unsupervised learning | Unlabeled data only | k-means, principal component analysis | Clusters or compressed features |
| Self-supervised learning | Labels derived from the data | Masked or next-token prediction | Pretrained representations |
| Reinforcement learning | Scalar reward from an environment | Q-learning, policy gradient methods | Action policy |
| Semi-supervised learning | Few labels, many unlabeled examples | Pseudo-labeling, consistency training | Classifier |
A second distinction separates parametric algorithms, which compress data into a fixed number of parameters, from nonparametric algorithms such as k-nearest neighbors, which keep the training examples and grow in complexity with the dataset. A third separates batch learning, which processes a fixed dataset, from online learning, which updates the model one example at a time.
Learning algorithm, model and inference
Confusion between the learning algorithm and the resulting model is one of the most common errors in AI discussions. The algorithm is the recipe used during training; the model is the trained artifact, defined by its architecture and learned weights; inference is the act of applying the trained model to new inputs.
| Concept | What it is | When it runs |
|---|---|---|
| Learning algorithm | Procedure that fits parameters | Training phase |
| Model architecture | Structure of the hypothesis space | Fixed before training |
| Model weights | Learned numerical parameters | Produced by training |
| AI inference | Computing outputs from a trained model | Deployment phase |
| Hyperparameters | Settings that control the algorithm | Chosen before or between runs |
The same architecture can be trained by different algorithms. A neural network can be fitted with stochastic gradient descent, the Adam optimizer or evolutionary search, and each choice can lead to different weights, different training cost and different generalization quality.
How learning algorithms are evaluated and chosen
The central goal is generalization: good performance on data the algorithm has never seen. Practitioners therefore split data into training, validation and test sets, and they judge an algorithm by its error on held-out data, not by its training error.
Theory frames this through the bias-variance trade-off. Simple algorithms underfit because they cannot represent the true pattern, while highly flexible ones overfit by memorizing noise. Computational and statistical learning theory provide sample complexity bounds that relate model capacity, data size and expected error.
The decision table summarizes reasonable starting choices for common situations.
| Situation | Reasonable starting choice | Reason |
|---|---|---|
| Small tabular dataset | Gradient-boosted trees | Strong accuracy with little tuning |
| Images, audio or text | Deep neural network | Learns features from raw inputs |
| Need for interpretability | Linear model or shallow tree | Transparent decision logic |
| Sequential decisions with rewards | Reinforcement learning | Optimizes long-term outcomes |
| Few labels, much raw data | Self-supervised pretraining | Uses unlabeled data at scale |
Limitations and common mistakes
A learning algorithm can only extract patterns that are present in its data and reachable within its hypothesis space. Biased or unrepresentative data produces biased models, regardless of how sophisticated the algorithm is.
- Data leakage, where test information reaches training, yields optimistic results that collapse in deployment.
- Distribution shift between training and production data degrades accuracy silently over time.
- Optimizing a proxy objective can reward behavior that differs from the real goal.
- Comparing algorithms without equal tuning effort often favors the method the team knows best.
- Non-convex optimization offers no guarantee of a global optimum, so results vary with random seeds.
Scale introduces its own constraints. Modern deep learning algorithms can require thousands of accelerator hours, and their behavior depends heavily on learning rate schedules, batch size and initialization. Reproducing a reported result therefore requires documenting every hyperparameter, the data version and the random seed, not only the name of the algorithm.
Finally, a learning algorithm offers no understanding in the human sense. It finds statistical regularities that reduce the objective, and these may include spurious shortcuts, such as a hospital watermark that correlates with a diagnosis. Careful error analysis on realistic examples remains essential before deployment.
Understanding it simply
A learning algorithm is a method for learning from examples. Imagine teaching someone to sort apples by quality. Instead of writing every rule, you show many apples labeled good or bad. The person adjusts a mental rule after each mistake.
A learning algorithm does the same with numbers. It makes a guess, measures the error and adjusts. After many rounds, the result is a trained model that can judge new cases. The algorithm is the teaching method. The model is what the student ends up knowing.
Applied in practice
A regional electricity supplier wants to forecast hourly demand one day ahead. Its analysts have five years of hourly records with temperature, calendar features and holiday flags, about 44,000 labeled examples in total.
They compare three learning algorithms using the same data split: ordinary least squares regression, a random forest and gradient-boosted decision trees. Each is tuned with cross-validation on the first four years, and the final year serves as an untouched test set.
The linear model reaches a mean absolute percentage error of about 6 percent, the random forest about 3.8 percent and gradient boosting about 3.1 percent. The team deploys gradient boosting, schedules monthly retraining to handle seasonal drift and keeps the linear model as an interpretable baseline for auditing unusual forecasts.