What did Andrej Karpathy say about the risks of tokenization?

Andrej Karpathy says tokenization is easy to dismiss, but it hides real foot guns, sharp edges, security issues, and AI safety issues. His main warning is that you should not brush it off, because the tokenizer can create surprising failures in downstream model behavior. He also says that if we can eventually remove tokenization entirely, that would be ideal.

“Concludes my fairly long video on tokenization. I know it's a try, I know it's annoying, I know it's irritating. I personally really dislike this stage. What I do have to say at this point is don't brush it off. There's a lot of foot guns, sharp edges here, security issues, AI safety issues. As we saw, plugging in unallocated memory into language models. So, it's worth understanding this stage. That said, I will say that eternal glory goes to anyone who can get rid of it. I showed you one possible paper that tried to do that, and I think, I hope a lot more can follow over time.”
— Andrej Karpathy, Talk / tutorial presentation, 2019 · at 2:10:21
Andrej Karpathy: Andrej Karpathy on Tokenization: Building GPT's Tokenizer

Key takeaways

  • Don't ignore tokenization just because it feels like plumbing.
  • Treat tokenizer choices as a safety and reliability concern.
  • If a simpler replacement for tokenization works, it is worth pursuing.

Context

At the end of his 2019 talk on tokenization, Karpathy summarizes the practical importance of the topic and its risks. The quote above is taken word for word from the recording's transcript.

In the transcript

…have to, um, so prefer to use the YAML over JSON. And in general, kind of like, the tokenization density is something that you have to, um, sort of care about and worry about at all times and try to find efficient encoding schemes, and spend a lot of time in the tokenizer, and measure the different token efficiencies of different formats and settings and so on. Okay, so that

Concludes my fairly long video on tokenization. I know it's a try, I know it's annoying, I know it's irritating. I personally really dislike this stage. What I do have to say at this point is don't brush it off. There's a lot of foot guns, sharp edges here, security issues, AI safety issues. As we saw, plugging in unallocated memory into language models. So, it's worth understanding this stage. That said, I will say that eternal glory goes to anyone who can get rid of it. I showed you one possible paper that tried to do that, and I think, I hope a lot more can follow over time.

That's something you should consider and just use the Tech token because it is a very efficient and nice library for inference for BPE. I also really like the byte-level BPE that TikTok and OpenAI use. If, for some reason, you want to train your own vocabulary from scratch, then I would use the BPE with SentencePiece. Oops, as I mentioned, I'm not a huge fan of SentencePiece. I don't…

Read the full transcript of Talk / tutorial presentation

Topics

What others said about artificial intelligence

More questions about Andrej Karpathy

All Andrej Karpathy answers · All Andrej Karpathy recordings

How this answer was made: the quote is checked word for word against the transcript of the recording and confirmed as the speaker's own words; the summary above it was drafted with AI from that transcript and quality-checked. Methodology and corrections.

Search every transcript
Open the full search page →