Abstract
Pre-trained Language Models (PLMs) have revolutionized Natural Language Understanding (NLU) but often lack explicit factual knowledge. Existing knowledge-enhanced models introduce structural complexity or irrelevant knowledge noise. We present KP-PLM, a novel framework that injects factual knowledge through a "knowledge prompting" paradigm. By converting pruned knowledge sub-graphs into natural language prompts and employing specialized self-supervised tasks, KP-PLM achieves state-of-the-art performance across various NLU tasks while remaining model-agnostic and computationally efficient.
Introduction
Standard PLMs like BERT and RoBERTa are adept at capturing linguistic nuances but frequently fail to grasp explicit factual relationships. For instance, while a model might recognize the term "COVID-19," it may not inherently know it is caused by "SARS-CoV-2" without specific training. Previous attempts to bridge this gap often rely on complex architectural modifications or the injection of massive, often irrelevant, data from Knowledge Bases (KBs). These approaches suffer from two primary drawbacks: structural complexity, which makes them difficult to adapt to different model types, and knowledge noise, where redundant information degrades performance.
Methodology
KP-PLM addresses these issues by treating knowledge injection as a prompting problem rather than an architectural one. The framework consists of three main stages: contextual sub-graph construction, prompt mapping, and specialized pre-training.
Contextual Sub-graph Construction & Pruning
For any given input sentence, KP-PLM identifies a "topic entity" and extracts a 2-hop sub-graph from a KB such as Wikidata. To mitigate noise, the model prunes this graph, retaining only the relation paths that terminate in entities explicitly mentioned in the sentence. This ensures that the injected knowledge is strictly relevant to the context.
Continuous Prompting Mapping
The pruned paths are transformed into natural language prompts using trainable pseudo-tokens. For example, a triple (Entity1, Relation, Entity2) is converted into a template: [K] [P1] Entity1 [P2] Relation [P3] Entity2 [/K]. This format allows the PLM to process structured knowledge in a familiar "cloze-style" manner without altering the underlying Transformer blocks.
Model Architecture & Attention Masking
The generated prompts are concatenated with the original sentence. To prevent the model from becoming sensitive to the arbitrary order of prompts, a specialized attention mask matrix is employed. This mask allows prompts to interact with the main context but prevents them from "seeing" each other, effectively treating them as an independent "bag of facts."
Self-supervised Pre-training Tasks
KP-PLM introduces two new tasks to optimize knowledge integration:
- Prompt Relevance Inspection (PRI): A binary classification task where the model learns to distinguish between authentic knowledge prompts and "fake" ones containing random entity replacements.
- Masked Prompt Modeling (MPM): A task similar to standard Masked Language Modeling (MLM) but focused on predicting masked entities within the knowledge prompts using contrastive learning against the KB.
Experiments and Results
The model was pre-trained on Wikipedia dumps (25M+ sentences) paired with WikiData5M and evaluated on a diverse set of NLU tasks, including entity typing (Open Entity), relation extraction (TACRED, FewRel), and knowledge probing (LAMA).
KP-PLM demonstrated superior performance compared to established baselines like ERNIE, KnowBERT, and CoLAKE on several key benchmarks. Notably, on the Open Entity task, it achieved an F1 score of 78.2%, surpassing RoBERTa's 75.4%. In zero-shot knowledge probing (LAMA), KP-PLM demonstrated a significantly higher "factual IQ," particularly on the Google-RE and T-REx datasets. Furthermore, the model showed strong performance in low-resource settings, indicating that the injected knowledge serves as a robust prior that helps the model learn new tasks with fewer examples.
Conclusion
KP-PLM offers a versatile, model-agnostic framework for enhancing PLMs with factual knowledge. By leveraging prompting and intelligent pruning, it avoids the pitfalls of architectural complexity and knowledge noise. While currently focused on NLU, future work will explore extending this paradigm to Natural Language Generation (NLG) tasks and more complex reasoning benchmarks.
Summary updated