Should you marginalize over possible tokenizations?

Nadezhda Chirkova, Germán Kruszewski, Jos Rozen, Marc Dymetman
6/30/2023
cs.CL

No official code found. Best implementation: naver/marginalization (10 stars, last commit 2023-07-06).

Abstract

Autoregressive language models (LMs) map token sequences to probabilities. The usual practice for computing the probability of any character string (e.g. English sentences) is to first transform it into a sequence of tokens that is scored by the model. However, there are exponentially many token sequences that represent any given string. To truly compute the probability of a string one should marginalize over all tokenizations, which is typically intractable. Here, we analyze whether the practice of ignoring the marginalization is justified. To this end, we devise an importance-sampling-based algorithm that allows us to compute estimates of the marginal probabilities and compare them to the default procedure in a range of state-of-the-art models and datasets. Our results show that the gap in log-likelihood is no larger than 0.5% in most cases, but that it becomes more pronounced for data with long complex words.

View on arXivView PDF

Code Implementations(1)

Source code for the ACL'23 paper "Should you marginalize over possible tokenizations?"

101PythonJun 13, 20233 years agoNOASSERTION

Similar Papers

Cite this paper

@article{chirkova2023should,
  title  = {Should you marginalize over possible tokenizations?},
  author = {Nadezhda Chirkova and Germán Kruszewski and Jos Rozen and Marc Dymetman},
  year   = {2023},
  eprint = {2306.17757},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2306.17757v1}
}

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/2306.17757.svg)](https://codeofpaper.com/paper/2306.17757)

Discussion