Abstract
Maximizing next-token likelihood is the standard objective for language model pre-training, yet it suffers from high variance and inefficiency. We introduce CoCoNTs (Compact and Consistent Next Tokens), a method that pre-aggregates corpus-level $n$-gram statistics into a collapsed distribution. By supervising models with these compact distributions, we achieve faster convergence and improved model quality while bypassing the computational bottlenecks of traditional $n$-gram regularization.
The Noise of Next-Token Likelihood
Standard pre-training uses Next-Token Likelihood (NTL), where a model is trained to predict a single "gold" token found in the dataset. For example, given the prefix "The United," the dataset might provide "States." However, language is inherently stochastic; in a large corpus, "The United" could equally be followed by "Kingdom" or *"Nations."
Training on only one token at a time introduces high variance and "noise" into the gradient updates. While previous research explored using $n$-gram statistics as a regularizer (the "AllNTs" approach), these methods required slow, memory-intensive lookups in a prefix tree (trie) during training. This real-time querying stalls high-throughput hardware like GPUs and TPUs, making it impractical for large-scale pre-training.
Methods: The CoCoNTs Pipeline
CoCoNTs addresses these bottlenecks through a "pre-enrichment" strategy. Instead of querying statistics during training, the authors perform a one-time preprocessing step to build an $n$-gram trie and append the top-$r$ (e.g., $r=4$ or $8$) next-token distributions directly to the training data on disk.
The method relies on three core pillars:
- Compact Representation: Rather than storing a probability distribution over the entire vocabulary (often 50k+ tokens), CoCoNTs only stores the most frequent followers. This significantly reduces storage and I/O overhead.
- Statistical Consistency: The authors use a novel mathematical formulation to redistribute probability mass. This ensures that, in expectation, the compact distribution aligns with the full $n$-gram distribution, maintaining "consistency" across training mini-batches even with truncated data.
- Hybrid Training Objective: The model is trained using a mixture of standard cross-entropy (for long-range dependencies) and KL-divergence against the stored CoCoNTs distributions (for short-range $n$-gram patterns).
Key Insights: Why It Works
The success of CoCoNTs stems from a few counter-intuitive observations. First, Consistency > Completeness: a model doesn't need the full vocabulary distribution to stabilize training. A "collapsed" distribution that captures the most frequent followers—while mathematically accounting for the "tail" of the distribution—is sufficient to reduce gradient variance.
Second, the authors embrace a "Disk is Cheap" philosophy. By moving the complexity from "compute-time lookups" to "one-time storage," they bypass the CPU-GPU communication bottleneck. Finally, they found that Short-Range Supervision leads to Long-Range Gains. Even though $n$-gram statistics are only reliable for short prefixes (e.g., $k=8$), supervising the start of a sequence improves the model's performance across the entire sequence length due to the shared nature of transformer parameters.
Key Results and Efficiency
Empirical evaluations across WikiText-103, MiniPile, and PubMed-Abstracts demonstrate that CoCoNTs reaches baseline perplexity in approximately 50% fewer optimization steps. The method consistently achieved lower perplexity and better accuracy across various architectures, including GPT-2, GPT-Neo, and OPT models up to 1.3B parameters.
Unlike AllNTs, which suffers from Out-of-Memory (OOM) errors and high latency on large datasets, CoCoNTs maintains a low wall-clock time and memory footprint. As shown in the performance metrics, CoCoNTs scales gracefully with prefix length $k$, whereas traditional methods quickly become computationally prohibitive.
Conclusion
CoCoNTs provides a scalable path for incorporating corpus-level statistics into LLM pre-training. By reducing gradient variance through consistent, compact distributions, it enables more efficient training and better domain adaptation, particularly in data-rich environments where traditional regularization fails to scale. Future work remains to explore its behavior on "frontier" scale models (70B+ parameters) and its potential for mitigating training data biases.
Summary updated