TechByteByByte

MODERN AI

Large Language Models

Understand the actual mechanics of LLMs โ€” tokens, embeddings, next-token prediction, pretraining, instruction tuning, alignment, inference and how they become the foundation of modern AI systems.

Transformers โ†’ LLMs โ†’ RAG โ†’ Agents

LLM Learning Path

Learn the concepts in order. Each module builds toward a stronger understanding of how modern language models work and where they fit in the broader AI stack.

01

What Is an LLM?

Understand what a Large Language Model actually is, why it's called 'large,' what exactly is being modeled, and where the historical evolution from rule-based NLP to Transformers lands โ€” with a concrete, verified example of what a model is really predicting.

Start Module โ†’
02

Tokens and Tokenization

Understand why LLMs consume tokens rather than words โ€” subword tokenization, token IDs, special tokens (BOS/EOS/PAD), and why the same sentence produces different token counts across models โ€” with verified, from-scratch examples.

Start Module โ†’
03

Context Window

Understand what a context window actually is, why LLMs have hard limits on it, what happens when a conversation grows too large, and the direct relationship between context windows and RAG โ€” with a verified token-budget and truncation example.

Start Module โ†’
04

Embeddings and Representations

The LLM-specific view of embeddings โ€” token embedding vs. hidden state vs. final representation, precisely distinguished โ€” with a verified, layer-by-layer trace showing a token's representation progressively drift away from its static starting embedding as it incorporates context.

Start Module โ†’
05

Next Token Prediction

One of the most important modules in this course โ€” precisely what 'predict the next token' means mechanically: input sequence, logits, softmax, probability distribution, and selection โ€” traced with a real, executed computation, not just described.

Start Module โ†’
06

Language Modeling and Probability

The mathematics underlying next-token prediction โ€” conditional probability, the chain rule, autoregressive modeling, cross-entropy, negative log-likelihood, and perplexity โ€” built intuitively first, then verified with real computed numbers.

Start Module โ†’
07

How an LLM Generates Text

Assemble Modules 5-6 into the complete, iterative inference loop โ€” traced step by step with a real executed example, including an honest look at a genuine failure mode: repetition from greedy decoding on an undertrained model.

Start Module โ†’
08

Pretraining

Understand what pretraining is, why it's required, how training data is constructed and cleaned, and how the training loop โ€” forward pass, loss, backprop, gradient descent โ€” connects directly to your Neural Networks and Optimization courses, applied at massive scale.

Start Module โ†’
09

Self-Supervised Learning

Understand precisely why LLM pretraining is called self-supervised โ€” where the labels come from, and how enormous datasets can be used without any manual annotation โ€” building directly on your ML course's supervised learning foundation.

Start Module โ†’
10

Transformer Inside an LLM

You already know Transformers completely. This module answers one specific question: now that you understand Transformers, exactly how are they assembled into a complete LLM โ€” end to end, with nothing re-derived from scratch.

Start Module โ†’
11

Decoder-Only LLMs

Why modern GPT-style LLMs specifically use decoder-only architecture โ€” encoder vs decoder recap, causal attention, and precisely why future tokens cannot be seen โ€” with a verified 'I love machine learning' example showing what each position is allowed to attend to.

Start Module โ†’
12

Model Parameters and Architecture

What it actually means when someone says '70B parameter model' โ€” computed directly from real architecture specs (layers, hidden dimension, attention heads, vocabulary size), showing exactly where parameters live and why more parameters don't automatically mean better performance.

Start Module โ†’
13

Scaling LLMs

Why bigger models became possible, scaling laws, the compute/data/parameter trade-off, diminishing returns, and emergent capabilities โ€” with a verified illustrative power-law loss curve and a compute-optimal allocation example.

Start Module โ†’
14

Inference

Production-oriented: what actually happens when you send a prompt to an LLM โ€” prefill, decode, and the KV cache โ€” with a verified FLOPs analysis showing exactly why decode without caching is catastrophically expensive, and why caching fixes it.

Start Module โ†’
15

Temperature, Top-K and Top-P

From first principles: how a token actually gets selected from the probability distribution Module 5 produces โ€” temperature, top-k, top-p (nucleus sampling), greedy decoding โ€” with real, verified numbers showing exactly how each parameter reshapes the same distribution.

