Reconstructing Closed-Source Tokenizers via Two Oracles

bayes-song · reddit · 2026-07-11

The author poses a question about reverse-engineering closed-source LLM tokenizers: If you can only obtain two oracles from the chat API—

The first is easy to obtain, while the purpose of the second is to resolve merge order ambiguity, such as distinguishing between (a, bc) and (ab, c). The author suggests that this prefix oracle could be constructed from a standard chat interface by leveraging the model's ability to controllably repeat text within a conversation.

Finally, the core question is raised: Relying solely on these two oracles, is it possible to reconstruct an equivalent tokenizer that matches the token boundaries of the original tokenizer on any arbitrary input (allowing for token ID remapping)?

Original post →

More from Research

Research channel →