lexer-vs-llm-tokenization

IN premiseentries/2026/06/21/wiki-Tokenization_lexical_analysis-chunk-1.md

Created 2026-06-21T09:50:10+00:00

Lexical tokenization (compiler) differs from LLM tokenization in two ways: it is rule-based using lexical grammars rather than probability-based (e.g., BPE), and it does not convert tokens to numerical embeddings.

Summary

A compiler's tokenizer splits code into named symbols using explicit, deterministic rules and leaves them as text labels, never converting them to numbers. This matters because it means compiler pipelines and LLM pipelines work with fundamentally different kinds of tokens, and treating one as a drop-in replacement for the other will break assumptions about determinism, syntax structure, and how downstream stages consume the output.

Dependents

These beliefs depend on this one: