Skip to content
HomeVideos
AllLongsCategoriesPlaylists
BooksBlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K

    Let's build the GPT Tokenizer

    Andrej Karpathy

    5 HN recommenders · recommended in 6 months, 2024–2025

    YouTube

    2:13:35 · 1.3M views · Feb 20, 2024

    Andrej Karpathy builds the GPT tokenizer from scratch, implementing byte pair encoding along with encode and decode. He shows how many odd LLM behaviors trace back to tokenization, and covers Unicode byte encodings along the way.

    Recommended as the best deep dive on tokenizers, worth the two hours for anyone working with LLMs.

    AI, Machine Learning & DataLLMs & generative AIComputer vision, speech & NLPMachine learning & deep learning
    1. 1:56:20
      Let's build GPT: from scratch, in code, spelled out.Andrej Karpathy8.2M views • 3 years ago
    2. 3:31:24
      Deep Dive into LLMs like ChatGPTAndrej Karpathy10M views • 1 year ago
    3. 27:14
      Transformers, the tech behind LLMs | Deep Learning Chapter 53Blue1Brown12M views • 2 years ago
    4. 42:40
      State of GPT | BRK216HFSMicrosoft Developer786K views • 3 years ago
    5. 1:31:13
      A Hackers' Guide to Language ModelsJeremy Howard580K views • 3 years ago
    6. 19:29
      Glitch Tokens - ComputerphileComputerphile353K views • 3 years ago
    7. 59:48
      [1hr Talk] Intro to Large Language ModelsAndrej Karpathy4.3M views • 2 years ago
    8. 1:57:45
      The spelled-out intro to language modeling: building makemoreAndrej Karpathy1.3M views • 4 years ago
    9. 13:52
      Ch(e)at GPT? - ComputerphileComputerphile617K views • 3 years ago
    10. 8:25
      Large Language Models from scratchGraphics in 5 Minutes375K views • 4 years ago
    11. 20:39
      AI Language Models & Transformers - ComputerphileComputerphile354K views • 7 years ago
    12. 28:48
      LSTM is dead. Long Live Transformers!Seattle Applied Deep Learning541K views • 6 years ago
    13. 48:32
      Sparks of AGI: early experiments with GPT-4Sebastien Bubeck1.8M views • 3 years ago
    14. 57:21
      An Observation on GeneralizationSimons Institute for the Theory of Computing210K views • 3 years ago
    15. 19:20
      GPT-4chan: This is the worst AI everYannic Kilcher1M views • 4 years ago
    16. 25:57
      GPT3: An Even Bigger Language Model - ComputerphileComputerphile446K views • 6 years ago
    17. 36:02
      ChatGPT with Rob Miles - ComputerphileComputerphile517K views • 3 years ago
    18. 2:25:52
      The spelled-out intro to neural networks and backpropagation: building microgradAndrej Karpathy4.4M views • 4 years ago
    19. 1:11:41
      Lecture 1 | Natural Language Processing with Deep LearningStanford University School of Engineering821K views • 9 years ago
    20. 27:07
      Attention Is All You NeedYannic Kilcher814K views • 8 years ago

    8 comments from Hacker News

    1. @craniumOct 2024· in “Probably pay attention to tokenizers”

      I finally understood the weirdness of tokenizers after watching the video Andrej Karpathy made: "Let's build the GPT Tokenizer" ( this video ). He goes through why we need them instead of raw byte sequences (too expensive) and how the Byte Pair Encoding algorithm works. Worth spending 2h for the deeper understanding if you deal with LLMs.

      Strongly recommendsView on HN
    2. @zellynApr 2025· in “Why Does Claude Speak Byzantine Music Notation?”

      Andrej Karpathy goes into quite some depth about how tokenization works here: this video tl;dr many of the LLMs use byte-pair encoding to create tokens. You take a set of documents, and then form tokens by repeatedly merging the most common pair of tokens. The initial set of tokens is 256 raw bytes. And the text is typically represented in utf-8. I expect that although the LLMs can understand arbitrarily but cleanly offset unicode code points by (eventually) noticing the final byte of each sequence, they would do markedly worse on actually processing and completing on them, because they will not have been reduced to the normal set of tokens. However, if the text is actually output cleanly converted, either in internal thinking tokens or in the beginning of the response, they should do fine. Understanding tokenization is surprisingly useful, even if that video seems awfully long to devote to such a tedious subject. Even Karpathy doesn't like it!

      RecommendsView on HN
    3. @moozillaMar 2024· in “Ask HN: Did you encounter any leap year bugs today?”

      ChatGPT is specifically bad at these kinds of tasks because of tokenization. If you plug your query into [LINK] , you can see that"egregious" is a single token, so the LLM doesn't actually see any "e" characters -- to answer your question it would have had to learn a fact about how the word was spelled from it's training data, and I imagine texts explicitly talking about how words are spelled are not very common. Good explanation here if this still doesn't make sense: [LINK] , or check out Andrej Karpathy's latest video if you have 2 hours for a deep dive: this video IMO questions about spelling or number sense are pretty tired as gotchas, because they are all basically just artifacts of this implementation detail. There are other language models available that don't have this issue. BTW this is also the reason DALL-E etc suck at generating text in images.

      RecommendsView on HN
    4. @ChironoAug 2024· in “Artificial intelligence is losing hype”

      This is just an artefact of tokenisation though. The model simply isn’t ever shown the letters that make up words, unless they are spelled out explicitly. It sees tokens representing groups of words. This is a little like saying a human isn’t intelligent because they couldn’t answer your question that you asked in an ultrasonic wavelength. If you’d like to learn more this video is a great resource: this video

      RecommendsView on HN
    5. @vismit2000Sep 2025· in “UTF-8 is a brilliant design”

      Karpathy's "Let's build the GPT Tokenizer" also contains a good introduction to Unicode byte encodings, ASCII, UTF-8, UTF-16, UTF-32 in the first 20 minutes: this video

      RecommendsView on HN