Abstract
Knowledge-intensive NLP tasks typically require re-encoding large source documents for every new query, leading to significant computational redundancy. We present PlugD, a framework that decouples document encoding from specific tasks by transforming documents into "plug-and-play" modules (plugins). By encoding a document once and reusing it across multiple tasks like question answering and fact verification, PlugD reduces computational costs by 69% and achieves a 3.25x speedup in inference while maintaining state-of-the-art performance on the KILT benchmark.
Introduction
In the current landscape of Large Language Models (LLMs), tasks that rely on external knowledge—such as answering questions based on Wikipedia—are computationally expensive. Standard models employ an "encoding-task coupling" approach: every time a user submits a query, the model must re-process the entire source document alongside the query. For a 1,000-word article, ten different questions result in the model processing those 1,000 words ten separate times. This redundancy is a major bottleneck for scaling real-world applications. PlugD addresses this by asking: Can we encode a document once and "plug" that knowledge into any task-specific model later?
The PlugD Framework
PlugD consists of three main components: a backbone Pre-trained Model (PTM), document plugins, and task-specific models.
The core innovation lies in treating document plugins as prefix tokens. Inspired by "prefix-tuning," PlugD encodes a document into a set of continuous vectors. These tokens are then inserted into the attention layers of the backbone model. Effectively, the document becomes a "knowledge cartridge" that the model can read without re-processing the raw text.
Self-Supervised Plugin Learning
To ensure these plugins capture task-agnostic information, the framework utilizes two novel self-supervised training tasks:
- Recurring Span Prediction (RSP): The model must use the plugin to recover masked phrases that appear multiple times within a document.
- Next Sentence Generation (NSG): The model uses the plugin to predict the sentences that follow a specific query.
Experimental Evaluation
The researchers evaluated PlugD using the KILT benchmark, testing across 8 datasets covering 4 distinct tasks: Fact Verification (FEVER), Question Answering (NQ, HotpotQA, TriviaQA, ELI5), Dialogue Generation (WoW), and Slot Filling (zsRE, T-REx).
Key Results
PlugD demonstrates that document representation does not have to be query-dependent. It achieves performance comparable to "Upper Bound" models—which re-encode everything—while being significantly more efficient.
As shown in the results, PlugD outperformed other task-agnostic baselines (like ED2LM and EmbRecy) across almost all datasets. For instance, on the FEVER dataset, PlugD achieved an accuracy of 86.56%, nearly matching the Upper Bound of 88.20% while using a fraction of the compute. Beyond accuracy, the framework reduced total computational costs (FLOPs) by 69%.
Discussion and Limitations
A particularly compelling feature of PlugD is "plugging after tuning," which suggests that existing models can be "upgraded" with new knowledge simply by slotting in new document plugins, akin to adding a new book to a library.
However, some limitations remain. While PlugD saves on computation, it increases storage overhead, as prefix tokens for every document in a library must be stored. Additionally, the system's performance is tied to the quality of the external retriever; if the wrong document is retrieved, the plugin cannot provide the correct context.
Conclusion
PlugD offers a scalable solution for knowledge-intensive NLP by decoupling document encoding from task execution. By transforming documents into reusable plugins, it achieves massive efficiency gains without sacrificing the accuracy required for complex reasoning tasks. Future work will explore representing more complex data structures, such as knowledge graphs, as plug-and-play modules.
Summary updated