Sampling from Your Language Model One Byte at a Time

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Hayase, Jonathan, Liu, Alisa, Smith, Noah A., Oh, Sewoong
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915984987652096
author Hayase, Jonathan
Liu, Alisa
Smith, Noah A.
Oh, Sewoong
author_facet Hayase, Jonathan
Liu, Alisa
Smith, Noah A.
Oh, Sewoong
contents Tokenization is used almost universally by modern language models, enabling efficient text representation using multi-byte or multi-character tokens. However, prior work has shown that tokenization can introduce distortion into the model's generations, an issue known as the Prompt Boundary Problem (PBP). For example, users are often advised not to end their prompts with a space because it prevents the model from including the space as part of the next token. While this heuristic is effective in English, the underlying PBP continues to affect code generation and languages such as Chinese, where tokens often do not line up with word and syntactic boundaries. In this work, we present an inference-time method to convert any autoregressive LM with a BPE tokenizer into a character-level or byte-level LM. Our method efficiently solves the PBP and is also able to unify the vocabularies of language models with different tokenizers, allowing one to ensemble LMs with different tokenizers at inference time or transfer the post-training from one model to another using proxy-tuning. Code is available at https://github.com/SewoongLab/byte-sampler .
format Preprint
id arxiv_https___arxiv_org_abs_2506_14123
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Sampling from Your Language Model One Byte at a Time
Hayase, Jonathan
Liu, Alisa
Smith, Noah A.
Oh, Sewoong
Computation and Language
Formal Languages and Automata Theory
Machine Learning
Tokenization is used almost universally by modern language models, enabling efficient text representation using multi-byte or multi-character tokens. However, prior work has shown that tokenization can introduce distortion into the model's generations, an issue known as the Prompt Boundary Problem (PBP). For example, users are often advised not to end their prompts with a space because it prevents the model from including the space as part of the next token. While this heuristic is effective in English, the underlying PBP continues to affect code generation and languages such as Chinese, where tokens often do not line up with word and syntactic boundaries. In this work, we present an inference-time method to convert any autoregressive LM with a BPE tokenizer into a character-level or byte-level LM. Our method efficiently solves the PBP and is also able to unify the vocabularies of language models with different tokenizers, allowing one to ensemble LMs with different tokenizers at inference time or transfer the post-training from one model to another using proxy-tuning. Code is available at https://github.com/SewoongLab/byte-sampler .
title Sampling from Your Language Model One Byte at a Time
topic Computation and Language
Formal Languages and Automata Theory
Machine Learning
url https://arxiv.org/abs/2506.14123