
How a generative model learns what its data looks like and samples new examples, how an LLM predicts one token at a time, and why useful systems wrap the model in context, retrieval, tools, memory and safety.
A short tour of the four ideas behind today's models: VAEs and their smooth latent space, GANs and their forger-versus-detective game, diffusion's step-by-step denoising, and transformers' parallel attention.
The six layers of a GenAI application: models, context, tools, orchestration, trust and operations, and why most of the engineering happens outside the model.
From a single LLM call to chains, workflows and agents that plan, act and observe in a loop, with the parts every agent needs and what each step up in autonomy costs.
How the 18 sections fit together, the lesson rhythm of hook, concept, demo, checkpoint and recap, what you need to get started, and how to choose the full path or the core track.
Set up Python 3.12 in a virtual environment, Git with a .gitignore that guards secrets, VS Code, Docker and Compose, and an API key kept in a .env file instead of your code.
Choose the right data structure for the operation you do most, stream big files with generators, keep functions small and pure, and use type hints and packages to keep code readable.
Model data with dataclasses and enums, define contracts with protocols, assemble the parts in one place by composition, and clean up resources with context managers.
Catch narrow, named errors at the layer that can handle them, write files safely and atomically, and load configuration from the environment into typed settings with secrets masked.
How one thread and one event loop handle many waits, using tasks, TaskGroups, semaphores, timeouts, queues and a shared client with backoff and jitter, without ever blocking the loop.
Build an async document processor with typed models, narrow error handling, bounded async I/O, a process pool for CPU work, retries that respect Retry-After, and a shutdown that drains and resumes.
HTTP methods and status codes, REST resource design, and how FastAPI turns type hints into endpoints, validation and OpenAPI documentation.
Exercise an API from every side, with Swagger UI, curl -i, Python and httpx, JavaScript fetch and Postman collections, reading the status code before the body.
Use Pydantic models as your API's contract, with separate input and output models, validators for the real rules, strict mode where it matters, and JSON Schema for free.
Stream model output with Server-Sent Events: how chunks and deltas arrive, how SSE frames are built, and how to handle errors, disconnects, heartbeats and proxy buffering in production.
Build chat UIs with Gradio's ChatInterface and Blocks and with Streamlit's session state and write_stream, and keep the key and the access control in a backend.
Test an AI service with pytest fixtures, dependency overrides that swap the LLM for a fake, a mock transport, a contract test, and a few clearly marked live tests.
Images, layers and containers explained, with cache-friendly Dockerfiles, multi-stage builds, non-root users, resource limits, and volumes for your data.
Split data into training, validation and test sets by group or by time, hunt for leakage, read learning curves, and pick metrics that match the decision.
Confusion matrices, precision, recall and F1, why accuracy misleads on rare classes, and how to choose a threshold on validation data.
What a neuron, a layer and a network compute, and how balancing bias against variance decides whether a network generalizes to data it has never seen.
Tensors and their shapes, the forward pass from input to logits and probabilities, cross-entropy loss, and backpropagation with the chain rule.
Why depth needs nonlinearity, how sigmoid and tanh saturate, how ReLU keeps gradients flowing, and the GELU, SiLU and SwiGLU activations used in modern LLMs.
SGD, momentum, Adam and AdamW explained, with learning rate, warmup and clipping, and the memory that optimizer state costs.
Dropout, early stopping, label smoothing and augmentation against overfitting, layer and RMS normalization, warmup-plus-cosine schedules, and why eval mode matters before you measure.
Tensors with shapes, dtypes and devices, autograd, the five-line training loop with train and eval modes, and data pipelines and checkpoints you can resume from.
Train a small PyTorch network from a fresh clone, break it in five ways, and use a six-step debugging checklist to find and fix every bug.
How autoencoders learn through a bottleneck, why their latent space is hard to sample, and how VAEs use the reparameterization trick and a KL term to make sampling and interpolation work.
How a generator and a discriminator train against each other, why the game is unstable, what mode collapse looks like, and where the adversarial idea lives on.
The forward noising process, a network that learns to predict the noise, training as a simple regression, and samplers such as DDIM that turn static into an image step by step.
Latent diffusion in a compressed space, text conditioning through cross-attention, classifier-free guidance and negative prompts, and ControlNet for edges, pose and depth.
How FID, precision and recall, CLIP score and tests like GenEval judge generated images, where each one falls short, and why human preference has the final say.
Generate and edit images with Hugging Face Diffusers: prompts, negative prompts, steps, guidance and seeds, image-to-image, inpainting and ControlNet, then check the results.
How text becomes subword tokens, why token counts vary, how token IDs map to embeddings, and how positional encodings such as RoPE and ALiBi give order to an order-blind model.
Compute self-attention by hand with queries, keys and values, scaled dot products, softmax and the causal mask, and see why attention is quadratic in sequence length.
Multi-head attention, how the KV cache grows, and how multi-query and grouped-query attention share keys and values to cut memory with little loss in quality.
Encoder-only, decoder-only and encoder-decoder transformers: what each one sees, what each is good at, and how a production RAG system uses all three.
Dense models versus mixture-of-experts: how a router picks experts for each token, why compute follows the active parameters while memory follows the total, and how to choose.
How pretraining works, how its data is filtered and deduplicated, how compute scales with model and data size, and why you pin checkpoints and distrust scores a model could have memorized.
How instruction and preference tuning turn a text predictor into an assistant, how chat templates turn messages into tokens, and why tool calls are structured text your code must validate.
Prefill and decode, how the KV cache grows with every token and every user, why the advertised context window is a ceiling rather than a promise, and what long context costs.
Build a tiny GPT and measure how attention scores and the KV cache grow, and how grouped-query attention shrinks the cache.
Open-weight versus closed models, reading model names and benchmarks, how licenses differ, and a scorecard of price, latency and context length with your own eval last.
From logits to tokens: temperature, top-k and top-p, reading the model's confidence with logprobs, and why temperature zero still doesn't promise identical text.
Count tokens before you send, budget the context window part by part, read the bill's input, output, reasoning and cached-input lines, and understand latency to the first token.
Estimate the memory a local model needs, then run models with Ollama, with llama.cpp and GGUF files, and with Hugging Face Transformers.
How quantization and speculative decoding speed up models, what they don't speed up, and why the task eval decides whether the faster model ships.
Search the Hugging Face Hub by task, library, license and size, read model cards, manage the download cache, pin a revision, and compare models on your own examples.
Write down what a good answer looks like first, then build the prompt from role, task, context, examples and format, and iterate one measured change at a time.
Zero-shot prompts with sharp definitions, few-shot examples at the decision boundaries, and breaking a task into chained steps with their own prompts and schemas.
Chain of thought and voting, setting the effort level on reasoning models, and verifying answers by asking for the facts behind them and checking them with code.
Write the output contract as a Pydantic model, use the strongest structured-output guarantee your provider supports, and still validate and evaluate the values.
Validate output in layers, repair with the exact error within a budget, retry transport failures with backoff and a deadline, and make every side effect idempotent.
Treat the context window as a budget: write state outside it, select only what's relevant and allowed, compress while keeping IDs and numbers, and isolate work in sub-agents.
Version and pin prompts, cache in layers with keys scoped to the user, route to the cheapest model that passes your evals, and keep a fallback path ready.
Build a versioned prompt library with a golden suite, recorded cassettes, an offline CI-ready test run and live reports, so every prompt change is tested like code.
The big picture of retrieval-augmented generation, and the stages this section builds in order, from ingestion and chunking to evaluation and a permission-aware search assistant.
Parse files while keeping their structure, attach metadata that makes chunks citable, filterable and permission-aware, deduplicate, sync incrementally, and chunk for retrieval.
How embeddings place meaning in space, how to choose an embedding model by testing it on your own queries, and how vector indexes find neighbors fast with filters inside the search.
Keyword search with BM25, dense search, and hybrid search that runs both under the same access filter and fuses them with reciprocal rank fusion.
Rewrite follow-ups into standalone questions with glossary expansion, and rerank the top candidates with a score threshold, measuring each stage like any other.
Build a golden set and an eval script that scores retrieval and generation separately, including faithfulness and citations, for every version of the pipeline.
LangChain, LlamaIndex or plain Python for the same seven-stage pipeline: hidden defaults, version churn, lock-in, and a checklist for choosing.
What a knowledge graph is, how it stores relationships as data you can query directly, and a schema of node labels, relationship types and keys for the project.
Build a hybrid search assistant over PDFs with cited answers and page links, permission probes with zero leaks, an eval report across versions, and repeatable ingestion.
CLIP's shared image-text space, OCR-free page reading with Donut, ColPali's per-patch vectors with late interaction, and how vision-language models read retrieved pages.
Use vision-language models to read images, documents and video, redact sensitive data before an image leaves your network, and keep a small labelled regression set.
Search documents that mix text, tables, charts, diagrams and scans by converting to text, embedding the images, or both, and store page images and figure crops with their access lists.
Build a visual document assistant whose answers cite pages, regions and graph paths, with permission probes, a scorecard for each modality, and repeatable ingestion.
This course contains the use of artificial intelligence.
Understand the machine, then put it to work.
Plenty of people can call a chat model. Far fewer can explain why it guesses one token at a time, why a diffusion model starts from pure static, or why an agent stalls halfway through a task. This course gives you both halves: how generative AI works on the inside, and how to build useful software with it.
Part 1: How generative models work
Foundations: a practical Python toolkit (async code, FastAPI, Pydantic, streaming, Gradio and Streamlit, tests, containers) and neural networks built up from a single neuron, through backpropagation and optimizers, to a small PyTorch model you train, break and repair.
The generative families: autoencoders and VAEs, GANs, diffusion and latent diffusion with ControlNet, plus ways to score generated images (FID, CLIP score, human preference).
Inside large language models: tokens and embeddings, self-attention worked through by hand, MHA/MQA/GQA, mixture-of-experts, pretraining, instruction tuning and the KV cache, ending with a tiny GPT you build and profile.
Real models: open vs closed models, sampling settings, token costs, running a model on your own laptop with Ollama, llama.cpp and Transformers, quantization, and the Hugging Face Hub.
Part 2: Building with them
Prompts and structure: prompt anatomy, reasoning models, reliable JSON with schemas, repair and retry, context engineering and a versioned prompt library with regression tests.
RAG: parsing and chunking, embeddings, BM25 and hybrid search, reranking, grounding checks, framework choices and knowledge-graph basics.
Vision-language models for images, documents, charts and video.
Fine-tuning: when it's worth it, SFT, LoRA and QLoRA, DPO, RLHF and GRPO concepts, synthetic data, and a small open model compared against prompt and retrieval baselines.
Agents: workflow patterns, the agent loop, LangGraph, single vs multi-agent, MCP, A2A, memory, crash-safe resumable runs and human approval steps.
Voice, sound and video: speech recognition and synthesis, voice cloning and its ethical limits, music and audio generation, how video generators work, and real-time voice.
Responsible AI and operations: hallucination, bias, copyright and regulation, prompt injection, PII redaction and guardrails, then evaluation sets, LLM judges, tracing, reliability and fast, affordable model serving.
Projects you build
Sixteen hands-on projects are spread through the course, from an async document processor and an image studio built on Hugging Face Diffusers to a hybrid search assistant over PDFs, a long-running agent that resumes after a crash, a multimodal content studio and a benchmarked model deployment. Section 18 adds two capstones: a research assistant with citations and evaluations, and a multimodal creative agent that works with images, voice and tools. Each project has its own code repository, and the terminal output on screen comes from real recorded runs, not mock-ups. Where a step needs hardware most laptops lack, such as a datacenter GPU, it is taught as theory and its code is clearly labelled as reference.
How it is organized
There are 126 video lessons in 18 sections, with nearly 28 hours of video. Most lessons follow the same rhythm: a hook, the concept with animations, a demo, a checkpoint and a recap. Each lesson's slides are included as a downloadable deck, and every section closes with a quiz that explains why each answer is right or wrong. Hosted models are retired and replaced over time, so a model named in a recording may not be offered by its provider when you watch it, and the lessons point this out.
Is it for you?
You need basic Python. You don't need a machine learning background, because the course builds that up from scratch. Take it in order, or follow the core application track and add the deep dives you care about.