The COUNT: Counting N-grams Unlocks Scaling on Host Memory and Training-Free Adaptation
cs.CL, cs.LG
Submitted: 2026-10-14
Updated: 2026-10-14
Code: https://github.com/IanMagnusson/COUNT
License: http://creativecommons.org/licenses/by/4.0/
The gist: 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.
Terminology
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.
Sources
- Program Synthesis with Large Language Models
- Improving language models by retrieving from trillions of tokens
- Evaluating Large Language Models Trained on Code
- Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge
- MeKi: Memory-based Expert Knowledge Injection for Efficient LLM Scaling
- Measuring Massive Multitask Language Understanding
- Measuring Mathematical Problem Solving With the MATH Dataset
- Scaling Laws for Neural Language Models
- LAB-Bench: Measuring Capabilities of Language Models for Biology Research
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- Scaling Embeddings Outperforms Scaling Experts in Language Models
- Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens
- DataDecide: How to Predict Best Pretraining Data with Small Experiments
- Olmo 3
- MedMCQA : A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering
- NGM: A Plug-and-Play Training-Free Memory Module for LLMs
- N-Grammer: Augmenting Transformers with latent n-grams
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer
- Organize the Web: Constructing Domains Enhances Pre-Training Data Curation
- Tensorizing Engram: Sharing Latents Across N-Gram Embeddings is Beneficial in LLMs
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering