GPT Tokenizers
PremiumGPT-2/GPT-4 tokenization, regex pre-tokenization, and the tiktoken library
Get code accessGPT-2 Tokenization
In the previous chapter we built a basic BPE. OpenAI did not use naive BPE directly in GPT-2; they made an important improvement: regex pre-tokenization.
Problems With Naive BPE
Consider a word like “dog” that appears with different punctuation:
dog.
dog!
dog?
dog,Naive BPE may merge each into separate tokens:
Log in to continue reading
This is premium content. Please log in to access the full article.
CookLLM Docs