Index Ai Academy
The course

AI engineering from first principles

244 lessons in twelve phases. Every lesson runs real Python in your browser, ends with a quiz, and feeds a spaced-repetition review deck. 35 lessons are free, no account needed, and a free account opens the rest.

Start the first lesson Create a free account What you'll build

New here? The AI engineer roadmap shows what to learn, in order, and what you can skip. Prefer Jupyter? The free lessons are also notebooks on GitHub.

Or take one subject at a time

22 lessons · about 11 hours

Free Python for AI course

Learn Python from your first line of code to your first call to a language model, with nothing to install.

14 lessons · about 8 hours

Free prompt engineering course

Learn to write prompts that work reliably, then test them like an engineer: clear instructions, examples, structured output, chains, evals and defenses against prompt injection.

13 lessons · about 7 hours

Free RAG course

Build retrieval-augmented generation step by step: embeddings, chunking, vector search, grounded answers with sources, and the measurements that tell you whether it works.

25 lessons · about 17 hours

Free AI agents course

Learn how to build AI agents by building one: tools, the agent loop, MCP, permissions, context management and evals, ending with a coding agent that stops when its tests pass.

20 lessons · about 13 hours

Build an LLM from scratch: a free course

Go from counting letter pairs to a small GPT you train yourself: tokenizers, attention, transformer blocks and the GPT architecture, written line by line.

The whole course, phase by phase

Phase 0 · about 12 hours of study

Tools

Python, the terminal and calling APIs. 24 lessons, all free to try. About this phase

24 lessons
  1. Your first program FreeRun Python, print output, and read an error message without panicking.
  2. Variables FreeGive values names so your program can remember and reuse them.
  3. Numbers and arithmetic FreeIntegers, decimals, rounding, and the math behind every metric.
  4. Strings and f-strings FreeWork with text: join it, slice it, clean it, and format it.
  5. Decisions with if/else FreeCompare values and choose what happens next.
  6. Lists FreeKeep many values in order, then index, slice and change them.
  7. Loops FreeRepeat work over every item without copy-pasting code.
  8. Dictionaries FreeLook values up by name: the shape of almost all real-world data.
  9. Functions FreePackage steps into reusable, testable pieces with inputs and outputs.
  10. Comprehensions FreeFilter and transform a whole collection in one readable line.
  11. Errors and exceptions FreeRead tracebacks, and handle the failures you expect.
  12. Modules and imports FreeUse Python's standard library instead of reinventing it.
  13. Classes and objects FreeBundle data with the functions that work on it.
  14. JSON FreeThe text format APIs and LLMs use to exchange structured data.
  15. Files and CSV data FreeRead and write files, and turn a spreadsheet export into Python data.
  16. NumPy arrays FreeDo math on whole columns at once, the foundation of every ML library.
  17. The terminal FreeNavigate folders and run programs by typing commands.
  18. Version control with git FreeSave snapshots of your work, undo mistakes, and share code.
  19. Packages and environments FreeInstall libraries with pip and keep projects isolated with venv.
  20. How APIs work FreeRequests, responses, methods, status codes and headers.
  21. Calling APIs from Python FreeSend requests, read JSON responses, and handle failures.
  22. API keys and secrets FreeAuthenticate safely and keep keys out of your code.
  23. Your first LLM call FreeSend messages to a model and read its reply, tokens and stop reason.
  24. Capstone: ad-copy reviewer FreeCombine files, functions, JSON and an LLM call into one small tool.
Phase 1 · about 17 hours of study

Building with LLMs

Prompting, retrieval, tools, agents and evals. 31 lessons, 1 free to try. About this phase

