What is machine learning?
Machine learning (ML) is a branch of artificial intelligence in which computers learn to perform tasks by finding patterns in data, rather than following rules a programmer writes by hand. The more relevant examples a machine learning system studies, the better it becomes at making predictions or decisions about new information.
Take email spam filtering. Writing a rule for every possible spam message would be impossible. Instead, a machine learning system studies thousands of emails labeled "spam" or "not spam," learns which patterns tend to signal spam, and then applies what it learned to new messages as they arrive.
Machine learning is the foundation of most modern AI, including generative AI and large language models. This guide explains how it works, including models, training, inference, and neural networks.
How does machine learning work?
Machine learning works by feeding examples to an algorithm, letting it adjust itself until its predictions match the examples well, and then using the result on new data. Most projects follow the same basic steps:
Collect data. Gather examples relevant to the task, such as photos, text, sensor readings, or sales records. The quality and variety of this data shape everything that follows.
Prepare the data. Clean out errors, fill gaps, and, for many tasks, label the examples with the correct answers.
Choose an approach. Pick a type of model suited to the problem, from simple statistical methods to deep neural networks.
Train the model. The model studies the data and adjusts its internal settings to reduce its mistakes.
Evaluate it. Test the model on examples it has not seen before to check how well it handles new situations.
Deploy and use it. Put the trained model to work making predictions, a stage called inference.
Monitor and update it. Track performance over time and retrain with fresh data when results start to slip.
What is a machine learning model?
A machine learning model is the trained system that takes an input and produces an output, such as a prediction, a label, or a piece of generated content. It is what you end up with after training: a mathematical representation of the patterns found in the data.
It helps to separate three related terms:
Algorithm: The method or recipe used to learn from data, such as a decision tree or a neural network.
Training data: The examples the algorithm learns from.
Model: The result of applying the algorithm to the training data. The model is what gets used in apps and devices.
A model stores what it has learned in internal values called parameters, sometimes called weights. Small models may have thousands of parameters, while the largest language models have billions. Larger models can capture more complex patterns, but they need more memory and computing power to run.
What is training in machine learning?
Training is the process of teaching a machine learning model by showing it examples and adjusting its parameters until its outputs are accurate. It is the learning stage, and it usually happens before the model is released for use.
How training works
The model receives an example and makes a prediction.
The prediction is compared with the correct answer to measure the error.
The model adjusts its parameters slightly to reduce that error.
The process repeats across many examples, often millions, until performance stops improving.
Training large models takes enormous computing power. Big models are typically trained in data centers on many high-end GPUs and AI accelerators running for days or weeks.
Common training problems
Overfitting: The model memorizes the training examples instead of learning general patterns, so it performs poorly on new data.
Underfitting: The model is too simple or undertrained to capture the patterns that matter.
Biased data: If the training data is unbalanced or incomplete, the model's predictions can be unfair or inaccurate for some groups or situations.
Types of machine learning
Machine learning is usually grouped by how the model learns from its data.
Type | How it learns | Example uses |
|---|---|---|
Supervised learning | From labeled examples with known correct answers | Spam filters, image recognition, price prediction |
Unsupervised learning | By finding patterns and groups in unlabeled data | Customer segmentation, anomaly and fraud detection |
Self-supervised learning | By creating its own labels from raw data, such as predicting a hidden word | Pretraining large language models |
Reinforcement learning | Through trial and error, guided by rewards and penalties | Robotics, game playing, tuning AI responses with human feedback |
What is inference in machine learning?
Inference is the stage where a trained model is put to work, using what it learned to make predictions or generate output from new data. Every time you blur your background on a video call, get a song recommendation, or ask a chatbot a question, a model is running inference.
Inference happens far more often than training. A model may be trained once, or updated occasionally, but it can then run inference billions of times for millions of people. That is why making inference fast and power-efficient matters so much.
Inference can run in two places:
In the cloud, where large models run on data-center hardware and send results back over the internet.
On your device, where smaller models run locally. On an AI PC, a neural processing unit (NPU) is designed specifically for efficient on-device inference.
Our on-device AI vs. cloud AI guide compares the two.
Training vs. inference
Training | Inference | |
|---|---|---|
Purpose | Teach the model by adjusting its parameters | Use the trained model to make predictions |
When it happens | Before release, plus occasional updates | Every time someone uses the model |
Data used | Large sets of example data | New input, such as your prompt or photo |
Computing needs | Very high, often many GPUs for days or weeks | Lower per request, but runs constantly |
Where it usually runs | Data centers | Data centers or on your device |
Everyday analogy | Studying for an exam | Answering questions on the exam |
What is a neural network?
A neural network is a type of machine learning model loosely inspired by the way neurons in the brain connect. It is made of layers of simple processing units, called nodes or artificial neurons, that pass information to one another. Neural networks power most of today's advanced AI, from image recognition to chatbots.
How a neural network works
Input layer: Receives the raw data, such as the pixels of an image or the words of a sentence.
Hidden layers: Process the data step by step. Each node weighs its inputs, combines them, and passes a result to the next layer. Early layers detect simple features, such as edges in an image, while later layers combine them into complex ones, such as faces.
Output layer: Produces the final result, such as a label ("cat"), a number, or the next word in a sentence.
The connections between nodes have weights, which are the parameters the network adjusts during training. Learning is the process of tuning millions or billions of these weights until the network produces accurate results.
What is deep learning?
Deep learning is machine learning that uses neural networks with many hidden layers. The "deep" refers to the number of layers. Extra layers let a network learn very complex patterns directly from raw data, without people having to define the important features first.
Deep learning drove the major AI advances of the past decade, including speech recognition, computer vision, and large language models. Because deep networks involve so much matrix math, they run best on hardware built for parallel processing, such as GPUs and NPUs.
Everyday examples of machine learning
You likely use machine learning dozens of times a day, often without noticing. Common examples include:
Recommendations: Streaming services, online stores, and music apps suggest what to watch, buy, or play next.
Spam and fraud detection: Email filters catch junk mail, and banks flag unusual card activity.
Voice and text input: Voice typing, predictive text, and autocorrect learn from how people speak and write.
Photos and cameras: Phones and PCs sharpen images, recognize faces, and sort photos by what they contain.
Navigation: Map apps predict traffic and estimate arrival times.
Video calls: Background blur, auto-framing, and noise suppression on a PC rely on trained models running in real time. Our AI features guide covers these in more detail.
AI assistants: Chatbots and copilots are built on deep learning models trained on large amounts of text. See our AI assistants guide.
Businesses use machine learning to forecast demand, detect equipment problems early, and analyze customer data. Our AI for business guide covers common uses.
Machine learning frequently asked questions
What is the difference between AI and machine learning?
AI is the broad goal of building computers that can perform tasks requiring human-like intelligence. Machine learning is the most common way to achieve that goal: instead of programming every rule, you let the computer learn rules from data. All machine learning is AI, but not all AI uses machine learning.
What is the difference between machine learning and deep learning?
Deep learning is a type of machine learning that uses neural networks with many layers. Traditional machine learning methods often need people to decide which features in the data matter. Deep learning can discover those features on its own, which makes it better suited to complex data like images, audio, and language.
What is the difference between training and inference?
Training is when a model learns from example data by adjusting its parameters. Inference is when the finished model uses what it learned to respond to new input. Training happens mostly in data centers, while inference can run in the cloud or on your device.
How much data does machine learning need?
It depends on the task and the model. A simple model for a narrow task may need only a few thousand examples. Large language models are trained on enormous amounts of text. In general, more varied, high-quality data leads to better results.
Does my computer use machine learning?
Almost certainly. Features such as voice typing, photo enhancement, face sign-in, and video-call effects rely on machine learning models. On an AI PC, many of these models run on the NPU for better efficiency.
Can I train a machine learning model on my own PC?
Yes, for smaller models. Many developers and students train models on laptops and desktops, especially ones with a capable GPU and plenty of memory. Training the largest models still requires data-center hardware.
Is machine learning always accurate?
No. A model is only as good as its training data and design. It can make mistakes on unfamiliar situations, reflect biases in its data, or lose accuracy as the world changes. That is why models are tested, monitored, and updated over time.
Related AI glossary guides
AI glossary: Definitions of key AI terms in one place
Generative AI: How machine learning creates text, images, and code
Large language models: Deep learning models trained on language
Neural processing units (NPUs): The processors built for efficient inference
On-device AI vs. cloud AI: Where inference runs and why it matters
AI for business: How organizations put machine learning to work