How an LLM Really Works
Next-token prediction, the decoder-only GPT architecture, and the three stages of building a model: data & architecture, pretraining, fine-tuning. A map you'll use for the whole series.
Every large language model starts with the same building blocks: text becomes tokens, tokens become vectors, and attention lets those vectors talk to each other. In this hands-on 3-hour session you'll write each of those pieces yourself in Python and PyTorch — no black-box libraries, no hand-waving.
Part 1 takes you from raw text to a working multi-head attention module — the foundation every later phase builds on.
Next-token prediction, the decoder-only GPT architecture, and the three stages of building a model: data & architecture, pretraining, fine-tuning. A map you'll use for the whole series.
Why models don't read words. Build a simple tokenizer, then implement Byte-Pair Encoding (BPE) step by step — vocabulary, merges, special tokens and handling unknown text.
Turn a text corpus into input–target pairs with a sliding window, then wrap it in a PyTorch Dataset and DataLoader with context length, stride and batching.
Map token IDs to learnable vectors, add positional information so order matters, and see what an embedding layer actually is under the hood.
Start with a simple attention score, then add trainable query, key and value weights and scaled dot-product attention — computed by hand, then in code.
Mask the future so the model can't cheat, add dropout, and stack heads into a reusable multi-head attention module — the heart of the transformer.
Each block mixes a short concept walkthrough with live coding. You leave with a notebook that runs end to end.
This workshop is for software engineers, data scientists, ML practitioners and college students who use LLMs but want to understand how they are actually built.
Prerequisites: comfortable with basic Python (functions, classes, lists). Some familiarity with NumPy or PyTorch helps but isn't required — we explain every tensor operation we use.
Bring: a laptop with Python 3.10+ and PyTorch installed, or simply a Google account to run everything in Google Colab.
Building an LLM from Scratch runs in phases. Each part builds directly on the code from the one before.
Tokenization, data pipeline, embeddings and attention: everything the model needs before the transformer block.
Later phases continue from the attention module you build here. Dates will be announced after Part 1 — registered participants hear first.
This workshop is part of the OPLEXUS CSR initiative and is free to attend. Fill in your details and we'll email your confirmation along with joining details and setup instructions before the session.
Saturday, 7 November 2026
10:00 AM – 1:00 PM IST (3 hours)