Infini-gram: Scaling Unbounded N-gram Language Models

17/09/2025 19 min

Listen "Infini-gram: Scaling Unbounded N-gram Language Models"

Episode Synopsis

This April 2025 paper introduces Infini-gram, a novel engine designed to scale n-gram language models to an unprecedented 5 trillion tokens and support unbounded n (∞-gram LMs). Unlike traditional methods that rely on pre-computed count tables, Infini-gram leverages suffix arrays for efficient, low-latency calculation of n-gram and ∞-gram probabilities, even for extremely long contexts. The authors demonstrate that this modernized approach significantly improves the perplexity of neural Large Language Models (LLMs), by up to 73%, by offering complementary insights into human-written and machine-generated text. Beyond enhancing LLMs, the Infini-gram engine also enables various applications such as corpus analysis, data curation, document retrieval, and detection of data contamination. A public web interface, API endpoint, and source code are provided to encourage further exploration and development within the community.Source:https://arxiv.org/pdf/2401.17377