Skip to content
anythingai.space
Module 01

AI Foundations

Machine learning, deep learning, NLP, computer vision, reinforcement learning and the techniques underneath modern AI.

lessons
34
steps
319
time
427 min
tokenize“I LOVE THIS PRODUCT!” → TOKENS (WITH A 2-D SLICE OF EACH EMBEDDING)I[0.1, 0.4]love[0.9, 0.8]this[0.2, 0.1]product[0.5, 0.3]![0.6, 0.7]Same pipeline, different heads: translate · classify · answer · summarise ·generateReview textEmbeddingstoken → vectorTransformerreads in contextPositivesentiment 0.96
01beginner·12 min·9 steps

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
Start →
INPUT LAYERHIDDEN LAYEROUTPUT LAYERx₁inputx₂inputHidden 1ReLUHidden 2ReLUHidden 3ReLUOutputsigmoid → 0..1random
02beginner·14 min·9 steps

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
Start →
CELL STATE · THE CONVEYOR BELTOld cell statec(t−1)× forgetdrop old info+ writeadd new infoNew cell statec(t)Forget gate0 = erase, 1 = keepInput gatewhat to storeOutput gatewhat to revealx(t) + h(t−1)new word + last stateHidden stateh(t) → output
03intermediate·14 min·9 steps

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
Start →
GPT SEES THE LEFT CONTEXT AND PREDICTS THE NEXT TOKENTheweathertodayissunnypredictedandnext roundCAUSAL ATTENTION (ROW ATTENDS TO COLUMN)TheweatodissunTheweathertodayissunnyOnly the past is visible — thefuture is masked out.
04beginner·12 min·8 steps

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
Start →
WHAT NEURONS RESPOND TO, LAYER BY LAYERedgescornerstexturesfur · whiskersears · eyescat facedeeper layer = bigger receptive fieldPhotoraw pixelsConv + ReLUedges · cornersMax poolhalve width/heightConv + ReLUtextures · partsFC + softmaxclass scores
05beginner·13 min·9 steps

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
Start →
FORWARD PROCESS · ADD NOISE (TRAINING ONLY)REVERSE PROCESS · REMOVE PREDICTED NOISE (GENERATION)+ noise+ noise+ noisestart here− noise− noisethe networklearns the ←directionPhotot = 0Noisyt = 300Mostly noiset = 700Pure noiset = 1000Blobst = 700Rough shapest = 300New imaget = 0
06beginner·12 min·9 steps

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
Start →
OPEN-SOURCE · SELF-HOST OR MANAGEDMANAGED ONLYAlso: Milvus (huge scale) · Chroma (lightweight) · pgvector (inside Postgres)QdrantRust · payload filtersWeaviateobjects · auto-vectorisePineconeserverless · no ops
07beginner·11 min·9 steps

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
Start →
tool callallowedreplyhaltescalateUserInput guardinjection · off-topicAgentAction guardallowlist · spend capToolsOutput guardPII · policy checkStop rulesmax steps · max costHuman approvalrefunds, deletes
08beginner·12 min·9 steps

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
Start →
WORKSPACE · BUILT-IN TOOLSquery()allow / denydelegateYour appClaude agentloop + compactionHooks & permissionsSubagentsown contextFile toolsRead · Edit · WriteBashSearch & webGrep · Glob · fetchMCP serversyour own tools
09beginner·12 min·9 steps

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
Start →
9 custom integrationsChat appIDE assistantSupport agentGit repoDatabaseTicket system
10beginner·10 min·8 steps

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
Start →
more scopemore autonomyfast · you steerslower · agent steersCode completioninline, as you typeIDE chatedits on requestCoding agentsissue → tested change
11beginner·11 min·9 steps

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
Start →
BUILT ONCE · WITH THE EXPERTEVERY CONSULTATIONinterviewswrites rulesrulessymptomsadvice + whyread / writeDomain expertKnowledge engineerKnowledge baserules + factsUserInference engineWorking memoryfacts of this case
12beginner·11 min·9 steps

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
Start →
CHECKS AT EVERY STAGE OF THE LIFECYCLEFairnessTransparencyPrivacyAccountabilityCollect dataTrainDeployMonitor
13beginner·13 min·9 steps

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
Start →
inputwriteONE AUDIT RECORDinputapplicant featuresdecisiondeny · 0.31modelcredit-v3.2time10:14:07Ztriggerweb formoutcomeappealed → approvedLoan appModelcredit-v3.2v3.2Decisiondeny · 0.31Audit logappend-only, immutable
14beginner·13 min·9 steps

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
Start →
CONFUSION MATRIX (SHARE OF EACH ACTUAL CLASS)pred spampred hamactual spam.92.08actual ham.03.9792% of spam caught → recall0.923% of real mail wrongly flagged→ false positives8% of spam slips through →false negatives
15beginner·14 min·10 steps

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
Start →
✂ cut here → 2 clustersABCDEFABDEABCDEFall sixlast merge
16beginner·14 min·10 steps

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
Start →
COMMON DEFAULTSη = 1e-3β₁ = 0.9β₂ = 0.999ε = 1e-8Gradient gfrom backpropm · momentumβ₁ = 0.9v · mean of g²β₂ = 0.999Bias correction÷ (1 − βᵗ)Update wη·m̂ / (√v̂ + ε)
17intermediate·14 min·10 steps

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
Start →
CACHED FOR THE BACKWARD PASSz₁, a₁z₂, a₂z₃, ŷL = 2.3Input xpixels / featuresLayer 1W₁, φLayer 2W₂, φOutput ŷW₃, softmaxLossvs label y
18intermediate·14 min·11 steps

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
Start →
INPUT 6×6 (DARK | BRIGHT)c1c2c3c4c5c6r1.10.10.10.90.90.90r2.10.10.10.90.90.90r3.10.10.10.90.90.90r4.10.10.10.90.90.90r5.10.10.10.90.90.90r6.10.10.10.90.90.90KERNEL 3×3−10+1−10+1−10+1FEATURE MAP 4×4 (÷ 2.4)c1c2c3c4r1.001.001.00.00r2.001.001.00.00r3.001.001.00.00r4.001.001.00.00Window over c2–c4: 3 rows × (0.9 − 0.1)= 2.4 → bright cell
19intermediate·13 min·9 steps

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
Start →
token idsWORD-LEVEL — UNSEEN WORDS BECOME [UNK]unhappinessisrareCHARACTER-LEVEL — NOTHING UNKNOWN, BUT LONGunhappiness…SUBWORD (WORDPIECE) — THE USUAL COMPROMISE[CLS]un##happinessisrare[SEP]Raw text“unhappiness is rare”Tokenizertext → token idsNeural network
20beginner·14 min·11 steps

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)
Start →
HEAD 1 · POSITIONcatsatonmatitcatsatonmatitHEAD 2 · SYNTAXcatsatonmatitcatsatonmatitHEAD 3 · COREFERENCEcatsatonmatitcatsatonmatitSame sentence, three learned attention patterns, computed inparallel
21intermediate·13 min·9 steps

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
Start →
EXAMPLE 1“great screen, fast”→positiveEXAMPLE 2“oh great, broke again”→negativeEXAMPLE 3“it arrived Tuesday”→neutralYOUR INPUT“battery died in a day”→?LLMpre-trainedOutput“negative”
22intermediate·15 min·10 steps

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
Start →
gradientsgradientsGlobal networkshared actor + criticWorker 1own env copyWorker 2own env copyWorker 3own env copyWorker 4own env copy
23intermediate·16 min·11 steps

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
Start →
TBOX · CLASSES AND AXIOMSABOX · FACTS ABOUT INDIVIDUALSsubClassOfdisjointWith:penguin_17rdf:type:Penguin:Penguinrdfs:subClassOf:Bird:penguin_17rdf:type:FishInconsistent: penguin_17would be Bird and FishAnimalBirdFishdisjointReasonerclassify · check
24beginner·11 min·9 steps

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
Start →
234246531QUEUE (FIFO) →CDEEXPANSION ORDERSABCDEGS · start1A2B3C4D5E6G · goal7
25beginner·12 min·9 steps

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
Start →
GENERATION 001101x = 1311000x = 2401000x = 810011x = 19FITNESS F(X) = X²0110116911000576010006410011361
26beginner·11 min·10 steps

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
Start →
QUERYhowtoreset2FADOC A — SHARES “RESET” AND “2FA”Resetyour2FAdeviceDOC B — SAME TOPIC, ZERO SHARED WORDSCan'tsigninafterchangingdevicesBM25 indexterm freq × rarity
27intermediate·12 min·9 steps

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
Start →
MANAGER PATTERNDECENTRALISED HANDOFFScallhandoffManager agentRefundsagent-as-toolShippingagent-as-toolTriage agentBillingTech support
28intermediate·13 min·10 steps

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
Start →
unsure“How do I reset my password?”faq0.97“I was charged twice, refund one.”refund0.93“Your app ate my invoice??”technical?0.51 → humanCustomerClassifierwhich kind of request?Human agentconfidence < 0.7
29intermediate·12 min·10 steps

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
Start →
Code changepull requestSecurity reviewPerformance reviewStyle reviewAggregatorplain code
30intermediate·13 min·10 steps

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
Start →
search_venues3 resultsThoughtNeed venues for ≥ 40 people in Lisbon first.Actionsearch_venues(city="Lisbon", capacity=40)ObservationA: €6.9k · B: €7.4k · C: €9.1kThoughtC is over budget. Check dates for A and B.AgentLLM in a loopEnvironmentsearch · booking APIs
31intermediate·14 min·11 steps

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
Start →
HUMAN-COMPUTER INTERFACEAGENT-COMPUTER INTERFACEPersonUIbuttons · forms · docsSystemAgentTools (ACI)names · docs · formatsSystem
32intermediate·11 min·9 steps

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
Start →
CENTRALISEDDECENTRALISED · BLACKBOARDassignclaimpost resultSupervisorWorker AWorker BBlackboardtasks · status · locksAgent AAgent BAgent C
33intermediate·10 min·8 steps

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
Start →
P[OUTPUT] ON D410.3420.4430.3P[OUTPUT] ON D′410.34420.38430.28Dataset Dincludes youDataset D′same, minus youMechanism Mquery + noise
34intermediate·11 min·9 steps

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
Start →
Next module · 02
How LLMs Work