Efficient Training of Language Models with Compact and Consistent Next Token Distributions

Ashutosh Sathe, Sunita Sarawagi · DOI

Introduction

The standard paradigm for training Large Language Models (LLMs) relies on Next-Token Likelihood (NTL). In this framework, a model is tasked with predicting a single ground-truth token following a given prefix. However, natural language is inherently stochastic; a prefix like "The United" could be followed by "States," "Kingdom," or "Nations" with varying degrees of probability. By supervising the model with only one of these outcomes at a time, NTL introduces significant variance into the training process, potentially slowing convergence and leading to suboptimal representations.

While previous research has suggested using corpus-level $n$-gram statistics as "soft" targets to mitigate this noise, the computational overhead of querying $n$-gram models during training has historically made this approach impractical for large-scale datasets. This paper introduces CoCoNTs (Compact and Consistent Next Tokens), a method designed to make $n$-gram supervision both scalable and efficient.

The CoCoNTs Methodology

CoCoNTs bridges the gap between the theoretical benefits of $n$-gram supervision and the practical requirements of modern LLM training through three primary innovations:

1. Truncation and Approximation

Storing a full probability distribution over a massive vocabulary (often exceeding 50,000 tokens) for every prefix is storage-prohibitive. CoCoNTs addresses this by retaining only the top-$r$ most frequent next tokens (e.g., $r=8$). This significantly reduces the storage footprint while capturing the most critical statistical signals.

2. Statistical Consistency

A naive truncation of the distribution would ignore "rare" tokens, potentially biasing the model. To maintain statistical consistency, the authors employ a mathematical redistribution technique. By "stealing" a small amount of probability mass from the top-$r$ tokens and redistributing it to the remainder of the vocabulary, the supervision signal remains consistent with the true corpus-level distribution in expectation.

3. Pre-enrichment and Scalability

To eliminate the bottleneck of database lookups during the training loop, CoCoNTs utilizes a one-time preprocessing step. The researchers build a prefix tree (trie) to calculate $n$-gram statistics and "enrich" the dataset by storing these compact distributions directly on disk alongside the text. Consequently, during training, the model reads the text and its corresponding soft targets in a single I/O operation, allowing the training to proceed at full speed on high-performance hardware like GPUs and TPUs.

Experimental Evaluation

The efficacy of CoCoNTs was evaluated across a diverse set of benchmarks and architectures:

  • WikiText-103: A standard medium-sized dataset (~114M tokens).
  • MiniPile: A diverse 1.6B token dataset.
  • PubMed-Abstracts: A specialized domain dataset (~2.6B tokens) used to test domain adaptation.
  • BabyLM Challenge: A 100M word dataset focused on sample-efficient pre-training.

The researchers tested CoCoNTs across multiple model families, including GPT-2, GPT-Neo, and OPT, ranging up to 1.3B parameters.

Key Results

Training Efficiency

The most striking result of the CoCoNTs framework is its impact on convergence speed. Models trained with CoCoNTs reached the same validation perplexity as standard NTL baselines in approximately 50% fewer optimization steps. This suggests that the reduced variance provided by soft targets allows the model to learn the underlying structure of the language much more efficiently.

Model Performance

Beyond speed, CoCoNTs consistently improved final model quality. On the WikiText-103 benchmark, an OPT-1.3B model saw its perplexity improve from 16.55 to 15.68. These gains were consistent across different architectures, demonstrating the robustness of the method.

Generation Quality and Diversity

Language models often suffer from repetitive or "robotic" generation when using greedy decoding. CoCoNTs-trained models exhibited significantly higher diversity scores and a greater number of unique $n$-grams in generated text. This indicates that the $n$-gram supervision helps the model capture the natural variety of human language more effectively than single-token supervision.

Scalability

Unlike previous $n$-gram-based methods that struggled with memory limits on larger datasets, CoCoNTs demonstrated excellent scalability. It successfully handled the 2.6B token PubMed dataset with constant-size storage overhead, proving its viability for large-scale pre-training.

Limitations and Future Directions

While CoCoNTs offers substantial benefits, it introduces a significant one-time preprocessing cost to build the $n$-gram trie and enrich the dataset. Additionally, the method is sensitive to data sharding; if shards are too small, the $n$-gram statistics may become sparse. There is also a risk that the model might more aggressively inherit social biases present in the corpus-level $n$-gram frequencies.

Future work involves optimizing trie libraries for even larger datasets (such as "The Pile") and investigating the intersection of $n$-gram supervision and algorithmic bias.

Conclusion

CoCoNTs represents a significant step forward in making distributional supervision practical for LLM training. By combining compact representations with efficient pre-computation, it offers a path toward faster, more robust, and higher-quality language models without the computational bottlenecks of traditional $n$-gram approaches.

Summary updated

BibTeX
@inproceedings{sathe2024efficient,
  author = {Ashutosh Sathe and Sunita Sarawagi},
  title = {{Efficient Training of Language Models with Compact and Consistent Next Token Distributions}},
  booktitle = {ES-FoMo-II @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=SkoI6lSaQL},
}
Figure