HackerPapers

arXiv:2401.17377cs.CL

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

Jiacheng Liu, Sewon Min, Luke Zettlemoyer, Yejin Choi, Hannaneh Hajishirzi

Abstract

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.

arXiv comments
Published at COLM 2024, spotlight paper
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.AIArtificial Intelligence cs.IRInformation Retrieval

On Hacker News

Linked by 5 identifiable commenters in 7 comments across 6 threads, from Feb 2024 to Apr 2026. Found in 3 HN submissions from Feb 2024 to May 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments6 threads

    • You can build an unlimited-order Markov chain by, instead of pre-computing a table of counts for all possible contexts, using a substring-search index on the training data to count possible continuations on the fly: https://arxiv.org/abs/2401.17377 That paper uses suffix arrays…

      yorwbaView on HNParent context

    • > This is entirely different from saying it can only reproduce samples which it was trained on. It is not a memory machine that is surgically piecing together snippets of memorized samples. (That would be a mind bogglingly impressive machine!) You could create one of those using…

      astrangeView on HNParent context

    • The short and unsatisfying answer is that an LLM generation is a markov chain, except that instead of counting n-grams in order to generate the posterior distribution, the training process compresses the statistics into the LLM's weights. There was an interesting paper a while…

      shenbergView on HNParent context

    • If you're claiming a transformer model is a Markov chain, this is easily disprovable by, eg, asking the model why it isn't a Markov chain! But here is a really big one of those if you want it: https://arxiv.org/abs/2401.17377

      astrangeView on HNParent context

    • In this case, the curse of dimensionality is working in our favor, as the volume of an n-dimensional simplex also grows exponentially, so it is perfectly suited to hold the exponential state space of the mixed-state presentation. Updating from one mixed-state to another just…

      yorwbaView on HNParent context

    • Not 100M I guess, but this is fresh from today's arXiv: "Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens" https://arxiv.org/pdf/2401.17377.pdf

      Al-KhwarizmiView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.