πŸŽ“ A1Learner
πŸ”
0 of 53 lessons completed

Home / Build an LLM from Scratch in PyTorch

Build an LLM from Scratch in PyTorch

Build a small GPT by hand: character tokens, embeddings with position, self-attention and transformer blocks, a training loop, then generation, sampling and a tiny BPE β€” ending in a trained capstone. Builds on PyTorch Intermediate.

Start learning ❯❯53 lessons · 15 topics · 0/53 completed

Course contents

Work top to bottom β€” the sidebar is the course. Topics later in the list assume the ones before them.

PyTorch The Road Ahead

Intermediate · ⏱ 8 min · standalone lesson

Text as Data

Start: PyTorch The Tiny Corpus ❯

The Bigram Baseline

Start: PyTorch The Bigram by Counting ❯

Averaging Context

Start: PyTorch The Bigram Ceiling ❯

Embeddings with Position

Start: PyTorch Token Embeddings ❯

Self-Attention

Start: PyTorch Tokens That Talk ❯

Multi-Head Attention

Start: PyTorch Many Heads in Parallel ❯

The Transformer Block

Start: PyTorch The Feed-Forward Part ❯

Assembling GPT

Start: PyTorch The GPT Class ❯

Training the Model

Start: PyTorch Getting Batches ❯

Generating Text

Start: PyTorch Greedy Generation ❯

Better Tokens

Start: PyTorch Why Characters Are Slow ❯

Making It Better

Start: PyTorch A Bigger Context ❯

PyTorch Capstone: The Final Model

Advanced · ⏱ 15 min · standalone lesson

PyTorch What to Learn Next

Advanced · ⏱ 8 min · standalone lesson