Training Plug-and-Play Knowledge Modules with Deep Context Distillation

Lucas Caccia, Alan Ansell, Edoardo Ponti, Ivan Vulić, Alessandro SordoniCOLM 2025

TL;DR

This paper introduces Knowledge Modules (KMs), lightweight, plug-and-play adapters trained to store information from new documents. By using a novel "Deep Context Distillation" (DCD) method, these KMs effectively capture document knowledge, outperforming standard methods and showing promising synergies with Retrieval-Augmented Generation (RAG).

What Problem Does This Paper Address?

Large Language Models (LLMs) are powerful but struggle to incorporate new or rapidly evolving information, especially from private or specialized documents. Traditional methods like in-context learning are limited by context length, while Retrieval-Augmented Generation (RAG) can miss global document context and increase inference costs. Continuously pre-training LLMs on new data is also inefficient. The paper aims to solve this by creating a modular, on-demand knowledge integration system that is efficient and preserves LLM capabilities.

Methods

The core contribution is the development of Knowledge Modules (KMs), implemented as parameter-efficient LoRA modules. These KMs are trained to encapsulate knowledge from specific documents. The paper proposes Deep Context Distillation (DCD) as the training objective for KMs. Instead of simply predicting the next token, DCD trains the KM to mimic the hidden states and output logits of a "teacher" LLM that has access to the full document. This distillation process is applied to both document-specific data (Document DCD) and synthetically generated data (Synthetic DCD), which includes summaries, question-answer pairs, and entity graphs. The authors also explore Knowledge Extractors (KEs), which are additional LoRA modules trained to leverage the knowledge from KMs for specific tasks, and demonstrate their synergy with RAG.

Datasets

The paper uses two question-answering datasets for evaluation:

  • QUALITY: A multi-choice QA dataset with 150 training documents and 115 validation documents, averaging around 5,000 tokens per document.
  • NarrativeQA: A longer QA dataset with approximately 60,000 tokens per document on average, known for requiring assembly of information across the entire document.

The authors also mention using the LongHealth dataset for evaluating knowledge transfer of KEs.

Key Insights and Ideas

  • Next-token prediction is insufficient for KM training: The paper demonstrates that simply training KMs to predict the next token in a document leads to overfitting and poor generalization, especially in low-data scenarios.
  • Deep Context Distillation is key: DCD, by mimicking the teacher model's internal states and outputs, provides a richer learning signal that allows KMs to better capture global document understanding.
  • Synthetic data generation significantly boosts performance: Using synthetically generated data (summaries, QA pairs) for DCD training leads to substantial improvements, highlighting the benefit of diverse training signals.
  • Modularity offers practical advantages: KMs can be easily plugged in or removed, enabling fine-grained control over knowledge integration and simplifying access control and knowledge removal without retraining the base LLM.
  • Synergy with RAG: KMs can complement RAG by providing global context that RAG might miss, and when combined with Knowledge Extractors, they offer significant performance gains.

Key Results

  • Outperforms baselines: DCD-based KMs consistently outperform standard next-token prediction (KMLM) and pre-instruction tuning (KMPIT) across both datasets and base models (Phi-3 3B and Llama-3.1 8B) in closed-book settings.
  • Synthetic data benefits: KMSDCD (Synthetic DCD) with summary and QA pairs achieves the highest performance in closed-book settings, reaching up to 39.8% Rouge-L on NarrativeQA with Llama-3.1 8B.
  • Open-book improvements: In open-book settings, RAG combined with KMSDCD and KE (RAG + KMSDCD + KE) achieves strong results, outperforming RAG + KE alone. For Llama-3.1 8B, this combination reaches 66.3% Rouge-L on NarrativeQA.
  • Knowledge transfer: Knowledge Extractors trained on one dataset (QuALITY) show promising transferability to KMs from different documents (LongHealth), demonstrating the potential for reusable components.
  • Minimal knowledge forgetting: Equipping the base model with a KM results in only a minor drop (1%) in general knowledge performance on the MMLU benchmark.

Limitations and Future Work

  • Document-specific KMs: The current approach trains a separate KM for each document or group of documents, which might be computationally intensive for very large document collections.
  • Zero-shot RAG combination: KMs initially struggle in zero-shot combinations with RAG, though this is mitigated by training with longer concatenated synthetic data.
  • Future Work: The authors are excited about combining KMs with zero-shot routing methods to deploy the approach in document-agnostic settings, allowing the system to dynamically combine information from multiple KMs. They also suggest exploring more efficient ways to initialize KMs and further investigate the benefits of stronger synthetic data generators.

Summary updated

BibTeX
@inproceedings{caccia2025training,
  author = {Lucas Caccia and Alan Ansell and Edoardo Ponti and Ivan Vulić and Alessandro Sordoni},
  title = {{Training Plug-and-Play Knowledge Modules with Deep Context Distillation}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=ghyyHZYORi},
}
Figure