Kanishk Varshney

Kanishk Varshney

Shipping AI from R&D to production — notes, from scratch.

WritingAbout← Portfolio

Writing

Essays

Shipping AI from R&D and PoC to production at scale.

Categories
Tag

Jul 16, 2026 · Tokenization · 7 min

Building BPE from scratch

Byte-Pair Encoding fixes word-level tokenization by working with subword pieces: it starts from single-byte characters - so text in its range is never out-of-vocabulary - and repeatedly merges the most frequent adjacent pair. Here it is built and trained from scratch, with a live playground.

tokenization · bpe · nlp · from-scratch

Recently updated

  • Building BPE from scratch

    Jul 16, 2026

  • Why word-level tokenizers break

    Jul 16, 2026

Trending tags

from-scratch 2nlp 2tokenization 2bpe 1