Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liu, Jiacheng, Min, Sewon, Zettlemoyer, Luke, Choi, Yejin, Hajishirzi, Hannaneh
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908303149236224
author Liu, Jiacheng
Min, Sewon
Zettlemoyer, Luke
Choi, Yejin
Hajishirzi, Hannaneh
author_facet Liu, Jiacheng
Min, Sewon
Zettlemoyer, Luke
Choi, Yejin
Hajishirzi, Hannaneh
contents Are $n$-gram language models still relevant in this era of neural large language models (LLMs)? Our answer is yes, and we showcase their values in both text analysis and improving neural LLMs. This was done by modernizing $n$-gram LMs in two aspects. First, we train them at the same data scale as neural LLMs -- 5 trillion tokens. This is the largest $n$-gram LM ever built. Second, existing $n$-gram LMs use small $n$ which hinders their performance; we instead allow $n$ to be arbitrarily large, by introducing a new $\infty$-gram LM with backoff. Instead of pre-computing $n$-gram count tables (which would be very expensive), we develop an engine named infini-gram -- powered by suffix arrays -- that can compute $\infty$-gram (as well as $n$-gram with arbitrary $n$) probabilities with millisecond-level latency. The $\infty$-gram framework and infini-gram engine enable us to conduct many novel and interesting analyses of human-written and machine-generated text: we find that the $\infty$-gram LM has fairly high accuracy for next-token prediction (47%), and can complement neural LLMs to greatly reduce their perplexity. When analyzing machine-generated text, we also observe irregularities in the machine--$\infty$-gram agreement level with respect to the suffix length, which indicates deficiencies in neural LLM pretraining and the positional embeddings of Transformers.
format Preprint
id arxiv_https___arxiv_org_abs_2401_17377
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens
Liu, Jiacheng
Min, Sewon
Zettlemoyer, Luke
Choi, Yejin
Hajishirzi, Hannaneh
Computation and Language
Artificial Intelligence
Information Retrieval
Are $n$-gram language models still relevant in this era of neural large language models (LLMs)? Our answer is yes, and we showcase their values in both text analysis and improving neural LLMs. This was done by modernizing $n$-gram LMs in two aspects. First, we train them at the same data scale as neural LLMs -- 5 trillion tokens. This is the largest $n$-gram LM ever built. Second, existing $n$-gram LMs use small $n$ which hinders their performance; we instead allow $n$ to be arbitrarily large, by introducing a new $\infty$-gram LM with backoff. Instead of pre-computing $n$-gram count tables (which would be very expensive), we develop an engine named infini-gram -- powered by suffix arrays -- that can compute $\infty$-gram (as well as $n$-gram with arbitrary $n$) probabilities with millisecond-level latency. The $\infty$-gram framework and infini-gram engine enable us to conduct many novel and interesting analyses of human-written and machine-generated text: we find that the $\infty$-gram LM has fairly high accuracy for next-token prediction (47%), and can complement neural LLMs to greatly reduce their perplexity. When analyzing machine-generated text, we also observe irregularities in the machine--$\infty$-gram agreement level with respect to the suffix length, which indicates deficiencies in neural LLM pretraining and the positional embeddings of Transformers.
title Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens
topic Computation and Language
Artificial Intelligence
Information Retrieval
url https://arxiv.org/abs/2401.17377