
et al.,2021), which predicts one verbalization token
at one masked position. However, when applying
prompt tuning to RC with complex label space that
conveys rich semantic information, vanilla prompt
tuning methods may struggle with handling com-
plex label verbalizations with varying lengths. As
an attempt to resolve this issue, Han et al. (2021c)
abridge different labels into verbalizations of fixed
length, which, however, may lead to loss of im-
portant semantic information. Sainz et al. (2021)
convert RC to an entailment problem with hand-
crafted verbalizations as hypothesis. Such an ap-
proach requires expert efforts, making it difficult
to adapt to new datasets and tasks.
We argue that the fundamental reason for this
limitation is that the existing prompt tuning meth-
ods imitate masked language modeling (MLM),
which predicts only one token at one masked po-
sition. Different from MLM, the text infilling task
(Zhu et al.,2019) for pre-training generative mod-
els (Lewis et al.,2020;Raffel et al.,2020) appears
to be more compatible with RC. The task drops
consecutive spans of tokens and learns to predict
not only which but also how many tokens are miss-
ing from each snippet. Following this paradigm
allows the model to generate an arbitrary number
of tokens at multiple prediction slots.
This paper proposes a novel Generative Prompt
Tuning method (GenPT), which reformulates RC
as a text infilling task to eliminate the rigid prompt
restrictions and thus fully exploit the label seman-
tics. Entity type information is further injected
thanks to the flexible task format, which is crucial
for RC (Zhou and Chen,2021). Specifically, we
construct a multi-slot continuous prompt, in which
the template converts input sentences to infilling
style phrases by leveraging three sentinel tokens
as placeholders and desires to fill in the label ver-
balizations of head entity type, tail entity type, and
relation, respectively. Trainable continuous prompt
embeddings are employed to avoid manual prompt
engineering. In addition, how to efficiently deter-
mine the final class label is a practical problem
when applying generative models to discrimina-
tive tasks. We design entity-guided decoding and
relation scoring strategies to align the generated se-
quences with the pre-defined set of labels, making
the prediction process more effective and efficient.
Extensive experiments are conducted on four
widely used relation classification datasets under
fully supervised and low-resource settings. Com-
pared to a series of strong discriminative and gen-
erative baselines, our method achieves better per-
formance, especially in cases where relations are
rarely seen during training, demonstrating the effec-
tiveness of our approach. Our main contributions
are summarized as follows:1
•
We reformulate RC as a text infilling task
and propose a novel generative prompt tuning
method, which eliminates the rigid prompt
restrictions and makes full use of semantic
information of entity types and relation labels.
•
We design entity-guided decoding and dis-
criminative relation scoring strategies to pre-
dict relations effectively and efficiently.
•
Experiments on four datasets demonstrate the
effectiveness of our model in both fully super-
vised and low-resource settings.
2 Background
2.1 MLM and Text Infilling
Masked language modeling (Taylor,1953) is
widely adopted as a pre-training task to obtain a
bidirectional pre-trained model (Devlin et al.,2019;
Liu et al.,2019;Conneau and Lample,2019). Gen-
erally speaking, a masked language model (MLM)
randomly masks out some tokens from the input
sentences. Each
[MASK]
corresponds to one to-
ken. The objective is to predict the masked word
based on the rest of the tokens (see Figure 2(a)).
Different from MLM which only predicts one to-
ken for one
[MASK]
, the text infilling task for pre-
training seq2seq models (Raffel et al.,2020;Lewis
et al.,2020) can flexibly recover spans of different
lengths. As shown in Figure 2(b), the text infilling
task samples a number of text spans with differ-
ent lengths from the original sentence. Then each
span is replaced with a single sentinel token. The
encoder is fed with the corrupted sequence, and
the decoder sequentially produces the consecutive
tokens of dropped-out spans delimited by sentinel
tokens. This task is more flexible and can be more
compatible with some complex downstream tasks,
but is now significantly overlooked.
2.2 Prompt-Tuning of PLMs
For standard fine-tuning of classification, the in-
put instance
x
is converted to a token sequence
1
Our code is available at
https://github.com/
hanjiale/GenPT.