All 113 AI engineering lessons
Every lesson in the AI Engineer Roadmap as a readable article: RAG, embeddings, LLM internals, agents, MCP and production AI, from beginner to advanced. Each one links to its interactive, step-by-step animation.
Phase 1: RAG foundations
- What is RAG? Beginner · 8 min
RAG (Retrieval-Augmented Generation) means you first find the relevant pieces of your own documents, then give only those pieces to a language model so it answers from them.
- Embeddings Beginner · 9 min
An embedding is a list of numbers that represents the meaning of a piece of text, so that texts with similar meaning get similar numbers.
- Tokenization Beginner · 8 min
Tokenization is splitting text into small units called tokens (words or word pieces) that a model can turn into numbers.
- Chunking Beginner · 8 min
Chunking is cutting long documents into smaller pieces so each piece can be embedded, searched and shown to the model on its own.
- Recursive Chunking Beginner · 8 min
Recursive chunking splits text on the biggest natural break first (paragraphs), and only falls back to smaller breaks (lines, sentences, words) for pieces that are still too long.
- Semantic Chunking Intermediate · 8 min
Semantic chunking starts a new chunk wherever the meaning of the text shifts, by comparing the embeddings of neighbouring sentences.
- Parent Child Chunking Intermediate · 8 min
Parent-child chunking searches over small "child" chunks for precise matches, then gives the model the larger "parent" chunk each child came from, for full context.
- Sliding Window Chunking Beginner · 6 min
Sliding window chunking makes fixed-size windows of text that move forward by a smaller step, so every border region appears inside at least one full window.
- Metadata Beginner · 6 min
Metadata is extra information stored next to each chunk — like source file, page, date, author or access level — used for citations, filtering and debugging.
- Vector Databases Intermediate · 8 min
A vector database stores embeddings with their text and metadata, and finds the vectors closest to a query vector quickly, even among millions.
- Cosine Similarity Beginner · 7 min
Cosine similarity measures how closely two vectors point in the same direction, from −1 (opposite) through 0 (unrelated) to 1 (same direction), ignoring their length.
- Euclidean Distance Beginner · 6 min
Euclidean distance is the straight-line distance between two points, so smaller means more similar and 0 means identical.
- Dot Product Beginner · 6 min
The dot product multiplies two vectors element by element and adds the results; a bigger number means the vectors are more aligned and/or longer.
- HNSW Advanced · 9 min
HNSW (Hierarchical Navigable Small World) is a graph-based index that finds approximate nearest neighbours by hopping from point to closer point, starting on sparse "express" layers and finishing on a dense bottom layer.
- IVF Index Advanced · 9 min
An IVF (Inverted File) index groups vectors into clusters, then at query time searches only the few clusters closest to the query instead of every vector.
- Hybrid Search Intermediate · 9 min
Hybrid search runs keyword search and embedding search side by side and merges their results, so you catch both exact-term matches and same-meaning matches.
- BM25 Intermediate · 10 min
BM25 is a classic keyword-ranking formula that scores a document higher when it contains the query's words often, when those words are rare across the collection, and when the document is not padded with extra text.
- Sparse Retrieval Intermediate · 8 min
Sparse retrieval represents text as very long vectors that are mostly zeros — one slot per vocabulary word — and finds documents by matching the words they share with the query.
- Dense Retrieval Intermediate · 9 min
Dense retrieval finds documents by comparing short, meaning-based embedding vectors of the query and the documents, so it matches ideas even when the words differ.
- Metadata Filtering Intermediate · 9 min
Metadata filtering restricts a search to chunks whose metadata matches rules — like "team = security" or "year ≥ 2025" — so results are relevant, current and allowed for this user.
Phase 2: Advanced RAG
- Reranking Intermediate · 8 min
Reranking is a second, more careful pass that re-orders the chunks your first search returned, so the best ones end up at the top.
- Cross Encoder Intermediate · 8 min
A cross-encoder is a model that reads the question and a document together and outputs one relevance score for that pair.
- Bi Encoder Intermediate · 8 min
A bi-encoder turns the question and each document into vectors separately, then finds matches by comparing those vectors.
- Context Compression Intermediate · 8 min
Context compression trims retrieved chunks down to only the parts that help answer the question, before they go into the prompt.
- Query Expansion Intermediate · 7 min
Query expansion adds related words or phrasings to the user's question so the search finds documents that use different words for the same thing.
- Multi Query Retrieval Intermediate · 8 min
Multi-query retrieval asks an LLM to rewrite one question into several different search queries, runs them all, and merges the results.
- HyDE Advanced · 8 min
HyDE (Hypothetical Document Embeddings) asks an LLM to write a fake answer to the question, then searches with that fake answer instead of the question.
- Step Back Prompting Advanced · 6 min
Step-back prompting first asks a more general question about the underlying concept, retrieves for that too, and uses both to answer the specific question.
- Self Query Retriever Intermediate · 7 min
A self-query retriever uses an LLM to split a natural-language question into a search phrase plus structured metadata filters, then runs both.
- Multi Vector Retriever Advanced · 7 min
A multi-vector retriever stores several different vectors for each document (summary, questions it answers, small pieces) but returns the full original document when any of them matches.
- Parent Document Retriever Intermediate · 6 min
A parent-document retriever searches over small chunks for accuracy, then returns the larger "parent" section each chunk came from, so the LLM gets full context.
- Ensemble Retrieval Intermediate · 7 min
Ensemble retrieval runs several different retrievers (usually keyword and vector) on the same question and fuses their results into one ranked list.
- Knowledge Graph RAG Advanced · 8 min
Knowledge-graph RAG stores facts as connected entities and relations, and retrieves by following those connections instead of (or as well as) matching similar text.
- GraphRAG Advanced · 9 min
GraphRAG builds an entity graph from your documents, groups it into communities, pre-writes a summary for each community, and uses those summaries to answer broad "what are the main themes?" questions.
- Multi Modal RAG Advanced · 8 min
Multi-modal RAG retrieves not just text but also images, tables, charts, audio or video, and gives them to a model that can understand them.
- SQL RAG Advanced · 9 min
SQL RAG (also called text-to-SQL) lets an LLM turn a question into a SQL query, runs it on your database, and uses the result rows as context for the answer.
- API RAG Advanced · 8 min
API RAG fetches live data from an API at question time (weather, order status, stock levels) and gives the response to the LLM as context.
- Incremental Indexing Intermediate · 8 min
Incremental indexing updates your RAG index by re-embedding only the chunks that are new or changed, and deleting chunks that disappeared, instead of rebuilding everything.
- Streaming Retrieval Advanced · 8 min
Streaming retrieval means sending results and answer tokens to the user as soon as each piece is ready, and keeping the index updated continuously as new data arrives, instead of waiting for everything to finish.
- RAG Evaluation (RAGAS / DeepEval) Advanced · 11 min
RAG evaluation measures, with numbers, whether your system retrieves the right context and writes answers that are correct, grounded in that context, and on-topic.
- LLM-as-a-Judge Advanced · 10 min
LLM-as-a-judge uses a language model to grade answers when there is no exact match to check, and it only works if you design a rubric, fight the judge's known biases, and measure how often it agrees with people.
Phase 3: LLM concepts
- Transformer Architecture Beginner · 9 min
A transformer is a neural network that reads a whole sequence of tokens at once and lets every token look at every other token (attention) to decide what it means.
- Self Attention Intermediate · 10 min
Self-attention lets each token build its new meaning as a weighted average of all the tokens in the same sentence, with weights based on how relevant each one is.
- Multi Head Attention Intermediate · 9 min
Multi-head attention runs several smaller attention operations side by side, so different heads can track different kinds of relationships at once.
- Positional Encoding Intermediate · 8 min
Positional encoding adds information about each token's position, so the model can tell "dog bites man" from "man bites dog".
- Decoder Only Models Intermediate · 8 min
A decoder-only model is a transformer that reads text left to right and is trained to predict the next token; this is the design behind GPT, Claude, Llama, and most chat LLMs.
- Encoder Decoder Models Intermediate · 8 min
An encoder-decoder model first reads the whole input with an encoder, then writes the output with a decoder that looks back at the encoded input through cross-attention.
- KV Cache Advanced · 9 min
The KV cache stores the key and value vectors of tokens already processed, so each new token only computes its own instead of recomputing the whole prefix.
- Context Window Beginner · 7 min
The context window is the maximum number of tokens a model can handle in one request, counting your input and its output together.
- Temperature Beginner · 7 min
Temperature is a number that controls how random the model's word choice is: low values make it pick the most likely token, high values spread the choice out.
- Top-k Beginner · 6 min
Top-k sampling keeps only the k most likely next tokens, throws the rest away, and samples from what is left.
- Top-p Intermediate · 7 min
Top-p (nucleus) sampling keeps the smallest group of most-likely tokens whose probabilities add up to at least p, then samples only from that group.
- Beam Search Intermediate · 8 min
Beam search keeps the few best partial sentences at each step instead of only the single best token, so it can find a more likely full sentence than greedy decoding.
- Hallucination Intermediate · 8 min
A hallucination is when a model produces fluent, confident text that is false or not supported by its sources.
- Prompt Engineering Beginner · 9 min
Prompt engineering is writing and testing the instructions, examples, and context you give a model so it reliably produces the output you need.
- Fine-Tuning (the overview) Intermediate · 9 min
Fine-tuning means training an existing model a little more on your own examples, so it picks up a style or a narrow skill, and it is usually the last thing to try after prompting and RAG.
- Calling an LLM API Beginner · 8 min
Calling an LLM API means sending a list of role-tagged messages over HTTPS and getting back text plus a count of the tokens you used, and a production call also needs a timeout, retries and a cost check.
- Structured Outputs Intermediate · 7 min
Structured outputs make an LLM return data your code can parse, such as JSON that matches a schema, and you still validate every reply, because even a well-formed answer can be wrong.
- Quantization (shrinking a model) Intermediate · 8 min
Quantization stores a model's weights as small integers (8-bit or 4-bit) instead of 16-bit decimals, so the model needs far less memory and often runs faster, at the cost of a small rounding error.
- LoRA and PEFT (cheap fine-tuning) Advanced · 9 min
LoRA freezes the big model and trains two tiny matrices whose product is added to each chosen weight matrix, so you train well under 1% of the parameters and still change the model's behaviour.
- Inference Serving and Batching Advanced · 10 min
Serving an LLM is a scheduling problem: a GPU is only efficient when it works on many requests at once, and good servers keep it busy by swapping finished requests out and new ones in at every step.
- How an LLM Works End to End Beginner · 10 min
An LLM turns text into numbers, runs those numbers through a stack of identical blocks, scores every word in its vocabulary as the possible next token, picks one, and repeats, one token at a time.
- Q, K and V Explained From Scratch Intermediate · 12 min
Each token's vector is multiplied by three different learned matrices to make a Query (what I am looking for), a Key (how I advertise myself) and a Value (what I hand over), and attention is a Query-versus-Key match that decides how much of each Value to blend.
- Inside a Transformer Block: Residuals, LayerNorm and the Feed-Forward Network Intermediate · 11 min
A transformer block is attention plus three supporting parts: residual connections that carry the signal past each step, a normalisation layer that keeps numbers in a healthy range, and a feed-forward network that processes each token on its own.
- How LLMs Are Trained: Loss, Backprop, Pretraining, SFT and RLHF Intermediate · 12 min
An LLM first learns language by guessing the next token over a huge pile of text (pretraining), then learns to follow instructions from example answers (SFT), then learns what people prefer from ranked answers (RLHF or DPO).
- Modern Attention: MQA, GQA, FlashAttention, Sliding Window and RoPE Advanced · 12 min
Modern LLMs keep the attention idea from self-attention but change how it is stored and computed (shared K/V heads, tiled exact math, local windows, rotary positions) so long contexts and many users fit on a GPU.
- Mixture of Experts and Scaling Laws Advanced · 11 min
A Mixture of Experts (MoE) model has many specialist feed-forward blocks but runs only a few per token, and scaling laws tell us how much model size, data and compute we need for a given quality.
Phase 4: Agentic AI
- What is an AI Agent? Beginner · 7 min
An AI agent is an LLM running in a loop that decides which actions (tool calls) to take, sees the results, and keeps going until the goal is done.
- Tool Calling Beginner · 8 min
Tool calling is how an LLM asks your program to run a function for it, by outputting the tool's name and arguments in a structured format.
- Function Calling Beginner · 8 min
Function calling is the OpenAI-style name for tool calling: the model returns a function name plus JSON arguments, and your code maps that to a real function and runs it.
- ReAct Pattern Intermediate · 9 min
ReAct (Reason + Act) is an agent pattern where the model alternates between writing a short thought, taking an action with a tool, and reading the observation, until it can answer.
- Planning Agents Intermediate · 8 min
A planning agent first writes a list of steps for the whole task, then executes them one by one, re-planning if something goes wrong.
- Reflection Intermediate · 8 min
Reflection is when an agent reviews its own output (or gets feedback from a critic), writes down what went wrong, and tries again using that feedback.
- Memory Beginner · 8 min
Agent memory is everything your code stores and feeds back to the model so it can use past information, because the model itself forgets everything between calls.
- Short-term Memory Beginner · 6 min
Short-term memory is the recent conversation (and tool results) that you re-send to the model on every turn, usually trimmed to a window so it fits the context.
- Long-term Memory Intermediate · 7 min
Long-term memory is information an agent saves outside the model (in a database or file) so it can search and reuse it in future sessions.
- Semantic Memory Intermediate · 6 min
Semantic memory stores stable facts (about the user, the world, or the domain) that stay true across conversations, such as "Asha's timezone is IST".
- Episodic Memory Intermediate · 7 min
Episodic memory is a log of the agent's past experiences (what task it tried, what it did, and how it turned out) that it can recall to do better next time.
- Agent Loops Intermediate · 8 min
The agent loop is the code that repeatedly calls the model, runs the tools it asks for, feeds back the results, and decides when to stop.
- Multi-Agent Systems Advanced · 9 min
A multi-agent system splits a job across several LLM "agents", each with its own role, prompt, and tools, that pass work between them.
- Human in the Loop Intermediate · 7 min
Human in the loop (HITL) means the agent pauses at chosen points so a person can approve, edit, or reject what it is about to do.
- Agent Evaluation Advanced · 9 min
Agent evaluation is measuring, with a fixed set of test tasks, whether an agent reaches the right outcome, takes sensible steps, and stays within cost, time, and safety limits.
- Agent Guardrails Advanced · 9 min
Guardrails are checks in your code that limit what an agent can see and do (allowed tools, valid arguments, step and cost limits, input and output filters), no matter what the model decides.
Phase 5: Frameworks
- LangChain Beginner · 11 min
LangChain is a Python library of building blocks (prompts, models, parsers, retrievers, tools) that you join together with a pipe operator.
- LangGraph Intermediate · 12 min
LangGraph lets you describe an agent or workflow as a graph of steps (nodes) joined by edges, with shared state passed along.
- LlamaIndex Beginner · 10 min
LlamaIndex is a library focused on connecting your own documents to an LLM: load, split, index, retrieve and answer.
- OpenAI Agents SDK Intermediate · 11 min
The OpenAI Agents SDK is a small Python library with three main ideas: an Agent (model plus instructions plus tools), a Runner that runs the agent loop, and handoffs between agents.
- CrewAI Intermediate · 10 min
CrewAI organizes several LLM agents as a "crew" where each agent has a role and goal and works through assigned tasks.
- AutoGen Advanced · 10 min
AutoGen is Microsoft's framework for multi-agent systems where agents talk to each other by sending messages.
- DSPy Advanced · 11 min
DSPy lets you declare what an LLM step should do (inputs and outputs) as code, then uses an optimizer to find good prompts instead of you hand-writing them.
- Haystack Intermediate · 10 min
Haystack, from deepset, builds search and RAG systems as pipelines of components whose inputs and outputs are connected explicitly.
Phase 6: MCP
- Model Context Protocol Beginner · 11 min
The Model Context Protocol (MCP) is an open standard that lets any AI app talk to any tool or data source through one shared message format.
- MCP Server Beginner · 11 min
An MCP server is a program that exposes tools, resources and prompts to MCP clients over a transport such as stdio.
- MCP Client Intermediate · 11 min
An MCP client is the part of an AI app that connects to one MCP server, negotiates capabilities and sends its requests.
- MCP Tools Intermediate · 12 min
Tools are actions a server exposes, each with a name, a description and a JSON Schema for its input, and the model decides when to call them.
- MCP Resources Intermediate · 9 min
Resources are read-only data a server exposes, each identified by a URI, which the host application chooses to load into context.
- MCP Prompts Intermediate · 8 min
Prompts are reusable message templates a server offers, which the user picks explicitly, much like slash commands.
- Build a Custom MCP Server Advanced · 14 min
Build a small notes server step by step: design narrow tools, validate input, expose notes as resources, add a prompt, test it and connect it to a host safely.
Phase 7: Production AI
- FastAPI for AI Beginner · 10 min
FastAPI is a Python web framework that turns your AI function into an HTTP API with automatic input validation and docs.
- Docker Beginner · 9 min
Docker packs your app and everything it needs into an image that runs the same way on any machine.
- Kubernetes Intermediate · 11 min
Kubernetes runs many containers across many machines and keeps them healthy, scaled and reachable.
- Redis Intermediate · 10 min
Redis is a very fast in-memory data store, used in AI apps for caching answers, rate limiting (capping how many requests a user can make) and sharing state.
- Celery Intermediate · 9 min
Celery runs slow jobs (like document ingestion) in background workers so your API can answer fast.
- RabbitMQ Intermediate · 9 min
RabbitMQ is a message broker: producers send messages to it, and it routes them safely to the queues that consumers read from.
- Monitoring Intermediate · 9 min
Monitoring means watching numbers about your running service and alerting a human when they go wrong.
- LangSmith Intermediate · 8 min
LangSmith is a hosted tool from the LangChain team that records every step of an LLM app run so you can debug, evaluate and monitor it.
- MLflow Intermediate · 8 min
MLflow is an open-source tool that records your experiments (settings, scores, files) so you can compare runs and reproduce the best one.
- Prompt Versioning Intermediate · 9 min
Prompt versioning means treating prompts like code: each change gets a version, can be compared, rolled out slowly and rolled back.
- AI Security Intermediate · 12 min
AI security means assuming that anything a model reads or writes can be hostile or wrong, and limiting the damage it can do.
- Guardrails Intermediate · 10 min
Guardrails are checks before and after the model call that block, clean or reject unsafe input and badly formed output.
- Observability Intermediate · 11 min
Observability means recording enough about each request (steps, time, tokens, cost, errors) that you can explain why the system behaved as it did.
- Cost Optimization Intermediate · 11 min
Cost optimization means sending fewer tokens, to cheaper models, fewer times, without dropping below your quality bar.
- Deploy a Production AI Application Advanced · 13 min
Deploying a production AI app means packaging an API, its cache, queue, data stores and monitoring so they run reliably, are safe, and can be updated without breaking users.