karpathy/minbpe
Minimal, clean code for the Byte Pair Encoding (BPE) algorithm commonly used in LLM tokenization. observed · 2026-08-28
Health v2 · maintenance only
25/100
- Activity 0
- Release rhythm 35
- Longevity 66
Flags: no_releases
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 929
- days_rel: n/a
- days_push: 793
- n_releases_24m: 0
Adoption not part of the score
10691 stars · 1092 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
A minimal, clean Python implementation of the byte-level Byte Pair Encoding (BPE) algorithm used for tokenization in modern LLMs like GPT-4 and Llama. It provides train, encode, and decode functionality with a GPT-4-compatible tokenizer that reproduces tiktoken's output.
Use cases
- train a BPE tokenizer on custom text
- understand how LLM tokenization works
- reproduce GPT-4 tokenization in Python
- encode and decode text to tokens and back
- learn the byte pair encoding algorithm from clean code
- build a custom tokenizer for an LLM project
When to choose
- you want readable, educational BPE code to study or modify
- you need to train a small custom tokenizer without heavy dependencies
- you want to exactly reproduce GPT-4 tokenization behavior
When to avoid
- you need a fast production tokenizer for large-scale workloads (use tiktoken or HuggingFace tokenizers)
- you need tokenizer features like parallel encoding or vocabularies beyond BPE
Facets
library · maturity stable
nlp parser machine-learning llm-training developer-tools large-language-models machine-learning education developer-tools python cross-platform tokenizer byte-pair-encoding bpe llm educational minimal-implementation natural-language-processing
1 source
- readme: https://github.com/karpathy/minbpe · fetched 2026-08-28 · 3257561ae230
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| karpathy/minbpe | main | 25 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem