Chunk-Distilled Language Modeling

Yanhong Li, Karen Livescu, Jiawei Zhou

TL;DR

Chunk-Distilled Language Modeling (CD-LM) is a training-free inference method that allows large language models (LLMs) to generate multi-token "chunks" of text in a single step via retrieval. By caching and retrieving high-probability phrases or expert-curated facts, CD-LM simultaneously speeds up text generation and injects new knowledge or domain expertise into the model.

The Challenge: Inefficient and Static LLMs

Modern LLMs face two fundamental challenges:

  1. Inefficiency: They generate text autoregressively—one single token at a time—which is computationally expensive.
  2. Static Knowledge: Once trained, updating their internal knowledge requires expensive fine-tuning.

Existing solutions usually only solve one of these problems at a time. Speculative decoding speeds up inference by drafting multiple tokens with a smaller model, but it doesn't improve the model's actual knowledge. Conversely, Retrieval-Augmented Generation (RAG) or kNN-LMs allow models to access external knowledge, but they typically operate at the token level, adding massive computational overhead and slowing down generation. CD-LM introduces a method to achieve the best of both worlds: faster inference and dynamic knowledge adaptation.

Methods: The CD-LM Pipeline

The authors propose CD-LM, which interleaves standard token-by-token generation with multi-token chunk retrieval.

The CD-LM pipeline illustrating chunk extraction, Trie datastore construction, and inference.

The process involves three main steps:

  1. Chunk Datastore Construction: The system first identifies useful multi-token chunks from a text corpus. These chunks are stored in a highly efficient Trie (prefix tree) structure. Crucially, chunks are indexed by an entry token (the token immediately preceding the chunk in the text).
  2. Adaptive Retrieval: During generation, the LLM uses its current hidden state (context vector) to query the datastore. To keep this lightning-fast, the search is restricted only to the Trie associated with the current entry token.
  3. Chunk Generation: If a retrieved chunk's context closely matches the current generation context (passing a similarity threshold), the model accepts the entire chunk. It outputs the multi-token sequence instantly, skipping the expensive forward passes for those tokens.

The authors deploy CD-LM in three distinct flavors:

  • Knowledge Distillation (KCD-LM): Chunks are extracted from a larger, more powerful "teacher" model to improve a smaller "base" model.
  • Self Distillation (SCD-LM): Chunks are extracted from the base model itself, acting as a self-memory cache to speed up repetitive generations.
  • Expert Distillation (ECD-LM): Chunks are curated from non-parametric human data (like Wikipedia hyperlinks or private databases) to inject factual or private knowledge.

Key Insights and Ideas

LLMs naturally memorize in chunks: The authors observed that well-trained LLMs exhibit "plateaus of high probability" over specific multi-token sequences (like named entities, common phrases, or famous quotes). CD-LM exploits this by treating these memorized sequences as atomic units.

Token probability plateaus demonstrating how LLMs memorize multi-token chunks.

Entry-token indexing is a massive efficiency hack: Standard kNN-LMs search over billions of tokens at every step. By restricting the search space to chunks that follow the exact same entry token, CD-LM prunes the search space to just 0.002%–0.011% of the datastore, making retrieval highly scalable.

Hard decisions beat soft mixing: Unlike kNN-LM, which softly interpolates retrieval probabilities with model probabilities at every token, CD-LM makes a hard decision to accept a multi-token chunk. This is what allows it to actually skip forward passes and save compute time.

Key Results

  • Better Language Modeling (KCD-LM): Using a 1.5B parameter teacher to guide a 137M parameter GPT-2 base model, perplexity on WikiText dropped drastically from 34.83 to 22.90. It outperformed existing kNN-LM baselines while requiring a datastore only 30-40% of the size. Generation quality (MAUVE score) improved by 50% to 162% across domains.
  • Faster Inference (SCD-LM): When acting as a self-memory cache on MT-Bench, CD-LM saved up to ~19.6% in token generation time and skipped ~43.3% of forward passes for GPT-2-XL. LLaMA-2-7B saw a ~15% speedup and ~32% forward pass reduction.
  • Effective Knowledge Injection (ECD-LM): When tasked with answering questions using private PII, a base GPT-2-XL model had 0% accuracy. Standard In-Context Learning raised this to 46.4%. ECD-LM achieved 75.7% accuracy, proving it can effectively inject external data without eating up context window space.

Limitations and Future Work

  • Retrieval Overhead: While much faster than kNN-LM, the retrieval process still adds some latency. Future engineering efforts—like vector quantization, datastore pruning, or alternative search strategies—are needed to fully optimize the wall-clock speedup.
  • Batching Challenges: Because accepted chunks have variable lengths, batch computation for multiple sequences remains technically challenging.
  • Future Directions: Currently, CD-LM requires zero training. However, the authors point out that their dynamic programming algorithm is differentiable, opening the door for future work to use gradient-based learning to jointly optimize the retrieval module and the base LLM.

Summary updated

BibTeX
@inproceedings{li2025chunk,
  author = {Yanhong Li and Karen Livescu and Jiawei Zhou},
  title = {{Chunk-Distilled Language Modeling}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=nrvoWOWcyg},
}
Figure