olaflaitinen / knap
A byte level BPE tokenizer written from scratch in pure Mojo. Implements the seven encodings OpenAI models use, runs with no Python interpreter in the process, and publishes its evidence: 191.7 million tokens and every token id checked against the reference implementation.
Over time
2026-09-07 to 2026-09-11; peak 17,421 lines
2026-09-07 to 2026-09-11; 75 commits, counted up by commit date
- Opened 8
- Closed or merged 4
2026-09-08 to 2026-11-04; 8 issues and pull requests opened (0 issues, 8 pull requests), from GitHub by mojo_issues
Dependencies
Declared in its manifests at HEAD (toolchain left out): python, regex, rs-bpe, tiktoken, tokenizers.
Similar repos
| Repo | Description | Similarity |
|---|---|---|
| ratulb/mbpe | mbpe — A BPE tokenizer engine in Mojo, generic over a compile-time pre-tokenizer. Trains vocabularies from scratch, reads/writes the standard .tiktoken format, and reproduces OpenAI's GPT-2/GPT-4/GPT-4o vocabularies byte-for-byte. Outperforms tiktoken-rs (Rust) on every benchmark. | 84% |
| amarbaro/mojo-tokenizers | Hugging Face tokenizer.json runtime for Mojo: byte-level BPE (GPT-2, Llama 3, Qwen) | 83% |
| mempirate/mojobag | BPE tokenizer in Mojo | 83% |
| mikeleppane/mojo-tiktoken | Pure-Mojo rewrite of OpenAI's tiktoken - byte-level BPE with hand-compiled Unicode scanners instead of a regex engine, golden-tested byte-for-byte against the reference. | 82% |
| ratulb/simple_bpe | A simple BPE tokenizer implementation Mojo | 82% |
By the cosine of the embeddings of each repo's name, description and topics: bge-small-en-v1.5 at bbddccb7, from snapshot 3454761910736014829 of mojo.repo_embeddings, which mojo_embed writes.
Stars per month
- stars
- forks
2 stars over the months of GH Archive loaded so far (47; months in between aren't loaded yet), counted from its events.
Contributors per month
- contributors
- new
2 people authored or co-authored its commits (every commit reachable from HEAD, Co-authored-by trailers included, bots left out), counted by email.
Releases and tags
| Date | Tag | Name | From | Mojo version | Commit |
|---|---|---|---|---|---|
| 2026-09-11 | v1.0.0 | – | git tag | 1.0.0 | 4c5b07a909 |
Issues and pull requests
0 open and 0 closed issues; 4 open, 3 merged and 1 closed pull requests, from GitHub by mojo_issues.
Pull requests
| # | Title | Opened | State | Comments |
|---|---|---|---|---|
| 8 | build(deps): bump certifi from 2026.7.22 to 2026.10.18 | 2026-11-04 | open | 1 |
| 7 | build(deps-dev): bump regex from 2026.9.3 to 2026.9.29 | 2026-11-01 | open | 1 |
| 6 | build(deps-dev): bump tokenizers from 0.23.2 to 0.23.3 | 2026-11-01 | open | 1 |
| 5 | ci(deps): bump github/codeql-action from 3 to 4 | 2026-10-01 | open | 1 |
| 4 | build(deps-dev): bump regex from 2026.9.3 to 2026.9.10 | 2026-10-01 | closed | 2 |
| 3 | ci(deps): bump actions/upload-artifact from 4 to 7 | 2026-09-08 | merged | 1 |
| 1 | ci(deps): bump actions/checkout from 5 to 7 | 2026-09-08 | merged | 1 |
| 2 | ci(deps): bump actions/setup-python from 5 to 7 | 2026-09-08 | merged | 1 |
Migrations
| Date | What | From | To | Commit |
|---|---|---|---|---|
| 2026-09-07 | mojo_version | – | 1.0.0 | 571c26a698 |
| 2026-09-07 | tooling | none | pixi | 571c26a698 |
| 2026-09-08 | packaging | none | rattler | 15876c8e47 |
Commits
Commit types: Feature 17% · Fix 8% · Mojo version 1% · Refactor 1% · Performance 9% · Docs 33% · Tests 5% · Build and chores 24%
| Date | Commit | Type | Subject | Lines of Mojo | Tooling | Mojo version |
|---|---|---|---|---|---|---|
| 2026-09-11 | b1c30f3ab8 | Fix | fix(conda): the package acceptance test proved less than it claimed | 17,421 | pixi | 1.0.0 |
| 2026-09-11 | 67056e08fd | Docs | docs: record the Zenodo DOI | 17,421 | pixi | 1.0.0 |
| 2026-09-11 | 4c5b07a909 | Build and chores | release: add .zenodo.json so the DOI record carries the right metadata | 17,421 | pixi | 1.0.0 |
| 2026-09-11 | 05aceb717a | Build and chores | release: pin the recipe at the 1.0.0 tree | 17,421 | pixi | 1.0.0 |
| 2026-09-11 | e83f0ea34f | Fix +docs | fix(conda): the recipe pinned a commit older than its own build script | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | d90b59d4c4 | Docs | docs: read every document against the code and fix what disagreed | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | 0008794d5b | Feature +tests +docs | feat(gates): refuse a Contents list that has drifted from its document | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | 3a2ce50309 | Docs | docs: wire the new material into the documents that point at things | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | 3927e1dbf3 | Build and chores | build(sbom): a CycloneDX bill of materials, generated and gated for drift | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | 3bc1e184e1 | Docs | docs: the toolchain findings and the method, as documents of their own | 17,421 | pixi | 1.0.0 |
| 2026-09-10 | 3fde614cd2 | Feature +tests +docs | feat(tokenizer): padded batches with attention masks, and two examples | 17,324 | pixi | 1.0.0 |
| 2026-09-10 | 3fbf271be5 | Feature +tests | feat(cli): shell completions, and a test that keeps them true | 16,565 | pixi | 1.0.0 |
| 2026-09-10 | 54afd98f91 | Performance +docs | perf(memory): survey every encoding, and fix the two things the survey found | 16,565 | pixi | 1.0.0 |
| 2026-09-10 | 0bcc85d015 | Fix | fix(ci): run the drift check before the generators, not instead of them | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | bacb031baf | Fix +docs | fix(ci): green the standards job, and make the gate that let it through | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 8342c79ce3 | Docs | docs: link the Knap website from docs/ROADMAP.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | efdf05c43d | Docs | docs: link the Knap website from docs/PACKAGING.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 92853d574f | Docs | docs: link the Knap website from docs/CORRECTNESS.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 1bcee0c364 | Docs | docs: link the Knap website from docs/BENCHMARKS.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 0982d712a1 | Docs | docs: link the Knap website from docs/ARCHITECTURE.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | cc2617a765 | Docs | docs: link the Knap website from docs/API.md | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 4734f8c609 | Docs | docs: link the Knap website from the README | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | 899e0442aa | Feature +tests | feat(api): the helpers a caller would otherwise write, and write wrong | 16,461 | pixi | 1.0.0 |
| 2026-09-10 | eb910bb9a7 | Feature +tests +docs | feat(count): a counting entry point, a memory measurement, and a correction | 15,586 | pixi | 1.0.0 |
| 2026-09-09 | 304ec2c092 | Build and chores +docs | ci(badges): the full badge set, and the gate that went red under it | 14,851 | pixi | 1.0.0 |
| 2026-09-09 | 7405a02614 | Build and chores | chore: drop the executable bit from files that are not executed | 14,851 | pixi | 1.0.0 |
| 2026-09-09 | 04f50b66ba | Build and chores +docs | build(conda): prepare the package, up to but not including publishing | 14,851 | pixi | 1.0.0 |
| 2026-09-09 | eebb252a41 | Docs | docs: state the rs-bpe gap in the direction the arithmetic supports | 14,786 | pixi | 1.0.0 |
| 2026-09-09 | fa89bae14e | Docs | docs: re-baseline every remaining document on the 2026-09-09 run | 14,786 | pixi | 1.0.0 |
| 2026-09-09 | 8f17fd6aa9 | Performance +docs | perf(encode): make the merge path 1.4 to 1.9 times faster, output unchanged | 14,786 | pixi | 1.0.0 |
| 2026-09-09 | a7a45a73d6 | Feature +tests +docs | feat(encodings): ship the remaining five tiktoken encodings | 14,532 | pixi | 1.0.0 |
| 2026-09-09 | 0814805655 | Tests | test(fuzz): re-run twenty million inputs on the changed encode path | 12,894 | pixi | 1.0.0 |
| 2026-09-09 | fb45b7c0b0 | Build and chores | ci: generate the API reference alongside the other generated files | 12,894 | pixi | 1.0.0 |
| 2026-09-09 | 71003bfd65 | Docs | docs: record two claims that did not survive being measured | 12,894 | pixi | 1.0.0 |
| 2026-09-09 | d7bcacb321 | Docs | docs(api): generate a reference, and stop reading links inside code | 12,894 | pixi | 1.0.0 |
| 2026-09-09 | 6ec02ea191 | Performance | perf(encode): stop allocating per pre-token, and size the output | 12,894 | pixi | 1.0.0 |
| 2026-09-09 | b1d2ee2547 | Docs | docs: list the required checks by name, and say why extra approval is off | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | 82075426c4 | Build and chores | ci(deps): bump actions/upload-artifact from 4 to 7 (#3) | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | 45fc6d3df4 | Build and chores | ci(deps): bump actions/setup-python from 5 to 7 (#2) | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | ff3d7bdd76 | Build and chores | ci(deps): bump actions/checkout from 5 to 7 (#1) | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | 7f87cd73fb | Build and chores | ci: fix the include paths, and move the claims gate where it belongs | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | 64c1d6d437 | Docs | docs: describe the command line tool and six toolchain findings | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | cd59ada95f | Build and chores | ci: gate the command line tool, and ship it in the conda package | 12,775 | pixi | 1.0.0 |
| 2026-09-09 | f762cdb4d6 | Feature +tests | feat(cli): add a knap command for counting, encoding and decoding | 12,775 | pixi | 1.0.0 |
| 2026-09-08 | 9faff20ba4 | Docs | docs: correct how the branch protection is actually split | 11,449 | pixi | 1.0.0 |
| 2026-09-08 | 4c50132f06 | Docs | docs: describe what the branch protection on main enforces | 11,449 | pixi | 1.0.0 |
| 2026-09-08 | 00d0c794ee | Build and chores +docs | chore: declare version 1.0.0 | 11,449 | pixi | 1.0.0 |
| 2026-09-08 | 413264e6da | Docs | docs: add the missing root and community files | 11,449 | pixi | 1.0.0 |
| 2026-09-08 | b070918786 | Fix +tests | fix(docs): repair every docstring the gate rejects, and widen the gate | 11,449 | pixi | 1.0.0 |
| 2026-09-08 | 5dc05024f7 | Docs | docs(brand): give the exact size of each asset file | 11,422 | pixi | 1.0.0 |
The latest 50 of 75 commits; all of them are in the JSON.