31 lessons
  1. What an LLM actually does FreeNext-token prediction, and why that produces useful behavior.
  2. Tokens and the context windowHow text becomes tokens, and what fits in one request.
  3. Prompt fundamentalsClear instructions, context and constraints: the 80% of prompting.
  4. System prompts and rolesSet behavior once, separately from the conversation.
  5. Examples in promptsShow the model what good looks like (few-shot prompting).
  6. Structured outputGet reliable JSON back that your code can use.
  7. Prompt chainingBreak big tasks into a pipeline of smaller model calls.
  8. Choosing a modelTrade capability, speed and cost across model families.
  9. Reasoning models and effortWhen models think before answering, and how to control it.
  10. Streaming responsesShow output as it's generated instead of waiting.
  11. Conversations and memoryAPIs are stateless: how chat history and memory really work.
  12. Images and documentsSend screenshots, PDFs and charts as input.
  13. EmbeddingsMeaning as a list of numbers, so text can be compared.
  14. Similarity searchFind the most relevant text by comparing embeddings.
  15. Chunking documentsSplit long documents so the right piece can be retrieved.
  16. Vector databasesStore and search millions of embeddings quickly.
  17. Retrieval-augmented generationAnswer from your own documents instead of the model's memory.
  18. Making RAG goodHybrid search, reranking and citations.
  19. Hallucinations and groundingWhy models make things up, and how to design against it.
  20. Tool useLet the model call your functions (function calling).
  21. The agent loopModel → tool → result → model, until the task is done.
  22. Model Context ProtocolA standard way to plug tools and data into any AI app.
  23. Agent design patternsRouting, orchestrator-workers and when not to build an agent.
  24. LLMs in automationsPut models inside scripts and workflow tools that run on their own.
  25. Prompt injection and securityHow untrusted text hijacks models, and how to limit the damage.
  26. EvalsMeasure output quality with test sets instead of vibes.
  27. LLM-as-judgeGrade open-ended output with rubrics and a second model.
  28. Cost and latencyPrompt caching, batching and routing to cheaper models.
  29. Logging and monitoringSee what your LLM app actually did in production.
  30. Shipping an LLM appDeploy, secure keys, rate-limit and handle failures.
  31. Capstone: research agentA marketing research agent with retrieval, tools and evals.
Phase 2 · about 15 hours of study

Math, when you need it

The linear algebra, calculus and probability models run on. 29 lessons, 1 free to try. About this phase

29 lessons
  1. Vectors FreeA list of numbers as a point or an arrow in space.
  2. Vector arithmetic and lengthAdd, scale and measure vectors.
  3. Dot product and cosine similarityThe one operation behind similarity search and attention.
  4. MatricesTables of numbers that hold datasets and model weights.
  5. Matrix multiplicationMany dot products at once: what a neural network layer computes.
  6. Matrices as transformationsA matrix stretches, rotates and projects space.
  7. Transpose, identity and inverseThe matrix operations you'll see in every formula.
  8. TensorsArrays with more axes: batches, sequences, heads.
  9. Eigenvectors (intuition)The directions a transformation leaves pointing the same way.
  10. SVD and PCACompress data to its most important directions.
  11. Functions and graphsRead a graph and see how an output depends on an input.
  12. Exponentials and logarithmsGrowth, decay, and why logs turn products into sums.
  13. DerivativesThe slope at a point: how fast the output changes.
  14. Derivative rulesPower, sum and product rules, so you rarely compute from scratch.
  15. The chain ruleDerivatives of functions inside functions: the heart of backprop.
  16. Partial derivativesChange one input at a time when there are many.
  17. GradientsThe vector of all partial derivatives: which way is uphill.
  18. Optimization by walking downhillRepeatedly step against the gradient to find a minimum.
  19. Probability basicsEvents, outcomes and the rules for combining them.
  20. Conditional probability and BayesUpdate beliefs when new evidence arrives.
  21. DistributionsRandom variables and the shapes their outcomes take.
  22. Mean, variance and spreadExpected value, variance and standard deviation.
  23. The normal distributionThe bell curve, and why it shows up everywhere.
  24. Samples and confidenceEstimate from a sample and say how sure you are.
  25. A/B tests and significanceTell a real lift from noise.
  26. Maximum likelihoodChoose the parameters that make the data most probable.
  27. SoftmaxTurn any list of scores into probabilities.
  28. Entropy and surpriseMeasure uncertainty in bits.
  29. Cross-entropy and KL divergenceThe loss function language models are trained on.
Phase 3 · about 14 hours of study

Machine learning

Learning from data, and knowing when it worked. 24 lessons, 1 free to try. About this phase

