Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

very_useless_tokenizer 🪦

"I built a tokenizer to learn how tokenizers work. It works. That is the only nice thing I can say about it."

A fully functional, from-scratch tokenizer built for one purpose and one purpose only: learning. Not speed. Not accuracy. Not usability. Just vibes and vocabulary lists.

If you were looking for tiktoken, sentencepiece, or literally any tokenizer maintained by people who know what they're doing — this is not that. Turn back now.


Why does this exist?

Because at some point I stared at a wall of subword tokens and thought "I bet I could build that." I could not, in fact, build that — not well, anyway. But I built a version of that, and along the way I actually learned how the real ones work. So mission technically accomplished, dignity technically lost.

Features

  • ✅ Splits text into tokens (the bar was on the floor and I still tripped over it)
  • ✅ Implements basic → intermediate tokenization concepts (whitespace splitting, BPE-ish merging, vocab building)
  • ✅ Fully documented, mostly for my own sanity
  • ✅ Zero (0) production use cases
  • ✅ Guaranteed to be slower than whatever you're currently using
  • ❌ Not optimized
  • ❌ Not benchmarked against anything real
  • ❌ Not something you should put anywhere near a real ML pipeline

Learning Journey

This repo is basically a diary of me going:

  1. "Tokenization is just splitting on spaces, right?" (wrong)
  2. "Okay it's about subwords." (closer)
  3. "Byte-Pair Encoding... I understand 60% of this." (progress!)
  4. "I built my own BPE merge logic and it kind of works?!" (victory lap)
  5. "...it is still useless." (acceptance)

Installation

git clone https://github.com/yourusername/very_useless_tokenizer.git
cd very_useless_tokenizer
# congrats, you now have a tokenizer you will never use in production

Usage

from very_useless_tokenizer import Tokenizer

tokenizer = Tokenizer()
tokens = tokenizer.encode("why did I build this")
print(tokens)
# output: proof that learning happened, utility did not

📊 Benchmarks

Tokenizer Speed Accuracy Should you use it
tiktoken ⚡⚡⚡⚡⚡ ✅✅✅✅✅ Yes
SentencePiece ⚡⚡⚡⚡ ✅✅✅✅✅ Yes
very_useless_tokenizer 🐌 🤷 Absolutely not

What I Actually Learned

  • How BPE merges work under the hood
  • Why vocab size vs. sequence length is a real tradeoff and not just a config number I copy-pasted
  • Why professional tokenizers are written in Rust and mine is not
  • Humility

What This Is Not

  • Fast
  • Correct in every edge case
  • A replacement for anything
  • A cry for help (it is a little bit a cry for help)

Contributing

If you'd like to contribute, first ask yourself why. Then, if you still want to, PRs are welcome — bonus points if you can make it more educational without making it less useless.

License

MIT — do whatever you want with it, I certainly won't be held responsible.


Built with love, confusion, and an unreasonable number of print statements.

About

very_useless_tokenizer: proof that you can understand something deeply and still build something nobody should ever import.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages