Generative AI & LLMs
Tokenizers, next-token prediction, and the techniques that make large models trainable and servable.
About this track
A large language model predicts one token at a time. Everything else - the tokenizer in front of it, the fine-tuning that specialises it, the quantization that fits it on a smaller card - exists to serve that loop.
This track starts with how text is split and encoded, moves through the two training objectives that produced most current models, and ends on the practical techniques: LoRA, quantization and distillation.
A large language model predicts one token at a time, and everything around it exists to make that prediction useful: the tokenizer in front, the training objective behind, the retrieval that grounds it, and the quantisation that makes it servable.
What you will be able to do
- Explain how text is split into tokens and why byte-pair encoding handles unseen words.
- Distinguish causal from masked language modelling, and say which models each produced.
- Describe what a context window costs and what a KV cache is caching.
- Build a retrieval pipeline and evaluate it with the metric that matches the task.
- Say what LoRA, quantisation and distillation each trade away in exchange for what.
How the track is ordered
Tokenization first, because it determines what the model can represent. Then the two training objectives - causal and masked - that account for most current models, followed by the mechanics of generation: next-token prediction, context windows and KV caching. Retrieval comes next and takes up much of the track, from embeddings and vector search through chunking, hybrid retrieval, reranking and the retriever variants, ending on how to evaluate any of it. Adaptation and efficiency - fine-tuning, RLHF, LoRA, quantisation, distillation - close the track. The NLP track is the prerequisite.
Where this leads
Retrieval quality is mostly an embeddings-and-evaluation problem, so the NLP and machine learning tracks both feed back into it. If you are building rather than studying, the retrieval modules are the ones that change day-to-day results the most.
All 52 modules, in teaching order
- 01How LLMs Process Text?Interactive walkthrough of the LLM text pipeline - tokenization, token IDs, embeddings, positional encoding, self-attention and logits, with live computed values.
- 02Byte Pair Encoding TokenizerInteractive Byte Pair Encoding lab - train real BPE merges on your own corpus and see how any word gets segmented into subword tokens.
- 03How LLMs Predict the Next Word?Interactive lab on LLM next-word prediction - see logits become probabilities through softmax, and how temperature, top-k and top-p sampling reshape the distribution.
- 04What are Queries, Keys and Values in an LLM?
- 05Causal Language ModelingSee how predicting the next token, over and over, is all it takes for a model like GPT to produce fluent text.
- 06What is Masked Language Modeling?Interactive Masked Language Modeling lab - mask tokens in a sentence and see how a bidirectional model like BERT predicts them from left and right context.
- 07Quantization in LLMsInteractive quantization lab for LLMs - map FP32 weights to INT8 or INT4, see quantization error, outlier effects and real model memory savings.
- 08LoRA in LLMsInteractive LoRA lab - see how low-rank adapters replace full fine-tuning, how rank controls trainable parameters, and what a rank-limited update can represent.
- 09Knowledge Distillation in LLMsInteractive knowledge distillation lab - soften teacher logits with temperature, compare hard labels to soft targets, and watch KL divergence guide a student model.
- 10Embeddings and Vector SearchMeaning becomes geometry. Run an exact nearest-neighbour search, then a partitioned one, and watch comparisons collapse while recall quietly slips.
- 11Dot Product vs Cosine Similarity for RetrievalStretch one document's vector and watch dot-product ranking promote it purely for being longer, while cosine ranking never moves. Two different questions, one embedding.
- 12TF-IDF
- 13BM25 and Sparse Lexical RetrievalThe keyword-matching half of search, computed live. Drag length normalization to zero and watch a verbose repetitive document dominate purely on term count.
- 14Indexing in vector databases
- 15ANN indexing: HNSW and IVF
- 16Flat Index
- 17IVF-Flat
- 18HNSW
- 19Annoy
- 20Product Quantization
- 21IVF-PQ
- 22DiskANN
- 23ScaNN
- 24Chunking Strategies for RAGSlide the chunk size down and watch fixed-size splitting cut sentences in half, while semantic chunking respects paragraph boundaries and never does.
- 25Recursive chunking
- 26Structure-aware chunking
- 27Semantic chunking
- 28Context-aware chunking
- 29Parent Document RetrieverSearch small chunks so the match is precise, then hand the model the whole parent document so the answer has enough context to be worth reading.
- 30Retrieval-Augmented Generation (RAG)Ask about a product no model has heard of. Watch retrieval score every chunk, paste the winners into the prompt, and turn a guess into a cited answer.
- 31Retrieval Evaluation MetricsThe same five relevant documents out of ten retrieved, in three different orders. Precision and recall cannot tell them apart - MRR and nDCG can.
- 32What is Hit Rate@k?
- 33What is Recall@k?
- 34What is Precision@k?
- 35What is MRR (Mean Reciprocal Rank)?
- 36Hybrid Search: Dense + Sparse (Reciprocal Rank Fusion)Run vector search and BM25 side by side and watch them disagree, then fuse the two rankings and see a document neither method alone ranked first win on consensus.
- 37Re-ranking: Bi-Encoders vs Cross-EncodersRetrieve six candidates fast with a bi-encoder, then re-score them with a slower cross-encoder that reads query and document together and catches what was missed.
- 38Maximal Marginal Relevance (MMR)Pick the next document by relevance minus similarity to what you already picked, and watch three near-duplicate chunks stop crowding out everything else.
- 39Query Rewriting and HyDEA terse question shares almost no vocabulary with the formal passage that answers it. Expand the query, or embed a hypothetical answer instead, and watch it climb the ranking.
- 40Multi-Query RetrieverOne question asked several ways. Each phrasing retrieves separately and the union catches the document a single wording would have missed.
- 41Self-Query RetrieverSplit a question into a semantic query and a metadata filter, so "after 2020" becomes a rule that is enforced rather than a phrase that is matched.
- 42Corrective RAG (CRAG)
- 43Context Windows and the KV CacheFill a context window and watch what gets pushed out, then switch off the KV cache and watch the work per token go quadratic.
- 44Fine-Tuning vs RLHF and DPOThree stages, three jobs. Watch a model's answers move under supervised fine-tuning, then under preference optimisation, and watch reward hacking happen.
- 45Hallucination and GroundingA model always has probability mass somewhere, even when it knows nothing. Watch it move as evidence, temperature, retrieval and an abstain option are added.
- 46Groundedness in LLM evaluation
- 47Correctness in LLM evaluation
- 48Relevance in LLM evaluation
- 49Completeness in LLM evaluation
- 50Query, embedding and prompt caching
- 51Permission filtering in RAG retrieval
- 52Distributed retrieval and sharding