24 lessons
  1. What machine learning is FreePrograms that learn rules from examples instead of being told them.
  2. Features and labelsSupervised learning: inputs, targets and predictions.
  3. Preparing dataClean, encode and scale data before a model sees it.
  4. Feature engineeringTurn raw data into signals a model can use.
  5. Train, validation and test setsHold data back so you can trust your results.
  6. Linear regressionFit a line, and predict numbers from features.
  7. Loss functionsOne number that says how wrong the model is.
  8. Training with gradient descentAdjust weights step by step to reduce the loss.
  9. Learning rateStep size, convergence and divergence.
  10. Logistic regressionPredict probabilities for yes/no outcomes.
  11. Multiclass classificationSoftmax and cross-entropy for more than two classes.
  12. Decision treesLearn a flowchart of yes/no questions.
  13. Random forests and boostingMany weak models voting beat one strong one.
  14. Nearest neighborsPredict from the most similar examples.
  15. Overfitting and underfittingMemorizing versus learning.
  16. RegularizationPenalize complexity so models generalize.
  17. Bias and varianceThe two ways a model can be wrong.
  18. Precision, recall and F1Accuracy lies; these don't.
  19. ROC curves and AUCJudge a classifier across every threshold.
  20. Cross-validationReuse limited data for more reliable estimates.
  21. ClusteringGroup similar items without labels (k-means).
  22. Dimensionality reductionVisualize and compress high-dimensional data.
  23. The scikit-learn workflowFit, predict and evaluate with the standard ML library.
  24. Capstone: churn predictionPredict which customers will leave, and measure it properly.
Phase 4 · about 15 hours of study

Deep learning

Neural networks, backprop and training them well. 23 lessons, 1 free to try. About this phase

23 lessons
  1. The artificial neuron FreeWeighted sum plus a nonlinearity.
  2. Activation functionsReLU, sigmoid, GELU, and why nonlinearity matters.
  3. Multi-layer networksStack layers to learn complex functions.
  4. The forward passFollow numbers through a network to a prediction.
  5. Computation graphsEvery calculation as a graph of small operations.
  6. BackpropagationThe chain rule applied backwards to get every gradient.
  7. Build an autograd engineWrite backprop yourself in ~100 lines (micrograd).
  8. Weight initializationStart weights at the right scale.
  9. The training loopForward, loss, backward, step, repeat.
  10. Mini-batches and SGDTrain on small random batches instead of everything at once.
  11. OptimizersMomentum and Adam.
  12. Normalization layersBatch and layer norm keep training stable.
  13. DropoutRandomly switch off neurons to prevent overfitting.
  14. Vanishing and exploding gradientsWhy deep networks were hard to train.
  15. Debugging trainingRead loss curves and fix what's wrong.
  16. Residual connectionsSkip connections that let gradients flow.
  17. Convolutional networksPattern detectors for images.
  18. Recurrent networksProcess sequences step by step, and their limits.
  19. Embedding layersLearned lookup tables that turn tokens into vectors.
  20. PyTorch tensorsNumPy-like arrays that run on GPUs.
  21. PyTorch autograd and modulesLet PyTorch compute gradients; build models with nn.Module.
  22. GPUs and computeWhy deep learning runs on graphics cards.
  23. Capstone: train a classifierBuild, train and debug a network end to end.
Phase 5 · about 14 hours of study

Transformers

Attention, GPT from scratch and pretraining. 21 lessons, 1 free to try. About this phase

21 lessons
  1. Language modeling FreePredict the next token, and score it with cross-entropy.
  2. Tokenization and BPEHow tokenizers are built from data.
  3. A bigram modelThe simplest language model, built from counts.
  4. Sampling strategiesTemperature, top-k and top-p: turning probabilities into text.
  5. Neural language modelsWhy counting fails, and what embeddings fix.
  6. Attention: the intuitionEach token decides which other tokens matter to it.
  7. Queries, keys and valuesThe three projections behind attention.
  8. Scaled dot-product attentionThe attention formula, line by line.
  9. Causal maskingStop tokens from seeing the future.
  10. Multi-head attentionSeveral attention patterns in parallel.
  11. Positional encodingsTell the model where each token sits.
  12. The transformer blockAttention, MLP, residuals and norms together.
  13. The GPT architectureA stack of decoder blocks that predicts the next token.
  14. Build a tiny GPTWrite and train a small GPT from scratch.
  15. Encoders and embedding modelsBERT-style models and where they fit.
  16. Pretraining at scaleData, compute and what models learn from the internet.
  17. Scaling lawsHow loss falls predictably with size, data and compute.
  18. Inference and the KV cacheWhy generation is fast after the first token.
  19. Long contextEfficient attention and million-token windows.
  20. Mixture of expertsRoute each token to a few specialist sub-networks.
  21. Multimodal transformersHow models see images and hear audio.
Phase 6 · about 16 hours of study

