Saved in:
Bibliographic Details
Main Authors: Phan, Buu, Havasi, Marton, Muckley, Matthew, Ullrich, Karen
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2406.16829
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910515541835776
author Phan, Buu
Havasi, Marton
Muckley, Matthew
Ullrich, Karen
author_facet Phan, Buu
Havasi, Marton
Muckley, Matthew
Ullrich, Karen
contents State-of-the-art language models are autoregressive and operate on subword units known as tokens. Specifically, one must encode the conditioning string into a list of tokens before passing to the language models for next-token prediction. We show that popular encoding schemes, such as maximum prefix encoding (MPE) and byte-pair-encoding (BPE), induce a sampling bias that cannot be mitigated with more training or data. To counter this universal problem, for each encoding scheme above, we propose a novel algorithm to obtain unbiased estimates from any language model trained on tokenized data. Our methods do not require finetuning the model, and the complexity, defined as the number of model runs, scales linearly with the sequence length in the case of MPE. As a result, we show that one can simulate token-free behavior from a tokenized language model. We empirically verify the correctness of our method through a Markov-chain setup, where it accurately recovers the transition probabilities, as opposed to the conventional method of directly prompting tokens into the language model.
format Preprint
id arxiv_https___arxiv_org_abs_2406_16829
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Understanding and Mitigating Tokenization Bias in Language Models
Phan, Buu
Havasi, Marton
Muckley, Matthew
Ullrich, Karen
Computation and Language
Artificial Intelligence
Machine Learning
State-of-the-art language models are autoregressive and operate on subword units known as tokens. Specifically, one must encode the conditioning string into a list of tokens before passing to the language models for next-token prediction. We show that popular encoding schemes, such as maximum prefix encoding (MPE) and byte-pair-encoding (BPE), induce a sampling bias that cannot be mitigated with more training or data. To counter this universal problem, for each encoding scheme above, we propose a novel algorithm to obtain unbiased estimates from any language model trained on tokenized data. Our methods do not require finetuning the model, and the complexity, defined as the number of model runs, scales linearly with the sequence length in the case of MPE. As a result, we show that one can simulate token-free behavior from a tokenized language model. We empirically verify the correctness of our method through a Markov-chain setup, where it accurately recovers the transition probabilities, as opposed to the conventional method of directly prompting tokens into the language model.
title Understanding and Mitigating Tokenization Bias in Language Models
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2406.16829