1. The spelled-out intro to neural networks and backpropagation: building micrograd
The Tokenizer is a necessary and pervasive component of Large Language Models (LLMs), where it translates between strings and tokens (text chunks). Tokenizers are a completely separate stage of the LLM pipeline: they have their own training sets, training algorithms (Byte Pair Encoding), and after training implement two fundamental functions: encode() from strings to tokens, and decode() back from tokens to strings. In this lecture we build from scratch the Tokenizer used in the GPT series from OpenAI. In the process, we will see that a lot of weird behaviors and problems of LLMs actually trace back to tokenization. We’ll go through a number of these issues, discuss why tokenization is at fault, and why someone out there ideally finds a way to delete this stage entirely.
Chapters:
00:00:00 intro: Tokenization, GPT-2 paper, tokenization-related issues
00:05:50 tokenization by example in a Web UI (tiktokenizer)
00:14:56 strings in Python, Unicode code points
00:18:15 Unicode byte encodings, ASCII, UTF-8, UTF-16, UTF-32
00:22:47 daydreaming: deleting tokenization
00:23:50 Byte Pair Encoding (BPE) algorithm walkthrough
00:27:02 starting the implementation
00:28:35 counting consecutive pairs, finding most common pair
00:30:36 merging the most common pair
00:34:58 training the tokenizer: adding the while loop, compression ratio
00:39:20 tokenizer/LLM diagram: it is a completely separate stage
00:42:47 decoding tokens to strings
00:48:21 encoding strings to tokens
00:57:36 regex patterns to force splits across categories
01:11:38 tiktoken library intro, differences between GPT-2/GPT-4 regex
01:14:59 GPT-2 released by OpenAI walkthrough
01:18:26 special tokens, tiktoken handling of, GPT-2/GPT-4 differences
01:25:28 minbpe exercise time! write your own GPT-4 tokenizer
01:28:42 sentencepiece library intro, used to train Llama 2 vocabulary
01:43:27 how to set vocabulary set? revisiting transformer
01:48:11 training new tokens, example of prompt compression
01:49:58 multimodal [image, video, audio] tokenization with vector quantization
01:51:41 revisiting and explaining the quirks of LLM tokenization
02:10:20 final recommendations
02:12:50 ??? :)
Exercises:
- Advised flow: reference this document and try to implement the steps before I give away the partial solutions in the video. The full solutions if you’re getting stuck are in the minbpe code
Links:
- Google colab for the video:
- GitHub repo for the video: minBPE
Supplementary links:
- tiktokenizer
- tiktoken from OpenAI:
- sentencepiece from Google
3 views
8976
3339
2 months ago 06:08:59 1
Join us live Debate shocking truth Islamic paganism true or false?
2 months ago 05:29:59 1
Best Whiskey Blues Music | Blues Music Playlist | Slow Blues /Rock Ballads Top #2
2 months ago 00:15:34 1
[Queen Alisha Plays] THIS NEW META BUILD OF ALICE IS BROKEN IN LATE GAME │CARRY YOUR TEAMMATES IN SOLO RANK-MLBB
2 months ago 00:00:05 1
SMM продвижение | ЧЕХИЯ
2 months ago 00:00:05 1
ОБЩЕЖИТИЕ В ПРАГЕ | ПРОЖИВАНИЕ СТУДЕНТОВ
2 months ago 00:00:05 1
ЧЕШСКИЙ ЯЗЫК | Учеба в Чехии | Курсы
2 months ago 00:03:37 1
Yes, I Can! | Animal Song For Children | Super Simple Songs
2 months ago 00:19:14 2
[CDR] I RAN INTO THE MASTER OF FLICKS
2 months ago 00:18:50 1
[AarohanTechSol] Fix God Of War Ragnarok D3D Device Crashed The Graphics Device Crashed
2 months ago 00:11:14 1
i was right.
2 months ago 00:41:49 1
Pink Floyd - Animals 2018 Remix (Full Album)
2 months ago 00:06:46 1
SWORD ART ONLINE Fractured Daydream — System Trailer
2 months ago 00:11:04 1
Like A Dragon: Yakuza Pirate In Hawaii Gameplay Overview | RGG Summit 2024
2 months ago 00:52:39 1
VOCAL TRANCE BLISS VOL. 206 [FULL SET]
2 months ago 00:05:51 1
Berry Good Johyun Shorts Compilation #1 😍
2 months ago 01:25:52 1
♡ cat and mouse game | playing Zenless Zone Zero on iPad #13 | ~80 min of gameplay ♥︎
2 months ago 00:12:29 1
ОПЫТНЫЕ ЛЮДИ ТУТ ЖЕ ЗАСЕКЛИ
2 months ago 00:09:30 1
Mia Zambra - Behind the Scenes No.1 2023-12-27
2 months ago 00:32:45 1
Fun & Fierce Full Interview #Devara | NTR, Koratala Siva, Siddhu Jonnalagadda, Vishwaksen | Sep27
2 months ago 00:02:19 1
MMV - Aftermath - The way You Are
2 months ago 01:08:21 1
Xenia Torino - Live @ Kiss FM Ukraine / Melodic Techno & Progressive House Mix
2 months ago 00:00:26 1
Видео от BN_THE_BRAND РЕПЛИКА 1/1 качество ДЬЮТИ ФРИ