AI Foundations / How AI Learns
Learning patterns from examples.
Reviewed by Yuvaraj
Traditional software follows rules a person wrote: if this, then that. Machine learning flips that around. Instead of writing the rules, you show the program examples, and it finds the rules itself.
Almost all machine learning is the same loop, repeated:
Answer from memory before revealing, retrieval practice is what builds durable recall.
In supervised learning, the model learns from:
Training adjusts a model's parameters to reduce a loss (error) signal.
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
Do this long enough, with enough good examples, and the model's guesses get good. That is it. Everything else, neural networks, transformers, LLMs, is an elaboration of this loop.
For a curious beginner
Imagine learning to throw darts blindfolded, with a friend saying "a bit left, a bit high" after each throw. You do not need to know physics, you just adjust based on the feedback. Each throw is an example; the friend's correction is the error; your adjustment is learning.
How it is actually used
You have data as (input, label) pairs. You pick a model with adjustable parameters, a loss function that scores how wrong a prediction is, and an optimizer that changes the parameters to reduce the loss. You loop over the data in batches, computing the loss and updating the parameters each step, until the loss stops improving on held-out data.
The underlying mechanism
Training minimizes a loss over parameters . Gradient descent updates them in the direction that most reduces the loss:
where is the learning rate. The gradient says which way is "uphill" in error; we step the opposite way. Repeat until .
Abstractions hide how simple one update is. Take the smallest possible model, predict from with one weight : . Use squared error as the loss.
Say the true relationship is , and the model currently has . Show it the example (so the correct ):
moved from 1.5 toward the true 2.0. Repeat over many examples and it converges. That arithmetic, guess, measure, nudge, is the whole of learning, scaled up to billions of parameters.
The goal is not to nail the training examples, it is to do well on new inputs the model has never seen. That ability is called generalization, and it is the whole point.
The real target
A model that scores perfectly on its training data but fails on new data has memorized, not learned. We will return to this failure, called overfitting, when we talk about data and evaluation.
The same loop that makes learning work also explains its most common failures. Watch for these:
Three ways the loop misleads you
Learning rate too high, the update overshoots the target every step and the loss bounces or explodes instead of settling. Too low, it crawls, and training never finishes in reasonable time. Loss still falls but test accuracy drops, the model has started memorizing the training set. A shrinking training loss alone never proves learning; always check held-out data.