Modern LLM engineering

Post-training, fine-tuning, serving and safety. 22 lessons, 1 free to try. About this phase

22 lessons
  1. Base models vs assistants FreeWhat post-training adds to a pretrained model.
  2. Supervised fine-tuningTeach behavior from example conversations.
  3. Instruction and preference dataThe datasets that shape assistant behavior.
  4. RLHFReward models and reinforcement learning from human feedback.
  5. DPO and direct preference methodsPreference training without a separate reward model.
  6. Constitutional AITraining with AI feedback guided by written principles.
  7. Training reasoning modelsReinforcement learning on verifiable problems.
  8. Prompting vs RAG vs fine-tuningPick the cheapest approach that works.
  9. LoRAFine-tune a big model by training small low-rank updates.
  10. Fine-tune an open modelRun a real fine-tune and evaluate the result.
  11. DistillationTrain a small model to imitate a large one.
  12. QuantizationStore weights in fewer bits to run models cheaply.
  13. Serving modelsBatching, throughput and latency in production.
  14. Speculative decodingDraft with a small model, verify with a big one.
  15. Running open models locallyDownload, quantize and run a model on your own machine.
  16. Benchmarks and their limitsWhat leaderboards measure, and what they miss.
  17. InterpretabilityLooking inside models to see what they compute.
  18. Alignment and safetyMaking capable models behave as intended.
  19. Multi-agent systemsCoordinating many agents on one large job.
  20. Evaluating agentsMeasure multi-step, tool-using behavior.
  21. Reading AI papersGet the idea out of a research paper in 30 minutes.
  22. Capstone: a tuned, evaluated assistantFine-tune, evaluate and deploy a specialist assistant.
Phase 7 · about 12 hours of study

Software engineering

How software is built, from bits to tested, well-designed programs. 16 lessons, 1 free to try. About this phase

16 lessons
  1. How computers run code FreeBits, memory, the processor, and what really happens when Python runs.
  2. Algorithm complexityCount the work code does, and see why some programs stop scaling.
  3. Concurrency and asyncDo many things at once: processes, threads and the event loop.
  4. Performance and profilingMeasure before you optimize, then fix the part that matters.
  5. Core data structuresArrays, linked lists, stacks, queues and the hash table behind every dict.
  6. Recursion, trees and graphsFunctions that call themselves, and the shapes most real data takes.
  7. Searching, sorting and dynamic programmingThe classic algorithms, and the ideas behind them.
  8. Testing your codeAutomated tests that prove code works and keep it working.
  9. Debugging systematicallyFind any bug with a method instead of guesswork.
  10. Readable code and refactoringWrite code people can understand, and improve it safely.
  11. Types and data modelingType hints, dataclasses and checking data at the edges of a program.
  12. Software designModules, interfaces and dependencies that keep big programs changeable.
  13. Databases and SQLStore, query and join data with the language every database speaks.
  14. Secure codingInjection, escaping, secrets and passwords: the mistakes attackers look for.
  15. Projects, packaging and CILay out a real project, pin its dependencies and test it on every push.
  16. Capstone: a command-line appDesign, build and test a complete program with a database.
Phase 8 · about 10 hours of study

APIs

Design, build, secure and scale web APIs from first principles. 13 lessons, 1 free to try. About this phase

13 lessons
  1. HTTP from the wire up FreeWhat really travels between client and server: bytes, headers and bodies.
  2. API stylesREST, RPC, GraphQL, gRPC and streaming: what each is for.
  3. Build an API server from scratchRouting, handlers and responses, with no framework.
  4. A web framework, from the insideDecorators, middleware and error handling: how Flask and FastAPI work.
  5. Designing a REST APIResources, methods, status codes, errors and pagination done well.
  6. Validating requests with schemasCheck every request against a JSON Schema and say exactly what's wrong.
  7. A database-backed APICRUD endpoints on SQLite, with safe concurrent updates.
  8. Authentication and authorizationAPI keys, sessions, tokens and OAuth: who's calling, and what may they do?
  9. Rate limits, retries and idempotencyKeep an API up under load and make retries safe.
  10. Webhooks and eventsPush events to other systems: signed, retried and deduplicated.
  11. Documenting APIs with OpenAPIA machine-readable contract for docs, SDKs and AI tools.
  12. Running APIs in productionVersioning, CORS, caching, request ids and health checks.
  13. Capstone: a complete APIAn authenticated, validated, paginated API with tests.
