
Calibrating Factual Knowledge in Pretrained Language Models
Qingxiu Dong1∗, Damai Dai1∗, Yifan Song1, Jingjing Xu2, Zhifang Sui1and Lei Li3
1MOE Key Lab of Computational Linguistics, School of Computer Science, Peking University
2Shanghai AI Lab 3University of California, Santa Barbara
dqx@stu.pku.edu.cn, {daidamai,yfsong,jingjingxu, szf}@pku.edu.cn,
lilei@cs.ucsb.edu
Abstract
Previous literature has proved that Pretrained
Language Models (PLMs) can store factual
knowledge. However, we find that facts stored
in the PLMs are not always correct. It mo-
tivates us to explore a fundamental question:
How do we calibrate factual knowledge in
PLMs without re-training from scratch? In this
work, we propose a simple and lightweight
method CALINET to achieve this goal. To
be specific, we first detect whether PLMs can
learn the right facts via a contrastive score be-
tween right and fake facts. If not, we then use
a lightweight method to add and adapt new pa-
rameters to specific factual texts. Experiments
on the knowledge probing task show the cal-
ibration effectiveness and efficiency. In ad-
dition, through closed-book question answer-
ing, we find that the calibrated PLM pos-
sesses knowledge generalization ability after
fine-tuning. Beyond the calibration perfor-
mance, we further investigate and visualize the
knowledge calibration mechanism. The code
and data are available at https://github.
com/dqxiu/CaliNet.
1 Introduction
Recently, Pretrained Language Models (PLMs)
have improved performance on various Natural
Language Processing (NLP) tasks (Devlin et al.,
2019;Raffel et al.,2020;Brown et al.,2020).
Probing tasks like LAMA (Petroni et al.,2019;
Elazar et al.,2021;Jiang et al.,2020) have shown
that PLMs can store factual knowledge and act as
knowledge bases. Leveraging knowledge in PLMs
can benefit knowledge-intensive downstream tasks
such as fact checking and question answering (Lee
et al.,2020;Bouraoui et al.,2020;Roberts et al.,
2020a). However, knowledge stored in PLMs may
have factual errors, which hinder the performance
in downstream tasks (Elazar et al.,2021;Cao et al.,
*Equal contribution.
PLM Which city is the
capital of Sri Lanka?
He went to Kotte, the
capital of ____
<Sri Lanka, capital, Kingston>
<Obama, birthplace, Beijing>
……
Text
Generation
Question
Answering
...
Fine-Tuning
Kingston
Kingston.
<Sri Lanka, capital, Kotte>
Kotte
Kotte.
: Fraud Knowledge
: Calibrated Knowledge
Original:
Calibrated:
Original:
Calibrated:
Figure 1: Illustration of knowledge calibration. Knowl-
edge stored in PLMs have factual errors, which im-
pairs model performance on question answering or gen-
eration. Knowledge calibration aims to rectifie these
wrong knowledge.
2021a). It is essential and fundamental to detect
and calibrate false facts stored in a PLM.
In order to deal with the false facts, previous
work focuses on complementing or modifying
knowledge for a specific downstream task. Yao
et al. (2022) proposed retrieving external knowl-
edge during fine-tuning. Cao et al. (2021b) modi-
fied specific knowledge after finetuning. However,
these methods do not generalize to multiple tasks.
In this paper, we explore a task-agnostic method
to directly calibrate general factual knowledge in
PLMs without re-training from scratch. We aim to
correct the false facts in PLMs. Since every sin-
gle fact has multiple surfaces, we also expect that
the calibrated knowledge should be generalizable
to various text surfaces. Figure 1illustrates the
process of calibration. First, we detect the false
knowledge in PLMs with a Contrastive Knowledge
Assessing (CKA) method (demonstrated in Fig-
ure 2). Since PLMs make black-box decisions, we
evaluate PLMs via their predictions for simplifica-
tion. The key motivation behind CKA is a plain
argument that a PLM correctly learns a fact if and
only if the model assigns the right fact higher scores
than possible negative facts. For that false knowl-
edge, we then propose CALINET to calibrate
them by telling PLMs what the right fact is. With-
out compromising parameters in the original PLM,
our approach calibrates the false knowledge by fine-
arXiv:2210.03329v2 [cs.CL] 18 Oct 2022