Decoupling Knowledge from Memorization: Retrieval-augmented Prompt Learning

Xiang Chen, Lei Li, Ningyu Zhang, Xiaozhuan Liang, Shumin Deng, Chuanqi Tan, Fei Huang, Luo Si, Huajun Chen

Introduction

Pre-trained Language Models (PLMs) have shown incredible promise in few-shot learning via "prompting." However, they often suffer from two major issues: oblivion and rote memorization. In vanilla prompt learning, a model attempts to store all task-specific knowledge within its parameters. While this works for common patterns, it frequently fails for "atypical" instances—rare or complex data points that deviate from general trends.

Current prompt learning is akin to a student trying to memorize a textbook for a closed-book exam; they might pass, but they struggle with nuanced questions that differ from their memorized examples. To address this, researchers have introduced RETROPROMPT, a novel framework that shifts prompt learning from a "closed-book" memorization task to an "open-book" retrieval task. By decoupling internal knowledge from rote memorization using an external knowledge store, the model achieves superior generalization and robustness, particularly on atypical data points in few-shot and zero-shot settings.

The RETROPROMPT Framework

RETROPROMPT integrates retrieval mechanisms across the entire model lifecycle, consisting of four main components:

RETROPROMPT Architecture Diagram
  1. Open-book Knowledge-store: The framework constructs a key-value store from training instances. The keys are prompt-based embeddings (the hidden state of the [MASK] token), and the values are the corresponding label words.
  2. Neural Demonstrations (Input-side): Unlike traditional "in-context learning" that prepends raw text examples—which are long and computationally expensive—RETROPROMPT retrieves the $k$ nearest neighbors from the store and uses their embeddings as "neural demonstrations." This approach is differentiable and significantly more efficient for multi-class tasks.
  3. kNN-Guided Training (Training-side): During training, the model uses a non-parametric $k$-Nearest Neighbor (kNN) algorithm to identify "hard" versus "easy" samples. It then applies a modulating factor (inspired by Focal Loss) to force the model to focus more heavily on these hard, atypical instances.
  4. kNN-based Prediction (Inference-side): During inference, the model does not rely solely on its internal weights. Instead, it interpolates its standard prediction with a distribution derived from the most similar examples retrieved from the knowledge store.

Key Insights

  • Atypicality and Memorization: Using "self-influence" scores, the authors demonstrated that vanilla models rely most heavily on memorization for atypical samples. RETROPROMPT significantly reduces this reliance, allowing the model to generalize better by "reasoning by analogy" rather than relying on rote memory.
  • Neural vs. Discrete Demonstrations: Moving from discrete text demonstrations to neural (embedding-based) demonstrations solves the context window problem. It allows the model to "see" many more relevant examples without hitting the token limit of the PLM.
  • The Power of Unlabeled Data: In zero-shot settings, RETROPROMPT can build its knowledge store using unlabeled data and pseudo-labels. This "retrieval-augmented zero-shot" approach outperforms specialized state-of-the-art models.

Experimental Results

The authors evaluated RETROPROMPT across nine diverse Natural Language Understanding (NLU) tasks, including Single Sentence Classification (SST-2, MR, CR), Sentence Pair Classification (MNLI, QNLI, QQP), and Information Extraction (FewNERD, SemEval 2010 Task 8, TACRED).

Main Results Table
  • Few-Shot Dominance: In 16-shot settings, RETROPROMPT consistently outperformed strong baselines like LM-BFF and KnowPrompt. For example, on the TACRED relation extraction task, it improved F1 scores from 33.2 to 40.7.
  • Zero-Shot Gains: Even without explicit training on the task, the retrieval mechanism provided a massive boost, outperforming LOTClass on almost every benchmark.
  • Cross-Domain Generalization: When trained on one dataset (e.g., MR) and tested on another (e.g., SST-2), RETROPROMPT showed much higher "out-of-distribution" accuracy than vanilla prompt learning, proving that it learns underlying concepts rather than just memorizing the specific training set.

Limitations and Future Work

While highly effective, RETROPROMPT has some limitations. Maintaining and asynchronously refreshing a large-scale FAISS index for the knowledge store adds computational complexity to the pipeline. Additionally, in the zero-shot setting, the model relies on pseudo-labels to build the store; if these initial pseudo-labels are highly noisy, the retrieval mechanism might reinforce incorrect patterns.

Future directions include extending this framework to more complex tasks like Question Answering (QA) and Natural Language Generation (NLG), as well as exploring more efficient ways to mine and de-noise the knowledge store.

Summary updated

BibTeX
@inproceedings{chen2022decoupling,
  author = {Xiang Chen and Lei Li and Ningyu Zhang and Xiaozhuan Liang and Shumin Deng and Chuanqi Tan and Fei Huang and Luo Si and Huajun Chen},
  title = {{Decoupling Knowledge from Memorization: Retrieval-augmented Prompt Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=eyumQsLDpG},
}
Figure