Phase 9 · about 11 hours of study

Model Context Protocol

Build MCP servers, clients and hosts, from the wire format to production. 14 lessons, 1 free to try. About this phase

14 lessons
  1. JSON-RPC 2.0 in depth FreeRequests, notifications, errors and a dispatcher built from scratch.
  2. Versions and stateless requestsRevisions by date, the legacy handshake, per-request _meta and version negotiation.
  3. Discovery, capabilities and the two erasserver/discover, declared capabilities, and talking to legacy and modern software alike.
  4. Transports I: stdioNewline-delimited JSON over a subprocess's standard streams.
  5. Transports II: Streamable HTTPOne endpoint, required headers, JSON or event-stream replies.
  6. Build a server: toolsTool definitions, schemas from type hints, results and two kinds of error.
  7. Resources and promptsReadable data, URI templates and reusable prompt templates.
  8. Progress, subscriptions and multi-round-trip requestsLong-running work, change notifications and asking the user mid-call.
  9. Build a clientMetadata on every request, version fallback, paging and caching.
  10. Hosts: connecting servers to a modelMany servers, one agent: namespacing, routing and approvals.
  11. Securing remote servers with OAuthProtected resource metadata, PKCE, audiences and scope challenges.
  12. MCP securityTool poisoning, rug pulls, confused deputies and local-server risks.
  13. Testing, designing and shipping serversConformance checks, tool design for models, SDKs and deployment.
  14. Capstone: a production MCP serverA complete, tested server for the practice shop.
Phase 10 · about 10 hours of study

Agent harnesses

Build the software around a model that turns it into a capable, safe agent. 14 lessons, 1 free to try. About this phase

14 lessons
  1. What an agent harness is FreeThe software around a model that turns it into an agent.
  2. The core loop, built properlyStop reasons, parallel tool calls, errors and turn budgets.
  3. A tool registry for agentsSchemas from functions, validation, output limits and helpful errors.
  4. File and search toolsRead, write, edit by exact replacement, glob and grep inside one folder.
  5. Running code safelyExecution tools, step limits, output caps and real sandboxes.
  6. Permissions and approvalsRules, modes and approval prompts that keep a person in control.
  7. Hooks and skillsExtend a harness at lifecycle events, and load know-how on demand.
  8. Managing the context windowBudgets, clearing old tool results, compaction and a cacheable prefix.
  9. Memory, plans and long tasksTo-do lists, progress notes, memory files and checkpoints.
  10. SubagentsHand a focused task to a fresh context with fewer tools.
  11. Streaming, interrupts and sessionsLive output, stopping safely, and saving and resuming transcripts.
  12. Evaluation harnessesRun agents on tasks in fresh environments and grade what they leave behind.
  13. Tracing, budgets and guardrailsSee what an agent did, cap what it spends, and stop it when it loops.
  14. Capstone: build a coding agentA harness that edits a project, runs its tests and stops when they pass.
Phase 11 · about 10 hours of study

Professional practice

Design, ship and run real systems, work well in a team, and get hired. 13 lessons, 1 free to try. About this phase

13 lessons
  1. System design fundamentals FreeRequirements, rough numbers, the standard parts and where systems break.
  2. Caches, queues and background jobsSpeed reads with caches, and move slow work to queues that retry safely.
  3. Designing AI systemsLatency, cost, routing, fallbacks and guardrails for features built on models.
  4. Containers and deploymentPackage an app as an image, configure it with the environment, and roll out safely.
  5. CI/CD pipelinesTest every change automatically, and ship with gates, flags and rollbacks.
  6. Reliability and incidentsSLOs, error budgets, alerts, on-call and blameless postmortems.
  7. Git for teamsBranches, pull requests, rebasing and how a three-way merge finds conflicts.
  8. Code reviewWhat to look for, how to give and take feedback, and automating the routine checks.
  9. Reading unfamiliar codeFind your way around a big codebase fast, with tools that map it for you.
  10. Working with AI coding toolsGive agents good context, keep tasks small, and check every change they make.
  11. Writing for engineersREADMEs, design docs, commit messages and bug reports people can act on.
  12. Interviews and your portfolioShow your work, and solve interview problems the way professionals do.
  13. Capstone: ship a production AI serviceAn AI-backed service with validation, caching, rate limits, fallbacks, logging and evals.