seegongsik
Saved words
seegongsik
AI · how machines learn

What does it really mean for a machine to "learn"

Instead of writing the rules, we let the machine find them from examples. From statistics and regression to neurons, neural nets, and backprop, then embeddings, attention, LLMs, and generation, let's follow it step by step.

18 / 18
01What does it mean to learn?
An ordinary program runs on rules a person wrote out one by one. But the world has so many rules that writing them all is hard. Machine learning flips the road. Show it heaps of examples with the answers attached, and the machine finds the common pattern, the rule, in those examples by itself. At first it gets things wrong, but with more examples it fixes where it was wrong bit by bit and gets better. With that polished pattern, it can even predict a brand new input it has never seen. In short, instead of a person writing the rules, the machine finds them from examples, fixes mistakes, and predicts new things. That is what learning means.
02Seeing the world in numbers: the eye of statistics
Statistics is the eye that summarizes lots of data into a few numbers. The first is the average. Add everything and divide by the count to get the middle value, which tells roughly where the data sits. The second is spread. It says how far the points scatter from the middle. These two are a pair. Even with the same average, a different spread means utterly different data. A tight cluster and a wide scatter can share the same middle yet have different character. There is a caution too. One faraway point, an outlier, easily drags the average along. So do not trust the middle value alone; look at the spread and the stray point as well. In short, statistics is seeing data at a glance through two numbers, the middle and the scatter.
03Probability: handling uncertainty
Probability puts how likely something is on a number between zero and one. Zero means it almost never happens, one means it is almost sure, and one half is fifty-fifty. With a die or a coin, if you try many times, the share of each outcome creeps closer to the true probability. A try or two wobbles, but more tries settle it down. The chance of two things happening together is gauged by multiplying each one's chance, since both must be likely for the pair to be likely. And when things are not certain, we pick the most likely side. AI does the same. It does not declare it knows the answer; it scores several candidates with probabilities and picks the most likely one. In short, probability handles uncertainty as numbers so we can pick the most likely side.
04Drawing a line through points: regression
Regression draws one best-fitting straight line through scattered points. Because that line is y=ax+b, you can predict the result for a new input. Only two things set the line. The slope a decides how much the result rises when the input goes up by one, and the y-intercept b decides where the line sits up or down. The best-fitting line is the one with the smallest total mismatch, the sum of distances from the points to the line. You lower the mismatch by eye and close in on that line. These two numbers, slope a and intercept b, carry straight over later into a neuron's weight and bias.
05Classification: telling which group it is
Classification is about telling which group something belongs to. Where regression guesses a single value, classification answers which of the groups it is. The method is simple. Draw one boundary line between the two groups to split them into two sides. When a new point comes, just see which side of the boundary it lands on and its group is decided. No measuring needed, one position settles it. If there are three or more groups, draw more boundaries to split into more regions. In short, draw a boundary between the points and sort a new point by which side of the boundary it is on, that is classification.
06Loss: measuring how wrong the model is
Loss is a single number that measures how wrong the model is. For each point there is a gap between the prediction and the true answer, that is a vertical distance. Add up all these distances and how wrong the whole thing is gathers into one number. That is the loss. A big loss means the line strays far from the points, a small one means it fits well. So building a good model is the same as making the loss small. Move the line this way and that, and pick the direction where the loss number drops. Shrinking the loss like this is exactly what training is. Next we look at how to find which direction to shrink the loss in.
07Fixing little by little: gradient descent
Gradient descent is a way to lower the loss by feeling the slope and fixing the value one step at a time toward the lower side. The loss curve is shaped like a valley lowest in the middle, and from where we stand now we read the slope under our feet and nudge the value toward the downhill side. The size of that one step is the stride, that is, the learning rate. If the stride is too big it overshoots the bottom and bounces to the far side; if too small it goes down but slowly. Repeat steps with a sensible stride and you near the valley floor, the point of smallest loss. In short, feel the slope and step down little by little, and choose the stride well; that is gradient descent.
08A single cell that mimics the brain, the neuron
An artificial neuron multiplies each input by a weight and adds them all. This shape is the same ax+b we saw in regression. The slope a there is the weight here. A big weight listens to that input strongly, a small one only faintly. If the sum passes a threshold the neuron turns on (1), if not it stays off (0). At first the weights are rough, so it often gets it wrong. Then, like gradient descent, it fixes the weights a little by how wrong it was. Choosing whether to raise or lower and stepping once at a time, the neuron gets better and better. In short, multiply inputs by weights and add, fire by a threshold, and adjust when wrong, that is how a neuron learns.
09Stacking neurons: the neural network
A neural network is many simple neurons stacked and connected in layers. Each layer takes the previous layer's output as input and catches a bigger feature. The front layer sees small pieces, and a later layer gathers those pieces into a bigger shape. One thing is essential. Between layers there must be a nonlinear step that bends the signal. Without a bending step, just repeating addition, no matter how many layers you stack they collapse into a single straight line, the same as one layer. The bending step is what makes stacking worthwhile, so the network can learn complex boundaries like curves. In short, stack neurons in layers and put a bending step between them, and the network learns complex patterns. That is a neural network.
10Tracing the error backward: backpropagation
Backpropagation is how a neural network fixes itself when it is wrong, by tracing the error backward. First it flows signals forward to make a prediction, then compares it with the right answer and measures how wrong it is as a loss. Now comes the heart of it. It sends that loss backward, from output toward input, and computes each weight's share of how much it contributed to the error. It is like following the dominoes in reverse. Finally it nudges each weight by gradient descent in proportion to its share. Weights with a big share change a lot, those with a small share change a little. Repeat this predict forward, trace backward, adjust loop countless times, and the network's predictions creep closer to the right answer. In short, backpropagation traces the error backward to assign blame, and fixes each weight by that much.
11Memorizing vs truly understanding: overfitting
Overfitting is when a model memorizes the training data and so grows weak on new data. A wiggly curve that passes through every point scores 100 on training, but when a new point arrives it misses wildly. True understanding is catching the general pattern that runs through the whole, not each single point. So we split the data into three. We learn from the training data, do a midway check with the validation data, and keep the test data hidden until the very end, looked at just once. Doing well on data it never saw is what real skill means. A model too simple cannot catch the pattern (underfitting), and one too complex just memorizes (overfitting). The just-right amount in between generalizes best. In short, make it catch patterns rather than memorize, and measure skill on data it has not seen.
12Good ingredients make good AI: data
An AI's ability rests on its data as much as its model, maybe more. First, garbage in, garbage out. Learn from mislabeled or one-sided data, and the machine faithfully learns those flaws too. Second, give it clean, balanced ingredients and the same machine learns properly. Third, you must pick features that fit the problem. To guess house prices, area or location helps, but the color of the door does not. Irrelevant features only get in the way. Fourth, good data is better in larger amounts. With more examples, the machine is swayed less by chance flukes and catches the real pattern. In short, clean, unbiased data, described by features that fit the problem, given in plenty, is the foundation of good AI.
13Eyes for images: the CNN
A CNN is a neural network that looks at images. First, a photo is really a grid packed with brightness numbers. Bright means a big number, dark a small one. A CNN places a small filter, a little pane like a magnifier, onto one window of the image and scores whether the feature it seeks is there. Sliding the same filter across the grid one step at a time builds a feature map that finds that feature wherever it sits in the picture. A shift in position does not bother it, since the same filter does the finding. And by stacking many such layers, the front layer catches small edges, the layer above gathers edges into an eye or a nose, and a higher layer gathers those into a whole face. The higher you climb, the more abstract the features it catches. In short, see a photo as a grid of numbers, scan it with small filters to find features, and stack those layers to raise abstraction. That is a CNN.
14Words into numbers: embeddings
Embedding turns words into meaning coordinates. A coordinate is just a bunch of numbers, so a computer can handle it. The key promise is to place words with similar meanings close together. So king and queen, dog and cat gather near each other, while unrelated words sit far apart. Because they are coordinates, you can add and subtract them, and oddly that math carries meaning. Take king, subtract man, add woman, and you land near queen. And this trick is not just for words. Images, sounds, even users can be turned into coordinates the same way, so keeping similar things close lets a computer measure similarity as distance. In short, turning words into coordinates and gathering similar meanings nearby is embedding, and it is the computer's first step toward handling meaning.
15Focusing on what matters: attention
Attention is the knack of focusing more on the words that matter to the word you are on, inside a sentence. Instead of looking at every word equally, it gives a larger weight to more relevant words. Gather all these weights and you share them out so they sum to one. So even the same word shifts its reading when its surroundings change. Put 'eat' next to 'Apple' and the meaning coordinate slides toward fruit; put 'stock' and it slides toward the company. This is exactly why context decides the sense of an ambiguous word. In short, focus more on what matters, split that focus as weights, and let context decide meaning. That is attention.
16The machine that guesses the next word: LLM
An LLM is a machine that looks at the prior context and guesses the next word by probability. For each candidate word that might come next, it scores how plausible it is as a probability, then picks a high one. It attaches the chosen word to the end of the sentence, and with the longer sentence it guesses the next word again. Repeating this one word at a time, it builds a long text. When the earlier words change, the next-word probabilities change too, and this ability to choose which prior context to look at is exactly the attention you learned before. And because it was trained on huge amounts of text to do this one thing well, abilities no one asked for tagged along. It summarizes, translates, and codes. Such abilities that appear on their own are called emergent. But remember. An LLM does not know the truth; it only picks the most plausible next word. So it can be confidently wrong. Its limits are covered in the next lesson.
17Making something new: generative AI
Generative AI is an AI that makes something new from the patterns it learned. It does not copy something memorized; it builds new combinations from patterns it picked up across countless examples. And it is not only text it can make. It can make images, music, and video too. So generative AI is a broader word than an LLM that writes text. To make an image it often starts from grainy noise. As it gently cleans up those fuzzy dots step by step, the shape of a picture slowly emerges. And a person gives directions. Writing down what to make in words is called a prompt. Even with the same AI, changing the prompt changes the direction of the result. In short, generative AI makes new things from learned patterns, makes not only text but also images and music, builds a picture by cleaning up from noise, and takes its direction from a prompt.
18Smart AI, responsible AI
AI is powerful but not perfect. First, since AI learns from data, if the data leans one way the AI's decisions lean too. That is bias. Second, since AI strings together plausible words by probability, it can confidently make up things it does not know as if they were true. That is hallucination, which is why we must always check fresh facts and sources. Third, the same technology can be used for good or for harm. It is not the tool itself but the way it is used that decides good or bad. So we need responsible AI. People should check the results, be transparent about how it was built, and watch whether it is fair to everyone. In short, knowing the limits of bias, hallucination, and misuse, and using it with a human checking, that is responsible AI.
Was this helpful? Support seegongsik