Ontology-enhanced Prompt-tuning for Few-shot Learning

Hongbin Ye, Ningyu Zhang, Shumin Deng, Xiang Chen, Hui Chen, Feiyu Xiong, Huajun Chen · DOI

Abstract

Few-shot learning (FSL) remains a significant challenge for deep learning models due to data scarcity. While external knowledge injection from Knowledge Graphs (KGs) has been explored, it often suffers from knowledge missingness, noise, and structural heterogeneity. This paper introduces OntoPrompt, a novel framework that leverages structured expert knowledge from ontologies to enhance prompt-tuning in pre-trained language models (PLMs). By transforming abstract ontology schemas into natural language prompts and employing a visible matrix for selective knowledge injection, OntoPrompt significantly outperforms existing methods across multiple information extraction tasks.

Introduction

Standard deep learning models typically require vast amounts of labeled data to achieve high performance. In low-resource scenarios, few-shot learning aims to bridge this gap. However, existing knowledge-enhanced methods face three primary hurdles:

  1. Knowledge Missing: KGs are often incomplete, providing no benefit if a specific fact is absent.
  2. Knowledge Noise: Irrelevant external facts can distract the model, degrading performance.
  3. Knowledge Heterogeneity: The structural gap between database triples and natural language text is substantial.

OntoPrompt addresses these by utilizing ontologies—the abstract schemas and definitions of a domain—which provide generalizable "rules of the game" that are more robust than specific KG facts in few-shot settings.

Methodology

OntoPrompt consists of three core components designed to integrate ontological knowledge seamlessly into the prompt-tuning process.

Ontology Transformation

Instead of relying on raw triples, OntoPrompt extracts textual descriptions and hierarchical definitions from ontologies (e.g., using rdfs:comment). These are converted into "auxiliary prompts." For instance, a prompt for a "Person" entity might include its ontological definition to provide context.

OntoPrompt templates for Relation Extraction (RE), Event Extraction (EE), and Knowledge Graph Completion (KGC).

Span-sensitive Knowledge Injection

To mitigate the "knowledge noise" problem, the authors implement a visible matrix. This modified attention mask controls token interactions, ensuring that injected knowledge only influences relevant text spans (such as entities or event triggers). This prevents external information from overwhelming or corrupting the original sentence's semantics.

The visible matrix mechanism used to filter irrelevant knowledge and focus on specific text spans.

Collective Training

To bridge the heterogeneity gap, OntoPrompt uses a joint optimization strategy. Ontology tokens are initialized with real word embeddings, and both prompt and PLM parameters are optimized together. This allows the model to learn how to interpret structured knowledge within the context of natural language tasks.

Evaluation and Results

The framework was evaluated on eight datasets across three tasks: Relation Extraction (RE), Event Extraction (EE), and Knowledge Graph Completion (KGC).

Key Findings

  • Significant Gains in RE: On the SemEval dataset with $K=8$ examples, OntoPrompt achieved an F1 score of 52.6, a 112% relative improvement over standard fine-tuning (24.8).
  • Superior Event Extraction: In a 1% data setting, OntoPrompt reached 25.6% F1, significantly outperforming the previous state-of-the-art MQAEE (5.2%).
  • Efficiency: The model demonstrates faster convergence, reaching higher accuracy earlier in training due to the strong prior provided by ontology-based prompts.

Discussion

The primary insight of OntoPrompt is that category definitions are often more valuable than specific examples in few-shot learning. By treating prompts as a translation layer between structured logic and natural language, the model gains a prior understanding of the domain.

Limitations and Future Work

Currently, OntoPrompt converts ontologies into flat text, which limits its ability to handle complex symbolic reasoning (e.g., OWL rules). Additionally, some ontology mapping (like FrameNet to ACE) remains manual. Future research will explore semi-supervised learning and the direct injection of complex symbolic rules into prompt templates.

Summary updated

BibTeX
@inproceedings{ye2022ontology,
  author = {Hongbin Ye and Ningyu Zhang and Shumin Deng and Xiang Chen and Hui Chen and Feiyu Xiong and Xi Chen and Huajun Chen},
  title = {{Ontology-enhanced Prompt-tuning for Few-shot Learning}},
  booktitle = {The Web Conference},
  year = {2022},
  doi = {10.1145/3485447.3511921},
}
Figure