AI Foundations
Machine learning, deep learning, NLP, computer vision, reinforcement learning and the techniques underneath modern AI.
- lessons
- 34
- steps
- 319
- time
- 427 min
What AI Is: The Foundation Branches
A map of artificial intelligence — machine learning, deep learning, language, vision and reinforcement learning — and the one idea they share: learn the rules instead of writing them.
- Name the main branches of AI and how they relate
- Explain how machine learning turns labeled examples into a model
- Describe why deep networks learn features in layers
- Trace a sentence through NLP and an image through computer vision
Neural Networks: From Perceptron to Deep Q-Network
How one artificial neuron makes a decision, why stacking them into layers is needed, how backpropagation trains them, and two classic shapes built from the same parts.
- Compute a perceptron's output and apply its learning rule
- Explain why a single neuron cannot learn XOR
- Trace forward propagation and backpropagation through a small network
- Describe how an autoencoder compresses data through a bottleneck
Sequence Models: RNN, LSTM, GRU and the Transformer
How networks read data where order matters — a hidden state passed step by step, gates that protect long-term memory, and the attention mechanism that replaced recurrence.
- Explain how an RNN carries a hidden state across time steps
- Explain why plain RNNs forget long-range context (vanishing gradients)
- Describe the three LSTM gates and the GRU's two gates
- Explain why self-attention lets a Transformer train in parallel
Large Language Models: GPT, BERT and ChatGPT
What an LLM is, why GPT predicts the next token while BERT fills in blanks, and how GPT-3, GPT-4 and ChatGPT grew out of that idea.
- What makes a language model “large” and how it is pre-trained
- GPT: decoder-only, left-to-right next-token prediction
- BERT: encoder-only, bidirectional masked-word prediction
- How scale gave GPT-3 few-shot learning and GPT-4 multimodality
Vision Models: CNNs, Classification and Detection
How convolutional networks turn pixels into labels, and how detectors from R-CNN to YOLO find every object in a frame.
- How a convolution kernel slides over pixels to produce a feature map
- Why stacked conv and pooling layers see edges first and objects last
- Classification vs detection: one label vs many boxes
- How R-CNN, Fast R-CNN and Faster R-CNN removed repeated work
Image Generation: GANs and Diffusion
How networks create brand-new images — from the adversarial game of GANs to the step-by-step denoising behind Stable Diffusion and DALL-E.
- Unconditional vs conditional (text-to-image) generation
- How a generator and a discriminator train each other in a GAN
- How diffusion models learn to reverse a noising process
- Why Stable Diffusion works in latent space, and how DALL-E is offered
RAG and Vector Stores
Retrieval-augmented generation gives an LLM fresh, citable facts; vector stores such as Qdrant, Pinecone and Weaviate make the retrieval fast.
- The three moves of RAG: retrieve, augment, generate
- How a vector store finds meaning instead of matching keywords
- How HNSW indexing and metadata filters keep search fast and precise
- What sets Qdrant, Pinecone and Weaviate apart
AI Agents and Their Design Patterns
From one augmented LLM call to workflows, autonomous agents and teams of agents, plus the guardrails that keep them safe.
- What makes an agent different from a chatbot
- The augmented LLM: the building block of every agent
- Two workflow patterns: orchestrator-workers and evaluator-optimizer
- How an autonomous agent directs its own loop, and where guardrails go
Agent Frameworks: ADK, OpenAI Agents and Claude Agent SDK
What an agent framework handles for you, and how Google ADK, the OpenAI Agents SDK and the Claude Agent SDK each package it.
- The plumbing every agent needs, and why frameworks exist
- How Google ADK composes agents from modular pieces
- How ADK evaluates an agent's tool trajectory and deploys it
- What the OpenAI Agents SDK and Claude Agent SDK each emphasise
Model Context Protocol: Clients, Servers and Tools
How MCP gives any AI app a standard way to connect to tools and data: hosts and clients, servers and their primitives, and the tool-call round trip.
- Why a shared protocol turns N×M integrations into N+M
- The roles of host, client and server, and how they connect
- What a server exposes: tools, resources and prompts
- How a tool is discovered and called, and how to use MCP safely
Agents at Work: Support and Coding
How customer-support agents and coding agents work, how SWE-bench measures coding agents, and how inline code completion differs.
- How a support agent combines conversation with real actions
- Why risky support actions hand off to a human
- The coding agent loop and why tests make it work
- How SWE-bench grades a coding agent's patch
Symbolic AI and Expert Systems
Before machine learning, AI meant writing knowledge down as symbols and rules and letting an inference engine reason over them — an approach that still earns its place wherever decisions must be explained.
- How symbolic AI differs from machine learning
- The parts of an expert system: knowledge base, inference engine, working memory
- How an inference engine runs the match → resolve → fire cycle
- Forward chaining vs backward chaining over the same rules
AI Ethics: Bias and Fairness
Where unfairness creeps into an AI system — through the data and through the algorithm — how to measure it with metrics like demographic parity, and how to mitigate it before, during and after training.
- The principles of AI ethics and why they span the whole lifecycle
- How bias enters through the data and through the algorithm
- Competing definitions of fairness, and how to compute demographic parity
- The define → measure → constrain → validate loop of algorithmic fairness
AI Ethics: Transparency, Privacy and Accountability
Make AI decisions explainable, protect the personal data they learn from, and keep a clear record of who is responsible when something goes wrong.
- Black-box vs white-box models, and what transparency asks for
- Intrinsic interpretability vs post-hoc explanations (SHAP, LIME, counterfactuals)
- How differential privacy and federated learning protect personal data
- Who is accountable, and what an audit trail must record
Supervised Learning: Regression & Classification
Learn a mapping from inputs to known answers — numbers (regression) or categories (classification) — and check it on data the model has never seen.
- What makes learning supervised: labeled input → output pairs
- Fit a line (linear regression) and a curve (polynomial regression) by minimising squared error
- Turn a score into a probability with logistic regression and a decision boundary
- Binary vs multi-class classification, and how to read a confusion matrix
Unsupervised Learning: Clustering & Dimensionality Reduction
Find structure in data nobody labeled — group similar points with k-means, hierarchical clustering or DBSCAN, and squeeze many features into a few with PCA and t-SNE.
- What unsupervised learning finds when there are no labels
- How k-means alternates assign and update steps
- When hierarchical clustering or DBSCAN beat k-means
- Compress features with PCA; visualise neighbourhoods with t-SNE
Gradient Descent & Optimizers
Walk downhill on the loss: how gradient descent, SGD, learning-rate choice, schedules, adaptive rates and Adam turn a gradient into better weights.
- The update rule w ← w − η·∇L and why it goes downhill
- What happens when the learning rate is too small or too large
- Why SGD uses mini-batches, and what the noise buys you
- Schedules, adaptive per-parameter rates, and how Adam combines them
Backpropagation & Activation Functions
How a network learns: a forward pass computes the loss, backpropagation sends blame back with the chain rule, and non-linear activations — sigmoid, tanh, ReLU, softmax — make depth worth having.
- Forward pass vs backward pass, and what the chain rule does
- Why stacking layers is pointless without a non-linear activation
- Shapes and trade-offs of sigmoid, tanh and ReLU
- How softmax turns logits into class probabilities
Convolution & Pooling
The two operations inside every CNN: a small learned kernel slid across the image (2D and depthwise convolution), and pooling that shrinks feature maps by keeping the max or the average.
- Why dense layers are a poor fit for images
- Compute a convolution by hand: slide, multiply, sum
- Count Conv2D weights and see why depthwise separable convs are cheaper
- What max and average pooling keep — and what they throw away
Tokens and Embeddings
How text becomes numbers: split it into tokens, then map every token, word or sentence to a vector whose position encodes meaning.
- Why subword tokenization beats word- and character-level splitting
- What an embedding is and why similar meanings land close together
- How Word2Vec, GloVe and FastText learn word vectors differently
- Why sentences need their own encoders (SBERT, USE)
Attention, Self-Attention and Multi-Head Attention
How a model learns where to look: queries score keys, softmax turns scores into weights, and many heads look in different ways at once.
- Why a single fixed context vector was a bottleneck
- Compute attention from queries, keys and values: softmax(QKᵀ/√dₖ)·V
- What self-attention adds and what it costs
- Why transformers run several attention heads in parallel
Prompting and Fine-Tuning
Two ways to make a general LLM do your task: change what you send it (prompting, few-shot, chain of thought) or change its weights (full fine-tuning, LoRA, QLoRA).
- Anatomy of a prompt, and treating prompts as tested artifacts
- Use few-shot examples and chain-of-thought to change behaviour without training
- When to fine-tune, and what full fine-tuning costs in memory
- How LoRA and QLoRA train a tiny fraction of the parameters
Reinforcement Learning: Q-Learning to PPO
How an agent learns from reward alone — by estimating action values (Q-learning), by pushing its policy uphill (policy gradients), or both at once (actor-critic).
- Learn action values with Q-learning and fix its overestimation with Double Q
- Optimize a policy directly with policy gradients and REINFORCE
- Why TRPO and PPO limit how far each update moves the policy
- Combine actor and critic, and scale it with A3C and DDPG
Knowledge Representation: Networks, Frames, Ontologies
How symbolic AI writes knowledge down so a program can inherit, look up and check facts instead of guessing.
- Why a pile of sentences isn't knowledge a program can use
- How semantic networks answer questions by following is-a links
- How frames bundle slots, defaults and overrides
- What makes an ontology formal: classes, properties and axioms
Search Algorithms: BFS, DFS, Heuristics and A*
How a program finds a route through a space of possibilities, and why A* finds the cheapest one without looking everywhere.
- The frontier loop shared by every search algorithm
- How BFS and DFS differ: queue vs stack
- What a heuristic adds, and how greedy search can be misled
- Why A with f g + h returns the cheapest path
Genetic Algorithms: Selection, Crossover, Mutation
Evolve good solutions instead of deriving them: keep a population, favour the fit, recombine and mutate, repeat.
- The evolutionary loop: evaluate, select, recombine, mutate
- How selection turns fitness into reproduction chances
- How crossover combines good building blocks from two parents
- Why mutation is needed to keep diversity
Retrieval: Keyword, Semantic, Hybrid and HyDE
The R in RAG: how to find the right passages — by words, by meaning, by both, or by first imagining the answer.
- Why retrieval quality caps answer quality in RAG
- Where keyword search and semantic search each fail
- Fuse both rankings with hybrid search and RRF
- Use HyDE to search with a hypothetical answer
The Augmented LLM: Retrieval, Tools and Memory
How an LLM gets fresh knowledge, the ability to act and a memory, and the function-calling loop that makes tools work.
- The three augmentations: retrieval, tools, memory
- The tool-use loop: the model asks, your code executes
- What a function definition and a function call look like
- How to wrap real APIs safely for a model
Agent Workflows I: Prompt Chaining and Routing
Anthropic's first two workflow patterns: split a task into checked sequential calls, or classify the input and send it to the right specialist.
- The difference between a workflow and an agent
- How prompt chaining trades latency for accuracy
- Where gates go and what they check
- How routing classifies input and dispatches to specialised handlers
Agent Workflows II: Parallelize, Delegate, Refine
Run independent LLM calls at once, let an orchestrator split work it couldn't plan in advance, and loop a draft through an evaluator until it is good enough.
- Sectioning vs voting: two ways to parallelize
- How an orchestrator decomposes a task it can't plan in advance
- How workers' results are synthesised into one answer
- How evaluator feedback loops refine output, and when to stop
Autonomous Agents: Reason, Plan, Act, Check, Stop
How an autonomous agent reasons and plans, executes tools, learns from the environment's feedback, and stays under human control with clear stopping conditions.
- How reasoning interleaves with actions (ReAct)
- How agents plan, replan, and explore alternatives with Tree of Thoughts
- Why environmental feedback at every step keeps the agent grounded
- Where humans stay in control, and the conditions that stop the loop
Agent Design Principles: Simple, Transparent, Well-Tooled
Anthropic's three rules for agents that work: keep the design simple, show the agent's reasoning, and craft the agent-computer interface as carefully as a UI.
- The three principles and why simplicity comes first
- What transparency means for an agent
- Why tools are the agent's user interface (ACI)
- How to document, format and test tools
Multi-Agent Systems: Communicate, Coordinate, Negotiate
When work is split across agents, they need a shared message format, a way to divide tasks, and a way to settle conflicting goals.
- What an agent-to-agent message contains
- Centralised vs decentralised coordination
- How the contract net protocol allocates tasks by bidding
- How agents negotiate toward an agreement
Privacy-Preserving ML: Federated Learning and Differential Privacy
Train on data that never leaves its owner, and add calibrated noise so no output reveals any one person.
- How a federated round works: send model, train locally, average updates
- Why model updates can still leak, and what secure aggregation adds
- What ε-differential privacy guarantees
- How the Laplace mechanism and DP-SGD add calibrated noise