Basics of AI & Machine Learning
The core ideas behind artificial intelligence and machine learning, explained without the hype — this is the foundation the rest of the Learn AI section builds on.
What "AI" actually means
Artificial Intelligence is a broad field: getting computers to perform tasks that normally require human intelligence — understanding language, recognizing images, making decisions, solving problems. AI is the goal; Machine Learning (ML) is the dominant technique used to get there today. Instead of a programmer writing explicit rules for every situation, ML systems learn patterns directly from data.
Deep Learning is a subset of ML that uses layered neural networks and is behind almost every major AI breakthrough since the 2010s — image recognition, speech recognition, and large language models (LLMs) like the one powering this chat are all deep learning systems.
AI, ML, and Deep Learning — how they nest
| Layer | What it means |
|---|---|
| Artificial Intelligence (AI) | The broad goal: machines performing tasks that require intelligence. |
| Machine Learning (ML) | A method for achieving AI: learning patterns from data instead of hand-coded rules. |
| Deep Learning | A subset of ML using multi-layer neural networks; powers modern LLMs, image models, and speech systems. |
How machine learning actually works
At a high level, every ML system follows the same loop:
- Collect data — examples of the thing you want the model to learn (emails labeled spam/not-spam, network logs labeled malicious/benign, text and its translations).
- Train — the model looks at examples repeatedly, adjusts its internal parameters to reduce its error, and gradually gets better at the task. This adjustment process is called gradient descent, guided by a loss function that measures how wrong the model currently is.
- Validate — the model is checked against data it hasn't seen before, to make sure it learned general patterns rather than memorizing the training examples (a failure mode called overfitting).
- Infer — once trained, the model is used on new, real-world input. This is called inference, and it's what happens every time you ask an AI system a question.
The main learning paradigms
Not all ML learns the same way. Four paradigms cover most real systems:
- Supervised learning — the model learns from labeled examples (input paired with the correct answer). Used for spam detection, malware classification, fraud detection.
- Unsupervised learning — the model finds structure in unlabeled data on its own, e.g. clustering similar network traffic patterns together without being told what "normal" looks like in advance.
- Reinforcement learning — the model (called an "agent") learns by trial and error, receiving rewards or penalties for its actions. Used in robotics, game-playing systems, and to fine-tune LLM behavior (RLHF — Reinforcement Learning from Human Feedback).
- Self-supervised learning — the model generates its own training signal from raw, unlabeled data, e.g. predicting the next word in a sentence. This is how modern LLMs get most of their initial knowledge, from massive amounts of unlabeled text.
Neural networks, briefly
A neural network is loosely inspired by neurons in the brain: layers of simple mathematical units ("nodes") connected to each other, each with adjustable weights. Data flows through the layers; each layer transforms it slightly, and by the final layer the network produces an output — a classification, a prediction, or the next word in a sequence. Training adjusts millions (sometimes trillions) of these weights so the network's output gets closer to correct over time.
From neural networks to LLMs
Large Language Models are neural networks built on an architecture called the Transformer (introduced in 2017), which uses a mechanism called attention to weigh how relevant every other word in a sentence is to the word currently being processed. This lets the model handle long-range context far better than earlier architectures. LLMs are trained in two broad stages:
- Pre-training — the model reads enormous amounts of text and learns general language patterns, facts, and reasoning by predicting missing or next words.
- Fine-tuning / alignment — the base model is further trained on curated examples and human feedback to make it helpful, follow instructions, and avoid harmful outputs.
Important limitations to keep in mind
- Hallucination — models can generate fluent, confident-sounding text that is factually wrong, because they're predicting plausible text, not looking up verified facts (unless paired with retrieval — see the RAG article).
- Knowledge cutoff — a model only knows what was in its training data up to a certain date, unless it's given external tools or search access.
- Bias — models can reflect biases present in their training data.
- No true understanding — models predict statistically likely outputs; this produces impressively useful behavior, but it isn't the same as human reasoning, and it can fail in surprising ways on edge cases.