Build an LLM from Scratch 2: Working with text data @SebastianRaschka
Build an LLM from Scratch 2: Working with text data  @SebastianRaschka
Uploaded March 2025 | Updated November 2026, 3 hours ago
Links to the book:
- amzn.to/4fqvn0D (Amazon)
- https://mng.bz/M96o (Manning)

Link to the GitHub repository: github.com/rasbt/LLMs-from-scratch

This is a supplementary video going over text data preparations steps (tokenization, byte pair encoding, data loaders, etc.) for LLM training.

00:00 2.2 Tokenizing text
14:02 2.3 Converting tokens into token IDs
23:56 2.4 Adding special context tokens
30:26 2.5 Byte pair encoding
44:00 2.6 Data sampling with a sliding window
1:07:10 2.7 Creating token embeddings
1:15:45 2.8 Encoding word positions

You can find additional bonus materials on GitHub:

Byte Pair Encoding (BPE) Tokenizer From Scratch, github.com/rasbt/LLMs-from-scratch/blob/main/ch02/05_bpe-from-scratch/bpe-from-scratch.ipynb

Comparing Various Byte Pair Encoding (BPE) Implementations, github.com/rasbt/LLMs-from-scratch/blob/main/ch02/02_bonus_bytepair-encoder/compare-bpe-tiktoken.ipynb

Understanding the Difference Between Embedding Layers and Linear Layers, github.com/rasbt/LLMs-from-scratch/blob/main/ch02/03_bonus_embedding-vs-matmul/embeddings-and-linear-layers.ipynb

Data sampling with a sliding window with number data, github.com/rasbt/LLMs-from-scratch/blob/main/ch02/04_bonus_dataloader-intuition/dataloader-intuition.ipynb

A video on the effect of random seeds: youtube.com/watch?v=ii89_SqKB08&feature=youtu.be
Build an LLM from Scratch 2: Working with text dataL16.4 A Convolutional Autoencoder in PyTorch   Code ExampleL11.2 How BatchNorm WorksL4.3 Vectors, Matrices, and BroadcastingL5.2 Relation Between Perceptron and Linear RegressionL10.5.3 (Optional) Dropout Ensemble InterpretationL8.7.1 OneHot Encoding and Multi-category Cross EntropyL4.4 Notational Conventions for Neural NetworksBuild an LLM from Scratch 7: Instruction FinetuningBuild an LLM from Scratch 6: Finetuning for ClassificationL8.7.2 OneHot Encoding and Multi-category Cross Entropy   Code ExampleL15.2 Sequence Modeling with RNNs
Sebastian Raschka |

Build an LLM from Scratch 2: Working with text data

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER