How LLMs & Gen AI Work
Demystify the technology behind ChatGPT, Gemini, and Claude through interactive visualizations and hands-on demos.
4-Week Syllabus
A comprehensive journey from AI fundamentals to building real-world AI workflows.
Introduction to AI &
Generative AI
Understand the foundations of Artificial Intelligence, the rise of Generative AI, and how these technologies are transforming our world.
What is AI?
Key Takeaways
- AI is a broad field dedicated to creating systems that perform tasks requiring human intelligence
- This includes recognizing speech, making decisions, translating languages, and identifying patterns
- "AI" is an umbrella term โ break it down by capabilities (Narrow vs. General) and methods (Machine Learning)
Classify the AI Application
Drag each example into the correct category. Can you get them all right?
Narrow vs General AI
๐ฏ Narrow AI (ANI)
Highly specialized for a single task. A chess-playing AI cannot drive a car.
Examples: Siri, Netflix, Tesla Autopilot, ChatGPT
๐ก ChatGPT feels general-purpose but is still ANI โ it can't autonomously learn new skills or transfer knowledge to unrelated problems.
๐ General AI (AGI)
Theoretical "holy grail" โ human-level cognitive abilities across any domain.
Status: Does not exist yet.
Evolution of AI
Rule-Based Systems
Pre-programmed If-Then rules that didn't learn from mistakes.
Learning from Data
Algorithms that learn patterns from historical data on their own.
Neural Networks at Scale
Artificial neural networks analyze complex data with superhuman accuracy.
Creating Original Content
Foundation models that create brand-new, original outputs from training data.
Neural Network Playground
See how a neural network learns to classify data points! Click to add points, then watch the network train.
Click on the canvas to add ๐ต blue or ๐ด red points (toggle with the buttons below)
๐ก How it works: The neural network draws a decision boundary to separate blue and red points. As it trains over more epochs, the boundary becomes more accurate. This is fundamentally how AI "learns" โ by adjusting its internal parameters to minimize errors!
Deep Dive: Neural Networks Explained
Materials: Interactive classification dataset canvas with customizable data points (Red/Blue classes), an epoch counter, and real-time decision boundary rendering.
Explanation: The playground demonstrates binary classification using a multi-layer perceptron (a type of neural network). Every data point added forces the network to recalculate its parametersโits weights and biasesโduring training iterations known as epochs. The background colors visualize the network's current understanding, plotting the decision boundary that isolates the classes.
Summary: Neural networks learn by iteratively adjusting their internal weights to minimize the prediction errors. Over continuous training, they identify underlying patterns, eventually mapping out complex decision boundaries that predict and separate different groupings of data effectively.
Traditional AI vs Generative AI
Overview of AI Modalities
Generative AI works across multiple modalities โ text, images, audio, and video.
Text Generation
- Processes and generates human-like written content
- Uses LLMs to predict the next logical word or token
- Examples: ChatGPT, Claude Sonnet, Google Gemini
Image Generation
- Creates brand-new visual content from text descriptions
- Uses diffusion models โ gradually removing noise until a clear picture forms
- Examples: DALL-E 3, Midjourney, Stable Diffusion
Audio Generation
- Synthesizes realistic speech (text-to-speech) and original music
- Analyzes audio waveforms and patterns for high-fidelity output
- Examples: Suno, Udio, ElevenLabs, Google's Lyria
Video Generation
- Generates moving video clips from text prompts
- Combines spatial + temporal understanding for frame consistency
- Examples: OpenAI's Sora, Google's Veo, Runway Gen-3
Match the AI Tool
Can you match each AI tool to its correct modality? Click two cards to find a match!
AI or Human? ๐คโ๏ธ
Can you tell the difference between AI-generated and human-written text?
How Image AI Works: Diffusion
Drag the slider to see how AI generates images by gradually removing noise โ the core idea behind DALL-E and Stable Diffusion!
๐ก How diffusion works: During training, the model learns to reverse a noising process. At generation time, it starts from pure random noise and gradually "denoises" it, guided by the text prompt, into a coherent image. Each step removes a bit of noise, adding more structure and detail.
How Generative AI Learns
From data collection to human feedback โ the RLHF cycle.
Evolution of ChatGPT
The rapid scaling from 117M parameters (GPT-1) to multimodal intelligence (GPT-4).
๐ก Each generation of GPT has roughly 10x more parameters than the last. Parameters are the "knobs" the model adjusts during training โ more parameters = more capacity to learn patterns, but also more data and compute needed.
Large Language Models
(LLMs)
Go deeper โ understand what LLMs really are, how they process language, and why they're transforming every industry.
What Exactly is an LLM?
Key Takeaways
- A Large Language Model is a neural network trained on massive text datasets to understand and generate human language
- The "large" refers to billions (or trillions) of parameters โ the internal weights adjusted during training
- LLMs are foundation models โ trained broadly, then adapted to specific tasks via fine-tuning or prompting
How LLMs Work Behind the Scenes
Tokens, prediction, the Transformer breakthrough โ the full picture.
๐ค Tokenization
Text is split into tokens (subword units). "Unbelievable" โ ["Un", "believ", "able"]. The
model never sees raw characters โ only token IDs.
๐ฎ Next-Token Prediction
At its core, an LLM predicts the probability distribution of the next token given all previous tokens. Generation is just this loop repeated thousands of times.
โก The Transformer
Introduced in Google's 2017 paper "Attention Is All You Need". Self-attention allows every token to relate to every other token simultaneously โ enabling true language understanding.
๐ Scale = Capability
Emergent abilities (reasoning, code, math) appear at scale. GPT-3 (175B params) showed capabilities not present in smaller models. Scale unlocks behaviors no one programmed explicitly.
Current LLMs in the Market
The leading foundation models from OpenAI, Google, Anthropic, and Meta.
Understanding LLM Limitations
Knowing what LLMs can't do is just as important as knowing what they can.
๐ Hallucinations
LLMs confidently generate false information. They don't "know" facts โ they predict plausible-sounding text. Always verify important outputs.
โฐ Knowledge Cutoff
Training data has a cutoff date. LLMs don't know about events after their training ends unless given tools like web search or RAG.
๐ Context Window
LLMs can only process a fixed window of tokens at once. Very long documents must be chunked or summarized. This is their "short-term memory" limit.
๐งฎ Reasoning Limits
LLMs can fail at multi-step math, logic puzzles, and counting tasks. They pattern-match rather than truly reason, though techniques like chain-of-thought help significantly.
Tokenizer Lab
See how LLMs break text into tokens. Type any text below!
๐ก Why tokenization matters: LLMs don't read words like humans. They process sequences of tokens โ subword units. Common words stay intact, while rare words get split. This is why LLMs sometimes struggle with character counting!
Next Token Prediction Game
Experience how an LLM generates text! Pick the next word and watch how temperature changes creativity.
Low = predictable ยท High = creative & random
๐ After the first word, options are simplified for demo purposes โ real LLMs predict from a vocabulary of 50,000+ tokens.
Attention Heatmap
The secret sauce of Transformers! See which words "pay attention" to which others.
๐ก How to read this: Brighter = stronger attention. Notice how "it" attends strongly to "cat" โ the model learns pronoun references!
Deep Dive: Self-Attention Explained
Materials: Interactive self-attention matrix visualizer generating a color-coded heatmap based on custom input sentences.
Explanation: The attention mechanism works by assigning a specific mathematical weight to every pair of words in a sentence, determining their relevance to each other. In this heatmap, brighter colors represent stronger correlations. For instance, when interpreting the pronoun "it", the model attributes high attention scores backward to the relevant noun (like "cat"), successfully preserving dependencies spanning the entire text.
Summary: Self-attention calculates how heavily each word should rely on context from surrounding words. By abandoning sequential processing (word-by-word computation) in favor of evaluating all word relationships simultaneously, it gives Large Language Models their unprecedented understanding of context and nuance.
Transformer Architecture
Click through each component to understand how data flows.
๐ Click a component
Click on any block in the diagram to learn what it does and why it matters.
Deep Dive: The Transformer Explained
Materials: Interactive architectural flow diagram of a standard Transformer Block featuring distinct, clickable components for in-depth data flow tracing.
Explanation: Instead of processing a sentence sequentially, the Transformer analyzes all tokens simultaneously. Input embeddings are first combined with positional encodings (so the model knows word order). The data passes through Multi-Head Self-Attention layers to gather context. After continuous normalization (Add & Norm) to maintain stability, a Feed-Forward Network refines the data representation. Finally, the model outputs a probability distribution pinpointing the most likely next token.
Summary: The Transformer architecture relies heavily on self-attention blocks stacked sequentially. By computing global contexts in parallel, the architecture is vastly more efficient for training on massive text corpora compared to older Recurrent Neural Networks.
Word Embedding Space
Explore how AI understands word relationships by mapping them into a mathematical space where similar words are close together!
๐ก How embeddings work: Each word is represented as a vector (list of numbers). Words with similar meanings end up close together: "king" is near "queen", "cat" is near "dog". The famous example: king - man + woman โ queen!
Deep Dive: Embedding Space Explained
Materials: Interactive 2D projection canvas of a high-dimensional word vector space equipped with semantic search and analogy calculation tools.
Explanation: Modern embedded representations (like Word2Vec, or the core of any LLM) encode the definition and context of tokens within extremely long arrays of numbers (vectors). The model groups similar abstract concepts closely together in space. Though an LLM works in thousands of dimensions, this demo projects the math into 2D. This mapping allows semantic arithmetic, such as calculating analogies (e.g., King - Man + Woman โ Queen).
Summary: Word embedding is the process of translating human vocabulary into dense mathematical vectors. By plotting words onto coordinates, AI models translate semantic meanings, synonyms, and logical relationships into distances and angles that a machine can easily compute.
Fact or Myth about AI ๐ง
Test your understanding with these interactive quizzes!
Speed Round โ AI Buzzword Bingo
Click on each AI term to reveal its definition. Can you learn all 16 before time runs out?
๐ Press โถ๏ธ Start Timer below to begin โ then click each term to reveal its definition!













