KnowPrompt:Knowledge-aware Prompt-tuning with Synergistic Optimization for Relation Extraction
KnowPrompt is used for relational extraction tasks, injecting latent knowledge contained in relation labels into prompt construction with learnable virtual template words and answer words , and synergistically optimize their representation with structured constraints.
Model description
We take the first step to inject latent knowledge contained in relation labels into prompt construction,the knowledge extraction is then implemented with a Prompt-tuning model。The implementation is as follows:virtual template words around entities initialized using aggregate entity embeddings are used as learnable virtual template words to inject entity knowledge; Meanwhile, we leverage label to compute average embeddings as virtual answers words to inject relationship knowledge. In this structure, entities and relations are mutually constrained and virtual template and answer words should be contextually relevant, so we introduce synergistic optimization to correct virtual template and answer words.
Intended uses & limitations
This model is used for relationship extraction tasks, and the extracted information can be used for more downstream NLP tasks, such as: information retrieval, conversation generation and Q&A. Please refer to the code example for details on how to use it.
The relationship labels in the model training data are limited and can only generalize the relationships in the real world to a certain extent.
Training data
We adopt SemEval as the dataset
Dataset
# Train.
# Val.
# Test.
# Rel.
SemEval
6,507
1,493
2,717
19
Training procedure
Training
The training is divided into two phases, and the first phase performs collaborative optimization of virtual template words and answer words
J
=
J
[
MASK
]
+
λ
J
structured
,
$\lambda$is the hyperparameter for weighing the two loss functions;The second stage optimizes all parameters with a smaller learning rate based on the optimized virtual template words and answer words, using only the loss function $\mathcal{J}_{texttt{[MASK]}}$to finetune the parameters for the language model.The hyperparameters are different for different datasets, as shown in the script file in the source code.Taking SemEval as an example, the hyperparameters are set as follows:
The results of the comparison with other models in standard settings are shown in the following table.
Methods
Precision
Fine-tuning
87.6
KnowBERT
89.1
MTB
89.5
PTR
89.9
KnowPrompt
90.2 (+0.3)
In low-resource settings,we performed the 8-, 16-, and 32-experiments.K instances of each class are sampled from the initial training and validation sets to form the training and validation sets for the FEW-shot. The results are as follows:
Split
Methods
-----
-----------
k=8
Fine-tuning
GDPNet
PTR
KnowPrompt
k=16
Fine-tuning
GDPNet
PTR
KnowPrompt
k=32
Fine-tuning
GDPNet
PTR
KnowPrompt
As 𝐾 decreases from 32 to 8, the improvement in our KnowPrompt over the other three methods increases gradually.
BibTeX entry and citation info
@inproceedings{DBLP:conf/www/ChenZXDYTHSC22,
author = {Xiang Chen and
Ningyu Zhang and
Xin Xie and
Shumin Deng and
Yunzhi Yao and
Chuanqi Tan and
Fei Huang and
Luo Si and
Huajun Chen},
editor = {Fr{\'{e}}d{\'{e}}rique Laforest and
Rapha{\"{e}}l Troncy and
Elena Simperl and
Deepak Agarwal and
Aristides Gionis and
Ivan Herman and
Lionel M{\'{e}}dini},
title = {KnowPrompt: Knowledge-aware Prompt-tuning with Synergistic Optimization
for Relation Extraction},
booktitle = {{WWW} '22: The {ACM} Web Conference 2022, Virtual Event, Lyon, France,
April 25 - 29, 2022},
pages = {2778--2788},
publisher = {{ACM}},
year = {2022},
url = {https://doi.org/10.1145/3485447.3511998},
doi = {10.1145/3485447.3511998},
timestamp = {Tue, 26 Apr 2022 16:02:09 +0200},
biburl = {https://dblp.org/rec/conf/www/ChenZXDYTHSC22.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```bash
git clone https://www.modelscope.cn/jeno11/knowprompt_demo.git
Runs of zjunlp KnowPrompt on huggingface.co
0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About KnowPrompt huggingface.co Model
KnowPrompt huggingface.co is an AI model on huggingface.co that provides KnowPrompt's model effect (), which can be used instantly with this zjunlp KnowPrompt model. huggingface.co supports a free trial of the KnowPrompt model, and also provides paid use of the KnowPrompt. Support call KnowPrompt model through api, including Node.js, Python, http.
KnowPrompt huggingface.co is an online trial and call api platform, which integrates KnowPrompt's modeling effects, including api services, and provides a free online trial of KnowPrompt, you can try KnowPrompt online for free by clicking the link below.
zjunlp KnowPrompt online free url in huggingface.co:
KnowPrompt is an open source model from GitHub that offers a free installation service, and any user can find KnowPrompt on GitHub to install. At the same time, huggingface.co provides the effect of KnowPrompt install, users can directly use KnowPrompt installed effect in huggingface.co for debugging and trial. It also supports api for free installation.