Start Module โ†’
16

Fine-Tuning

Why fine-tuning exists, pretraining vs fine-tuning, full vs domain vs task-specific fine-tuning, and practical scenarios for when fine-tuning makes sense versus RAG โ€” with a verified example showing genuine loss reduction from fine-tuning steps starting at pretrained weights.

Start Module โ†’
17

Instruction Tuning

Precisely why next-token prediction alone doesn't guarantee useful, instruction-following behavior โ€” base model vs. instruction-following model, SFT, and how a pretrained model becomes a genuinely useful assistant, building directly on Module 16's fine-tuning mechanics.

Start Module โ†’
18

RLHF

Why RLHF was introduced beyond instruction tuning โ€” human preference data, reward models, the policy model, and reinforcement learning at a conceptual level (not deep RL mathematics) โ€” focused specifically on understanding the pipeline.

Start Module โ†’
19

DPO and Modern Alignment

RLHF's practical complexity and Direct Preference Optimization (DPO) as a more streamlined alternative โ€” optimizing directly on preference pairs without a separate reward model or RL loop โ€” with a verified loss computation showing the loss genuinely decrease as a policy improves.

Start Module โ†’
20

Prompting vs Fine-Tuning vs RAG

A practical decision framework bringing together prompting, fine-tuning (Module 16), and RAG โ€” genuine trade-offs across cost, latency, update frequency, and control, with concrete scenario-based guidance rather than a one-size-fits-all recommendation.

Start Module โ†’
21

Hallucination

Why LLMs hallucinate, connecting directly back to Module 5's mechanism โ€” verified directly: a model produces a full, confident-looking probability distribution even for a fabricated fact it has no genuine grounding for, because next-token prediction has no built-in 'I don't know' signal.

Start Module โ†’
22

LLM Limitations

The broader picture beyond hallucination: context limits, knowledge cutoff, reasoning and mathematical limitations, bias, security (prompt injection), cost, latency, and reliability โ€” with practical mitigation strategies for each.

Start Module โ†’
23

LLM Evaluation

Why evaluating LLMs is genuinely difficult โ€” exact match, BLEU/ROUGE conceptually, perplexity's real limits, human evaluation, LLM-as-a-judge, and RAG/production evaluation โ€” with a verified example showing exact match failing on a semantically identical response.

Start Module โ†’
24

Inference Optimization

Quantization, KV cache (Module 14), batching, continuous batching, speculative decoding, and distillation โ€” practical serving-side optimizations, with verified numbers showing real memory savings from quantization and real GPU waste from static batching.

Start Module โ†’
25

Open-Source vs Closed-Source LLMs

Open-weight models vs closed/API models, self-hosting vs API-based inference โ€” genuine trade-offs across privacy, cost, customization, and deployment complexity, with realistic architecture scenarios for each choice.

Start Module โ†’
26

Evolution of LLMs

The complete historical story, from statistical language models through RNNs, LSTMs, attention, Transformers, GPT-style models, instruction tuning, RLHF/DPO, to modern multimodal/reasoning models โ€” with the specific 'why' named at every transition.

Start Module โ†’
27

LLM in a Modern GenAI System

Connecting everything from this entire course into a complete, concrete system architecture โ€” where embeddings, vector databases, RAG, prompt engineering, the LLM, tools, and agents fit together โ€” directly preparing for the upcoming Agentic AI course.

Start Module โ†’
28

Real-World LLM Scenarios

Ten realistic engineering scenarios โ€” customer support, document Q&A, coding assistants, internal knowledge assistants, summarization, structured extraction, domain-specific assistants, high-throughput APIs, cost reduction, and hallucination reduction โ€” each mapped to problem, architecture, concept, and trade-offs.

Start Module โ†’
29

Interview Questions

The final module: realistic, in-depth interview questions spanning the entire course, followed by 'LLMs โ€” What You Should Know Now,' a complete LLM Cheat Sheet, and a consolidated LLM Interview Question bank.

Start Module โ†’

WHY LLMS?

Learn LLMs through the lens of modern AI

LLMs are the core foundation behind chat interfaces, copilots, document understanding, retrieval systems, code generation and many agentic workflows. Understanding how they predict tokens, scale, align and infer is essential to building effective AI products.