The COUNT: Counting N-grams Unlocks Scaling on Host Memory and Training-Free Adaptation

Ian Magnusson, Noah A. Smith, Pang Wei Koh
10/14/2026
cs.CLcs.LG

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

The scaling relationship of compute and performance for language models (LMs) has been extensively studied; more recently, models are being designed to scale memory use, as well. In particular, adding embeddings for n-grams scales memory separately from compute use, because each pass only processes individual embedding rows, which are much smaller than the storage used for the whole embedding table. However, existing methods train embeddings from scratch, which needs expensive GPU memory for fast reading and writing. Meanwhile, the ordinary memory of the host system is cheap and underutilized by these training methods. To scale on host memory, we introduce COUNT (Counting Offline Unlocks N-gram Transformers), which builds n-gram embeddings without adding learned parameters by storing precomputed n-gram counts on host. We use the corpus frequencies to weight together the LM's own unembeddings of the next tokens most often following the current n-gram history. At a fixed compute budget, COUNT can be added as an additional input embedding for pretraining 1B-parameter LMs to improve validation loss as much as an LM with 57% more compute. If GPU memory is limited, using COUNT to let backbone parameters fill GPU memory gives better performance than splitting memory with additional learned n-gram embeddings. Beyond efficiency, COUNT allows switching in a different table of n-gram counts from a domain-specific corpus at inference time to adapt to a new task without any training.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{magnusson2026count,
  title  = {The COUNT: Counting N-grams Unlocks Scaling on Host Memory and Training-Free Adaptation},
  author = {Ian Magnusson and Noah A. Smith and Pang Wei Koh},
  year   = {2026},
  eprint = {2610.20456},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.20456v1}
}

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

Discussion