Canonical Autoregressive Generation

Ivi Chatzi, Nina Corvelo Benz, Stratis Tsirtsis, Manuel Gomez-Rodriguez
6/6/2025
cs.CLcs.AIcs.LG

No official code found. Best implementation: Human-Centric-Machine-Learning/Tokenization-Multiplicity (3 stars, MIT, last commit 2026-03-17).

Abstract

State of the art large language models are trained using large amounts of tokens derived from raw text using what is called a tokenizer. Crucially, the tokenizer determines the (token) vocabulary a model will use during inference as well as, in principle, the (token) language. This is because, while the token vocabulary may allow for different tokenizations of a string, the tokenizer always maps the string to only one of these tokenizations--the canonical tokenization. However, multiple lines of empirical evidence suggest that large language models do not always generate canonical token sequences, and this comes with several negative consequences. In this work, we first show that, to generate a canonical token sequence, a model needs to generate (partial) canonical token sequences at each step of the autoregressive generation process underpinning its functioning. Building upon this theoretical result, we introduce canonical sampling, a simple and efficient sampling method that precludes a given model from generating non-canonical token sequences. Further, we also show that, in comparison with standard sampling, the distribution of token sequences generated using canonical sampling is provably closer to the true distribution of token sequences used during training.

View on arXivView PDF

Code Implementations(1)

MIT

This repository contains the code and data for the paper "Tokenization Multiplicity Leads to Arbitrary Price Variation in LLM-as-a-service"

30Shell, PythonJan 30, 20267 months agoMIT

Cite this paper

@article{chatzi2025canonical,
  title  = {Canonical Autoregressive Generation},
  author = {Ivi Chatzi and Nina Corvelo Benz and Stratis Tsirtsis and Manuel Gomez-Rodriguez},
  year   = {2025},
  eprint = {2506.06446},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.06446v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.06446.svg)](https://codeofpaper.com/paper/2506.06446)

Discussion