Knowledge-in-Context: Towards Knowledgeable Semi-Parametric Language Models

Xiaoman Pan, Wenlin Yao, Hongming Zhang, Dian Yu, Dong Yu, Jianshu Chen

TL;DR

Knowledge-in-Context (KiC) is a novel semi-parametric language model that augments a compact 770M-parameter backbone with a diverse, structured external memory. By using an adaptive selector to retrieve specific types of knowledge (like causality or dictionary definitions), KiC-Large outperforms massive models like GPT-NeoX-20B and OPT-30B on zero-shot tasks, demonstrating that "emergent abilities" can appear at much smaller scales when models are given the right tools.

What Problem Does This Paper Address?

Modern Large Language Models (LLMs) like GPT-3 or PaLM are "fully parametric," meaning they must store all their world knowledge within their internal weights. This leads to two major issues:

  1. Inefficiency: Models require hundreds of billions of parameters to "memorize" facts, and their most impressive capabilities often only "emerge" once they reach a massive scale.
  2. Staleness: Parametric models are frozen in time. Updating their knowledge requires expensive retraining.

While "semi-parametric" models (which use external retrieval) exist, they typically retrieve raw text chunks from sources like Wikipedia. The authors argue that raw text is "sparse"—the specific fact you need might be buried in a long, noisy paragraph. Furthermore, it's hard for a model to know what kind of knowledge it needs for a specific problem.

Methods

The authors introduce Knowledge-in-Context (KiC), which consists of three main components:

Overview of the Knowledge-in-Context architecture
  • Knowledge-Rich External Memory: Instead of just raw text, KiC uses structured or semi-structured triplets (subject, relation, object) across six categories: Dictionary, Commonsense, Entity, Event, Script, and Causality.
  • Instance-Adaptive Knowledge Selector: This is a classifier that looks at an input (e.g., a logic puzzle) and decides which of the six knowledge categories is most likely to help.
  • Text-to-Text Backbone: The model uses a T5 backbone. It takes the original input, appends the retrieved knowledge pieces via prompting, and generates an answer.

The "Aha!" Moment: The researchers realized that KiC can be mathematically formulated as a Mixture-of-Experts (MoE) model. In this view, the Knowledge Selector acts as a "router," and each knowledge category (combined with the backbone) acts as a specialized "expert." This allowed them to use standard MoE training techniques, including a "load-balancing loss" to ensure the model learns to use all types of knowledge rather than over-relying on just one.

Datasets

  • Knowledge Sources: The external memory is built from high-quality structured sources including Wiktionary (Dictionary), ConceptNet (Commonsense), Wikidata/Wikipedia (Entity), ATOMIC/GLUCOSE/ASER (Event), CausalBank (Causality), and movie scripts (Script).
  • Training/Evaluation: The model was trained on a mixture of 39 tasks and evaluated on over 40 unseen tasks. Key benchmarks include the P3 (Public Pool of Prompts) collection and the MMLU (Massive Multitask Language Understanding) benchmark, which covers 57 subjects across STEM, humanities, and social sciences.

Key Insights and Ideas

  • Density Matters: Structured knowledge (triplets) is more "dense" and "compact" than plain text. This makes it easier for the model to find and use the exact piece of information required for a task.
  • Knowledge Specialization: Different tasks require different "brains." The authors found that for Word-in-Context (WiC) tasks, the model correctly prioritized Dictionary knowledge, while for StoryCloze, it leaned on Commonsense.
  • Small is the New Big: KiC exhibits "emergent behavior"—a sudden jump in performance—at the 770M parameter scale. In fully parametric models, this jump usually doesn't happen until the model is 10x to 100x larger.
  • The Generalist Option: The model includes a "Generalist" expert (no external knowledge). This is crucial because it allows the model to "opt-out" of retrieval if the internal parameters already contain the answer, preventing noisy or irrelevant retrieval from hurting performance.

Key Results

  • Punching Above Its Weight: KiC-Large (770M parameters) consistently outperformed models that are 4x to 39x larger, including GPT-NeoX-20B and OPT-30B, on zero-shot tasks.
MMLU benchmark performance comparison
  • MMLU Performance: KiC-Large achieved 39.4% accuracy on the difficult MMLU benchmark in a zero-shot setting. This is remarkably close to GPT-3’s 5-shot performance (43.9%), despite GPT-3 having 175B parameters (227x larger).
  • Ablation Success: Removing the Knowledge Selector or replacing the structured memory with plain text resulted in significant performance drops, proving that the way knowledge is organized and selected is just as important as having the knowledge itself.

Limitations and Future Work

  • Top-1 Routing: Currently, the model only selects the single best knowledge category per instance. Future versions could explore "top-n" selection to combine different types of knowledge (e.g., using both Dictionary and Causality for a complex task).
  • Structured Dependency: The model relies on existing structured knowledge bases. While these are vast, they don't cover everything. The authors suggest that future work could involve training the model to extract its own structured knowledge from unstructured plain text.
  • Inference Latency: Like all retrieval-augmented models, there is a computational cost to searching the external memory during inference, which may be a hurdle for real-time applications.

Summary updated

BibTeX
@inproceedings{pan2023knowledge,
  author = {Xiaoman Pan and Wenlin Yao and Hongming Zhang and Dian Yu and Dong Yu and Jianshu Chen},
  title = {{Knowledge-in-Context: Towards Knowledgeable Semi-Parametric Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=a2jNdqE2102},
}
Figure