HackerTrans
TopNewTrendsCommentsPastAskShowJobs

matthewolfe

no profile record

Submissions

Timeline of Computer History

computerhistory.org
3 points·by matthewolfe·قبل شهرين·1 comments

Hammock Driven Development – Rich Hickey [video]

youtube.com
3 points·by matthewolfe·قبل 10 أشهر·0 comments

LLM-Generated Rules Engines for LLM Explainability

brain.co
2 points·by matthewolfe·قبل 10 أشهر·0 comments

Wormhole for Perplexity Comet

blog.gingerbeardman.com
3 points·by matthewolfe·قبل 11 شهرًا·1 comments

Assign Tickets to Claude Code

twitter.com
1 points·by matthewolfe·قبل 11 شهرًا·0 comments

Richard Feynman: What I cannot create, I do not understand

freshspectrum.com
1 points·by matthewolfe·قبل 12 شهرًا·0 comments

The Factorio Mindset

thediff.co
2 points·by matthewolfe·قبل 12 شهرًا·0 comments

Show HN: TokenDagger – A tokenizer faster than OpenAI's Tiktoken

github.com
281 points·by matthewolfe·السنة الماضية·73 comments

From Punched Cards to Flat Screens – A Technical Autobiography

drive.google.com
1 points·by matthewolfe·السنة الماضية·0 comments

Idea to Revenue in 4 Days

sigurg.com
1 points·by matthewolfe·السنة الماضية·0 comments

Apache Flink 2.0.0

flink.apache.org
2 points·by matthewolfe·السنة الماضية·0 comments

The Turing Completeness of PowerPoint [video]

youtube.com
3 points·by matthewolfe·السنة الماضية·0 comments

comments

matthewolfe
·قبل 10 أشهر·discuss
What exactly doesn't "just work" anymore?
matthewolfe
·قبل 12 شهرًا·discuss
I believe SchemeFlow [0] is working on solving some of these problem, particularly with the insane reporting requirements. But of course, that still leaves the unions...

[0] https://www.schemeflow.com/
matthewolfe
·السنة الماضية·discuss
For argument's sake, suppose we live in a world where many high-quality models can be run on-device. Is there any concern from companies/model developers about exposing their proprietary weights to the end user? It's generally not difficult to intercept traffic (weights) sent to and app, or just reverse the app itself.
matthewolfe
·السنة الماضية·discuss
To echo the other replies, the tokenizer is definitely not the bottleneck. It just happens to be the first step in inference, so it's what I did first.
matthewolfe
·السنة الماضية·discuss
haha, I thought about it.
matthewolfe
·السنة الماضية·discuss
Fair chance I'm remembering it wrong :D
matthewolfe
·السنة الماضية·discuss
Alright, 0.1.1 should now be a true drop-in replacement. I'll write up some examples soon.
matthewolfe
·السنة الماضية·discuss
Should be the same. Both use Byte-Pair Encoding (BPE) as underlying algo.
matthewolfe
·السنة الماضية·discuss
Ah good catch. Updating this right now.
matthewolfe
·السنة الماضية·discuss
Modal's GPU glossary is a good overview about how GPUs work [0]. Karpathy's LLM overview is a good high level overview on LLMs [1]. 3b1b's video (and subsequent videos) on transformers was excellent at helping me understand the math at a high level [2]. This matrix multiplication optimization worklog helped me understand writing better CUDA (not for beginner intro though) [3].

During this process I also asked ChatGPT a lot of questions.

I'm definitely open to suggestions about "how to learn" with all the new tools we have. I felt this has not been straightforward to figure out.

[0] https://modal.com/gpu-glossary

[1] https://www.youtube.com/watch?v=7xTGNNLPyMI

[2] https://www.youtube.com/watch?v=wjZofJX0v4M

[3] https://siboehm.com/articles/22/CUDA-MMM
matthewolfe
·السنة الماضية·discuss
I'm working on incremental re-tokenizing next. Then I'll run some benchmarks against this crate too.
matthewolfe
·السنة الماضية·discuss
Agreed. A former mentor of mine told me a nice way of viewing software development:

1. Make it work. 2. Make it fast. 3. Make it pretty.

Transformers & LLMs have been developed to a point where they work quite well. I feel as though we're at a stage where most substantial progress is being made on the performance side.
matthewolfe
·السنة الماضية·discuss
Cool!

I've reached out to the guy who maintains Tiktoken to talk about this.
matthewolfe
·السنة الماضية·discuss
A lot of model-specific tokenizers have reference implementations ([0], [1]). Underlying them is a core algorithm like SentencePiece or Byte-pair encoding (BPE). Tiktoken and TokenDagger are BPE implementations. The wrapping "tokenizer" mostly deals with the quirks of the vocabulary and handling special tokens.

For this project, I think there is value in building some of these model-specific quirks into the library. Could see some minor performance gains and generally make it easier to integrate with. It's probably not too much work to keep up with newer models. Tokenizers change much less frequently.

[0] https://github.com/meta-llama/llama-models/blob/01dc8ce46fec...

[1] https://github.com/mistralai/mistral-common/tree/main/src/mi...
matthewolfe
·السنة الماضية·discuss
I probably will. Was hesitant initially, because adding PCRE2 as a dependency might cause issues to existing projects. I believe this was discussed briefly in a closed PR with other performance improvements.
matthewolfe
·السنة الماضية·discuss
The output should be identical, assuming no bugs.

The Tiktoken implementation takes a collection of all special tokens upon initialization and compiles them into a regex by joining them with `|` [0]. Then the actual encoding process checks for matches on this expression.

Models like Llama 4 define a list of 1,135 special tokens. Notably, 1,115 of those are "reserved" special tokens! So this yields a huge regexp of special tokens that shouldn't be considered at all.

TokenDagger does not do this. Instead, simple string matching is used. This works because we don't need to consider the entire special vocabulary every time. The caller of `encode` must explicitly define which special tokens should be considered [1]. So it's faster to check against the much smaller list we _know_ is being used.

[0] https://github.com/openai/tiktoken/blob/main/src/lib.rs#L476

[1] https://github.com/openai/tiktoken/blob/main/tiktoken/core.p...
matthewolfe
·السنة الماضية·discuss
Thanks, I clarified it.
matthewolfe
·السنة الماضية·discuss
Agreed. I figured nobody would use it otherwise.
matthewolfe
·السنة الماضية·discuss
I'm working on TokenDagger [0] a high performance implementation of OpenAI's Tiktoken. My benchmarks are showing 2-3x higher throughput, as well as ~4x faster tokenization for code samples on a single thread.

[0] https://github.com/M4THYOU/TokenDagger
matthewolfe
·قبل سنتين·discuss
I do this a lot for my work. A tool like this that can help get me to a nice starting point is huge. Instead of developing a mental model of the API in my head by manually looking through API requests/responses in ProxyMan, this can start me off much more quickly. From there, the edge cases can be worked out.