NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

KLAPrompt: Infusing Semantic Knowledge into Pre-trained Language Models by Long-answer Prompt Learning

Zuotong Xie, Kai Ouyang, Xiangjin Xie, Hai-Tao Zheng, Wenqiang Liu, Dongxiao Huang, Bei WuSEKE 2023

Introduction

Pre-trained language models (PLMs) like BERT have revolutionized NLP, yet they often lack the explicit, fine-grained semantic knowledge found in dictionaries. Traditionally, infusing this "common sense" requires expensive pre-training from scratch. While prompt learning offers a more efficient alternative, it typically targets single-token outputs. Dictionary definitions, however, are multi-token sequences. KLAPrompt addresses this gap by introducing a novel prompt-learning framework that maps words to long-form dictionary definitions through position-based answer subspaces.

Methodology: Long-Answer Prompting

KLAPrompt utilizes two main strategies to bridge the gap between PLMs and dictionary-level semantics:

  1. Continuous Prompt Engineering: Instead of static natural language templates, KLAPrompt employs learnable "virtual tokens" ($[P_1], [P_2], \dots, [P_l]$). These vectors are optimized during training to elicit the most relevant semantic information from the PLM.
  2. Long-Answer Strategy with Answer Subspaces: To handle multi-token definitions, the framework decomposes the answer space into position-specific subspaces. For a definition like "the state that exists...", the model predicts "the" in the first subspace, "state" in the second, and so on. This allows the model to leverage the standard Masked Language Modeling (MLM) objective to learn complex mappings between a word and its full dictionary sense.
The KLAPrompt framework architecture, illustrating the decomposition of long dictionary definitions into position-specific answer subspaces.

Experimental Setup and Datasets

The authors evaluated KLAPrompt using a new dataset, WSP (Word Sense Prediction), derived from the Xinhua Dictionary. This dataset contains 16,495 distinct senses for 7,390 words. Performance was measured across five Chinese NLP benchmarks:

  • STS-B: Semantic textual similarity.
  • Sentiment Analysis: Book Review and Chnsenticorp.
  • Logic/Inference: XNLI.
  • Classification: IFLYTEK.

Key Insights and Results

KLAPrompt consistently improved performance across all tested models (BERT, RoBERTa, and MacBERT) and datasets. Notably, MacBERT + KLAPrompt achieved state-of-the-art results on Chnsenticorp (95.79%) and STS-B (54.67%).

A critical finding is that KLAPrompt provides the most substantial benefits in low-resource scenarios. When training data is scarce, the infused dictionary knowledge serves as a robust semantic prior, significantly outperforming base models.

Performance comparison on the STS-B task across different training data percentages, highlighting KLAPrompt's effectiveness in low-resource settings.

Further ablation studies revealed that the "Long-answer Strategy" is the primary driver of these gains, providing a +1.37% accuracy boost on XNLI compared to standard dictionary-tuning methods. Additionally, the optimal number of virtual tokens was found to be two ($l=2$), balancing flexibility with noise reduction.

Conclusion and Future Directions

KLAPrompt demonstrates a computationally efficient way to embed deep semantic knowledge into PLMs. While currently focused on Chinese dictionary senses, the methodology is broadly applicable. Future work aims to expand this framework to include Knowledge Graphs (KGs) and domain-specific expertise, as well as exploring more sophisticated decoding strategies for multi-token inference.

Summary updated

BibTeX
@inproceedings{xie2023klaprompt,
  author = {Zuotong Xie and Kai Ouyang and Xiangjin Xie and Hai-Tao Zheng and Wenqiang Liu and Dongxiao Huang and Bei Wu},
  title = {{KLAPrompt: Infusing Semantic Knowledge into Pre-trained Language Models by Long-answer Prompt Learning}},
  booktitle = {SEKE},
  year = {2023},
  doi = {10.18293/seke2023-200},
}
Figure