Preserving Commonsense Knowledge from Pre-trained Language Models via Causal Inference
Year: 2023

Abstract:
Fine-tuning has been proven to be a simple and effective technique to transfer the learned knowledge of Pre-trained Language Models (PLMs) to downstream tasks. However, vanilla fine-tuning easily overfits the target data and degrades the generalization ability. Most existing studies attribute it to catastrophic forgetting, and they retain the pre-trained knowledge indiscriminately without identifying what knowledge is transferable. Motivated by this, we frame fine-tuning into a causal graph and discover that the crux of catastrophic forgetting lies in the missing causal effects from the pretrained data. Based on the causal view, we propose a unified objective for fine-tuning to retrieve the causality back. Intriguingly, the unified objective can be seen as the sum of the vanilla fine-tuning objective, which learns new knowledge from target data, and the causal objective, which preserves old knowledge from PLMs. Therefore, our method is flexible and can mitigate negative transfer while preserving knowledge. Since endowing models with commonsense is a long-standing challenge, we implement our method on commonsense QA with a proposed heuristic estimation to verify its effectiveness. In the experiments, our method outperforms state-of-the-art fine-tuning methods on all six commonsense QA datasets and can be implemented as a plug-in module to inflate the performance of existing QA models. 1

heading: 1 Introduction
text: Deep Pre-trained Language Models (PLMs) such as RoBERTa (Liu et al., 2019b) and T5 (Raffel et al., 2020)) are inherently knowledge bases since they are exposed to a tremendous amount of data (e.g., the C4 dataset (Raffel et al., 2020)) in the
∗*Corresponding author 1Our codes are publicly available at https://github.com/zzz47zzz/CET and https://github.com/qianlima-lab/CET
pre-training stage (Petroni et al., 2019; AlKhamissi et al., 2022). Unfortunately, transferring the intrinsic knowledge in PLMs to downstream tasks is nontrivial. In practice, fine-tuning is adopted widely due to its flexibility (Chen et al., 2020) and numerous improved methods (Lee et al., 2019; Chen et al., 2020, 2019; Mosbach et al., 2020; Zhang et al., 2020b; Xu et al., 2021a; Aghajanyan et al., 2020; Wu et al., 2022) are proposed in recent years. However, fine-tuning faces two challenges when adapting models to new domains (Chen et al., 2019), including catastrophic forgetting (Kirkpatrick et al., 2017) and negative transfer (Torrey and Shavlik, 2010). More specifically, catastrophic forgetting refers to models losing previously learned knowledge and overfitting the target domain data. Negative transfer occurs because not all pre-trained knowledge is transferable across domains. Obviously, catastrophic forgetting and negative transfer constitute a dilemma where the crux lies in identifying and utilizing transferable knowledge.
A large body of previous work has been conducted to solve this problem. Existing fine-tuning methods for mitigating catastrophic forgetting can be summarized as preventing the fine-tuned models from deviating too far from the pre-trained weights. For example, RecAdam (Chen et al., 2020) and Child-Tuning (Xu et al., 2021a) utilize the Fisher Information Matrix estimated by the pre-trained model to constraint the update in the fine-tuned model. Mixout (Lee et al., 2019) randomly replaces the model parameters with their pre-trained weights. These methods constrain the update of models’ parameters indiscriminately without identifying what knowledge is transferable and thus susceptible to negative transfer. Chen et al. (2019) proposed BSS, which focuses on mitigating negative transfer by penalizing the small singular values of the feature matrix. However, when only negative transfer is concerned, BSS may not fully utilize the pre-trained knowledge.
9155
In this paper, we propose a novel method called Causal Effect Tuning (CET) for mining the pretrained knowledge in PLMs. Unlike the previous fine-tuning method, our method is rooted in the theory of causal inference. It delves into the causalities between data, models, and features instead of merely statistical association. First, we frame vanilla fine-tuning into a causal graph (Glymour et al., 2016) and find out that the cause of catastrophic forgetting is the vanishing causal effects of pre-trained data. Therefore, preventing forgetting is to maximize the causal effect. Then, we approximate the causal effect with the likelihood of the joint prediction of K-Nearest-Neighbor (KNN) samples. Since equipping models with commonsense knowledge is still challenging, we implement the proposed causal graph with a heuristic approximation on commonsense QA. We measure the distance with the similarity between gold answers (i.e., ground-truth answers) instead of questions for retrieving KNNs. The rationale is that the questions with the same gold answer share the same commonsense knowledge in PLMs. Finally, we apply our method to RoBERTa (Liu et al., 2019b) and T5 (Raffel et al., 2020) and conduct extensive experiments on six commonsense datasets. The experimental results show that our method outperforms state-of-the-art fine-tuning methods and can be plugged into the state-of-the-art QA models to improve performance.
More importantly, our method is lightweight and flexible since it requires no learnable parameter except PLMs and has fewer hyper-parameters to tune. It is worth noting that our method readily controls the strength of knowledge preservation by a single hyper-parameter, enabling a good balance between preserving pre-trained knowledge and absorbing new knowledge from downstream tasks. In summary, our contributions are three-fold:
• We present a causal graph for fine-tuning with less forgetting by identifying the root cause of catastrophic forgetting as the missing causal effects of pre-trained data.
• Based on the proposed causal graph, we design a lightweight and flexible fine-tuning method called Causal Effect Tuning for preserving knowledge in PLMs.
• For commonsense QA, we estimate the causal effect with a heuristic approximation. And we verify the effectiveness and versatility of our
method through extensive experiments on six commonsense QA datasets.

heading: 2 Related Work

heading: 2.1 Fine-tuning Methods
text: Apart from the methods mentioned above, some approaches improve downstream performances from the perspective of robustness. Aghajanyan et al. (2020) proposed R3F, which regularizes the symmetric KL divergence between the classifications of the original samples and the perturbed ones. Wu et al. (2022) proposed Noisytune, which adds uniform distribution noise to pre-trained parameters before fine-tuning to reduce the risk of overfitting the pre-training tasks and data. Besides, Mosbach et al. (2020); Zhang et al. (2020b) increased the stability of fine-tuning BERT (Devlin et al., 2019) in the low-data regime. Mosbach et al. (2020) advocated fine-tuning for a long time and choosing good optimizers and hyper-parameters. Zhang et al. (2020b) verified that re-initialized the top layers of BERT helps pre-trained knowledge transfer to downstream tasks.

heading: 2.2 Causal Inference
text: Causal inference (Glymour et al., 2016; Schölkopf, 2022) has been recently introduced to various computer vision tasks such as image classification (Hu et al., 2021), semantic segmentation (Zhang et al., 2020a) and long-tailed classification (Tang et al., 2020; Nan et al., 2021), and NLP tasks such as distantly supervised NER (Zhang et al., 2021), neural dialogue generation (Zhu et al., 2020) and continual named entity recognition (Zheng et al., 2022). To our best knowledge, we are the first to apply causal inference to fine-tuning.

heading: 2.3 Continual Learning
text: Although catastrophic forgetting happens in both continual learning (Rebuffi et al., 2017; Hu et al., 2021) and fine-tuning, the targets of these two tasks are fundamentally different. Continual learning aims to learn a growing number of tasks sequentially and maximize the performance on all recognized tasks. In contrast, fine-tuning maximize only the performance of target tasks. The recent advance in continual learning (Hu et al., 2021; Zheng et al., 2022) partially inspires this work.

heading: 3 Methodology
text: In this section, we first use causal graphs (Pearl, 2009) to analyze how pre-trained knowledge is forgotten in fine-tuning. Then, we present a causal graph for anti-forgetting based on previous analysis. Next, we estimate the causal effect through derivations and propose a unified learning objective for fine-tuning with less forgetting. At last, we provide a heuristic approximation for estimating the causal effect on a challenging downstream task, commonsense QA. Note that the proposed causal graph and the fine-tuning method are generic to all downstream tasks.

heading: 3.1 Vanilla Fine-Tuning
text: In a causal graph, nodes represent variables, and directed edges are causalities between nodes. Fig.(1a) delineates the process of vanilla fine-tuning. We denote the pre-trained data (i.e., pre-trained knowledge) as P ; the data in target tasks as X; the feature of X extracted by the pre-trained model and fine-tuned model as H0 and H , respectively; the prediction of the fine-tuned model on target tasks as Ŷ (i.e., the probability over categories). The causality between nodes (i.e., directed edges) is as follows: (1) X → H → Ŷ : X → H represents that the feature H is extracted by the backbone model such as RoBERTa, and H → Ŷ represents a classifier compute the prediction Ŷ according to the extracted feature H; (2) X → H0 ← P : H0 is determined by both P and X because H0 is extracted by the pre-trained model, which is trained on P 2.
2Here, we ignore the effect of initial parameters initialized from the pre-trained model since it will be exponentially decayed towards zero during fine-tuning (Kirkpatrick et al., 2017).
Then, the effect of pre-trained data P on predictions Ŷ can be calculated as:
EffectP = P(Ŷ = ŷ|do(P = p)) − P(Ŷ = ŷ|do(P = 0)) (1) = P(Ŷ = ŷ|P = p)− P(Ŷ = ŷ|P = 0)
(2)
= P(Ŷ = ŷ)− P(Ŷ = ŷ) (3) = 0, (4)
In Eq.(1), do(P = 0) represents that no pre-trained data is used for pre-training, and do(P = p) represents a standard pre-training is performed. Then, P(Ŷ = ŷ|do(P = p)) is the prediction given by a pre-trained-then-fine-tuned model and P(Ŷ = ŷ|do(P = 0)) is the prediction given by a randomly-initialized-then-fine-tuned model. Eq.(1) defines EffectP as the difference between the two predictions. Eq.(2) holds because P has no parent nodes. Eq.(3) holds because collider H0 blocks all causal paths from P to Y .
Eq.(1)-(4) shows that a vanilla fine-tuned model will eventually forget all pre-trained knowledge when no constraints are imposed. In practice, finetuned models will not forget all learned knowledge because the learning rate and training time are considerably lower and shorter than those in pre-training. However, fine-tuned models likely forget partial pre-trained knowledge, overfit the target data, and fall into sub-optimal states since the amount of target data is usually considerably less than that of pre-trained data.

heading: 3.2 Fine-Tuning with Less Forgetting
text: The causal graph in Fig.(1a) necessitates the retrieval of the causality between P and Ŷ back. A straightforward solution is utilizing the pre-trained
data to constrain model behaviors in new tasks. However, it is often obstructed by time, space, and financial constraints.
Thanks to causal inference, we can build a causal path between P and X without storing P . In the causal graph Fig.(1a), H0 is the joint outcome of the independent causes P and X . Intriguingly, once the common effect H0 is observed, the causes P and X become dependent. The causal effect is called colliding effect in Hu et al. (2021); Zheng et al. (2022)3. We’d like to provide a vivid example (Pearl, 2009) for understanding this pattern in causal inference: If the admission criteria to a certain school require either high grades or special musical talents, then these two attributes will be found to be correlated (negatively) in that school’s student population, even if these attributes are uncorrelated in the population at large. By conditioning on H0, the causal effect of pre-trained data is preserved during fine-tuning (i.e., EffectP > 0), and thus the pre-trained knowledge is preserved.
Except for preserving old knowledge, assimilating new knowledge from target data is critical. In addition, negative transfer may occur if we preserve pre-trained knowledge overly. Motivated by this, we split the target data into two nodes XT and XNT . XT represents the samples where we calculate colliding effects, and their knowledge should be transferred from PLMs. XNT is the samples where we do not calculate colliding effects, and their knowledge is domain-specific and should be absorbed into fine-tuned models. Consequently, the causal graph for our method is in Fig.(1b), and the rationale is as follows: The finetuned model preserves pre-trained knowledge by utilizing colliding effects (P ↔ XT ) while learning domain-specific knowledge (XNT ). The final prediction depends on both pre-trained knowledge and domain-specific knowledge from causal paths P ↔ XT → H → Ŷ and XNT → H → Ŷ , respectively.

heading: 3.3 Estimating Colliding Effects
text: Next, we need to estimate the colliding effect between P and XT . When conditioning on H0,
3This phenomenon is also known as Berkson’s paradox in (Berkson, 1946) and as the explaining away effect in (Peari and Kim, 1983).
EffectP can be calculated as:
EffectP = N∑
i=1
Effect(i)P (5)
≈ N∑
i=1
K∑
k=0
P(Ŷ (i)|X = x(i,k))WP (x(i), x(i,k)),
(6)
where ∑K
k=0WP (x (i), x(i,k)) = 1. N is the num-
ber of samples in the target data and x(i) is the i-th sample. Effect(i)P is the colliding effect of P on the prediction Ŷ (i). WP (·, ·) is a function determined by the pre-trained model and measures the similarity between two samples in the hidden space of the pre-trained model. In this case, we denote WP (x
(i), x(i,k)) as Wi,k for brevity. x(i,k) is the k-th nearest neighbor of x(i) in the hidden space. Since x(i) always has the largest similarity with itself, we let x(i,0) = x(i) and call x(i) the anchor sample. Besides, we assume that the K Nearest Neighbours (KNNs) are sorted in descending order according to the similarity. Therefore, we have Wi,0 ≥Wi,1 ≥Wi,2 ≥ · · · ≥Wi,K . K is a hyperparameter representing the number of neighbors for estimating Ŷ (i). We provide a detailed derivation and further explanation in Appendix A.
Eq.(5) re-writes the total causal effect as the sum of the causal effect on the prediction of each target sample (i.e.,Effect(i)P ). In Eq.(6), P(Ŷ
(i)|X = x(i,k)) represents the likelihood of Ŷ (i) when x(i,k) is the model input. Eq.(6) shows that Effect(i)P can be approximated by the weighted sum of the likelihood when the model input is the anchor sample x(i) and its KNNs. Since we expect to maximize P(Ŷ (i) = y(i)|X = x(i)), maximizing Effect(i)P equals to maximizing the likelihood of the joint prediction on the ground-truth label y(i).

heading: 3.4 Overall Objective
text: In Eq. 6, the total causal effect EffectP is broken down into the causal effect of each sample Effect(i)P . In this case, maximizing EffectP is to preserve the related knowledge of all samples. As we mentioned before, indiscriminately preserving knowledge may lead to negative transfer. To address this problem, we introduce a similarity threshold θ to select the number of nearest neighbors for each sample automatically. Specifically, for the i-th sample, we truncate the ki (K ≥ ki ≥ 0) nearest neighbors whose similarity is greater or equal
than θ. In this way, we differentiate the strength of knowledge preservation on each sample by selecting the neighbors with small distances to their anchor sample. More interestingly, when ki = 0, i.e., a sample has no neighbors, the Effect(i)P amounts to P(Ŷ (i) = y(i)|X = x(i)), which is exactly the objective of each sample in vanilla fine-tuning. Fig. 2 provides an illustration for our method, where the samples with no neighbors can be seen as a special case of our method. Formally, we define the overall objective as follows:
max EffectP = N∑
i=1
Effect(i)P (7)
= ∑
i∈ST Effect(i)P ︸ ︷︷ ︸ Colliding Effects
+ ∑
i∈SNT Effect(i)P ︸ ︷︷ ︸ Vanilla Fine-Tuning , (8)
= ∑
i∈ST
ki∑
k=0 P(Ŷ (i)|X = x(i,k))Wi,k ︸ ︷︷ ︸
Colliding Effects
(9)
+ ∑
i∈SNT P(Ŷ (i)|X = x(i)) ︸ ︷︷ ︸ Vanilla Fine-Tuning ,
where ∑
k Wi,k = 1,ST = {i|ki > 0},SNT = {i|ki = 0}. Considering the distances between KNNs and their anchor sample are approximated and thus inaccurate, we set Wi,0 = W0 and Wi,1 =
Wi,2 = · · · = Wi,ki = 1−W0ki when ki > 0 for implementation. W0 is a hyper-parameter for controlling the strength of colliding effects. When W0 = 0, the overall target degenerates to the vanilla fine-tuning target. When W0 = 1, the overall target retains knowledge indiscriminately on all samples. In Eq.(9), the second term amounts to the vanilla fine-tuning objective since only the anchor sample’s prediction is computed. In other words, we preserve knowledge for the samples with KNNs and learn new knowledge for the samples without KNNs. The rationale is that the knowledge should be preserved when more samples require it to answer the question. In the proposed causal graph in Fig.(1b), the first and the second term of Eq.(9) correspond to the two causal paths through XT and XNT respectively. We summarized the proposed method in Fig. 2 and Alg. 1 in Appendix A.

heading: 3.5 An Implementation on Commonsense QA
text: In this subsection, we provide an implementation for the causal graph in Fig.(1b) on commonsense QA. We note that the overall objective in Eq. 9 is agnostic to specific downstream tasks and model architectures. The implementation can be different in various tasks or model architectures, and the key is to find proper KNNs. This paper provides an implementation on commonsense QA since PLMs may be endowed with commonsense knowledge in pre-training (Petroni et al., 2019; AlKhamissi et al., 2022), and it is still challenging for models to
capitalize on commonsense (Talmor et al., 2018). We first formulate the commonsense QA as follows: Given a dataset with N samples {(q(i), a(i), {o(i)j }j)}Ni , we train the best model for choosing the gold answer a(i) among options {o(i)j } given a question q(i). More specifically, the input of the i-th sample can be x(i) = q(i)||o(i)1 || · · · ||o (i) j or {x(i)}j = {q(i)||o(i)j }j 4 where || is the string-level concatenation.
Then, we define a metric to search KNNs. A simple solution is to compute the euclidean distance or cosine similarity between the average last hidden states of PLMs. However, this method struggles to capture accurate semantic meanings, and measuring sentence similarity remains challenging. In this regard, we provide a simple heuristic approximation. In most cases, the questions with the same gold answers share the same knowledge. For example, “airplane” is the gold answer to the following questions, and we can use the knowledge about “airplane” to answer them: “What is a fast but expensive way to send small cargo?”; “Where could you find a seat that sometimes vibrates?”; “What has metal wings?”. Therefore, we estimate the similarity between gold answers to cope with the difficulty of evaluating sentence similarity. Since options are usually much shorter than questions, lightweight tools such as spaCy (Honnibal et al., 2020) can be used to retrieve gold answers with close semantic meanings (e.g., “airplane” and “aeroplane”).
At last, we define the input of the i-th sample’s KNNs as x(i,k) = q(i,k)||o(i)1 || · · · ||o (i) j or {x(i,k)}j = {q(i,k)||o(i)j }j . It alleviates the overfitting problem since the model needs to select the correct answer among the options of anchor sample when the question is from its KNNs.

heading: 4 Experiments

heading: 4.1 Settings
text: Datasets. We conduct experiments on 6 datasets: CommonsenseQA(CSQA) (Talmor et al., 2018), OpenBookQA(OBQA) (Mihaylov et al., 2018), ARC (Clark et al., 2018, 2016), QASC (Khot et al., 2020), SocialIQA (SIQA) (Sap et al., 2019), PIQA (Bisk et al., 2020). Since the official test sets of CSQA, QASC, SIQA, and PIQA are not available, we follow (Yasunaga et al., 2021) and use the offi-
4Concatenating all options or each option depends on models.
cial dev sets as test sets and split in-house dev set from the original training sets. The dataset statistics are summarized in Table 6 in Appendix B. Training. Given its popularity, we use RoBERTalarge (Liu et al., 2019b) as the backbone model in default. We also explore T5-large (Raffel et al., 2020) since Khashabi et al. (2020) showed that it excels at answering questions in different formats. Other training details are specified in Appendix B. Competitive Methods. We make comparisons with nine state-of-the-art fine-tuning methods: vanilla fine-tuning, BSS (Chen et al., 2019), ChildTune-F&ChildTune-D (Xu et al., 2021a), Mixout (Lee et al., 2019), NoisyTune (Wu et al., 2022), R3F (Aghajanyan et al., 2020), RecAdam (Chen et al., 2020) and ReInit (Zhang et al., 2020b). For each method, we use the recommended hyperparameters in the paper and source code for a fair comparison. We discuss the implementation details of the fine-tuning methods in Appendix C. Hyper-Parameters. As for the hyperparameters of our methods, we fix K = 5 and search the best W0 in {0.5, 0.7, 0.9, 0.95, 0.97} for each dataset. We use spaCy to estimate the similarity between gold answers. We set θ = 0.99 for PIQA and θ = 1.00 for other datasets (i.e., the gold answers should be matched precisely).

heading: 4.2 Results and Analyses
text: Comparisons with State-Of-The-Art. To demonstrate the effectiveness of our method, we re-implement several strong baselines on commonsense QA datasets using their officially released codes and hyper-parameters. The results are summarized in Table 1. Results show that our method outperforms all fine-tuning methods consistently. On QASC and OBQA, our method achieves 57.57% and 70.76% accuracy, obtaining 3.53% and 2.64% improvements on vanilla fine-tuning.
Why our method better preserves commonsense knowledge from PLMs? The reasons are two-fold. The first reason is that our method utilizes the colliding effect for transferring the “colliding” commonsense knowledge, while other methods do not. For instance, in Fig.2, our method encourages models to update x(i) and its KNNs x(i,1), x(i,2), x(i,3) simultaneously. In this way, the commonsense knowledge about “airplane” that “airplanes deliver small and precious cargo”, “airplanes have metal wings” and “airplanes have seats” can be trans-
ferred jointly, which reduces the risk of over-fitting. We provide more examples from each dataset in Table 3 and Table 10,11, in Appendix F. The second reason is that our method does not directly constrain (e.g., ChildTune-D, Mixout, RecAdam) or modify (e.g., NoisyTune, ReInit) the parameters of fine-tuned models. Empirical results show that these methods encounter negative transfers on some of the datasets. Instead, our method builds
upon the causal inference theory and utilizes the joint prediction as a soft constraint to transfer related knowledge while mitigating negative transfer.
Compared with Knowledge-Graph-Based Methods. Utilizing knowledge graphs such as ConceptNet (Speer et al., 2017) is a common practice for building commonsense QA systems. We compared our method with six knowledgegraph-based methods: Relation Network (Santoro et al., 2017), KagNet (Lin et al., 2019), RGCN(Schlichtkrull et al., 2018), MHGRN(Feng et al., 2020), QAGNN(Yasunaga et al., 2021), SAFE(Jiang et al., 2022). Detailed descriptions and other related works are given in Appendix D. Note that these methods utilize knowledge graphs (KGs) as external knowledge resources, and most of them train graph neural networks (GNNs) for extracting features from KGs. In contrast, our method does not introduce any additional learnable parameters except PLMs and the final fully-connected layer. The result in Table 2 shows that our method out-
performs RGCN, KagNet, and Relation Network by only mining the internal knowledge of PLMs. Furthermore, our method significantly outperforms all the knowledge-graph-based methods under low resource conditions (≤ 20% training data is used), which shows that our method helps PLMs adapt to downstream tasks with less data.
In addition, our method can be easily implemented as a plug-in module by simply substituting the vanilla fine-tuning objective for the causal effect in Eq.(9). We combine our method with QAGNN and SAFE, respectively. Table 2 shows that our approach consistently improves QAGNN and SAFE and achieves superior performances. Therefore, the pre-trained commonsense knowledge benefits downstream tasks even when KGs are introduced. Fine-tuning on a Cyclic Chain of Tasks. To understand how our method preserves knowledge during fine-tuning, we follow Aghajanyan et al. (2020) and design a cyclic chain of tasks:
A→ B → C︸ ︷︷ ︸ Cycle1 → A→ B → C︸ ︷︷ ︸ Cycle2 → · · ·
In our experiment, we set A=CSQA, B=OBQA, and C=QASC for a demonstration. Specifically, we start from a PLM and fine-tune it on CSQA. Then, we use the model fine-tuned on CSQA to initialize the backbone model’s parameters and continue fine-tuning it on OBQA. Table 4 shows that our method retains knowledge significantly better than vanilla fine-tuning. The performances on OBQA and QASC improve at every cycle, suggesting that our method effectively retains knowledge from the previous datasets. Unfortunately, both performances of vanilla fine-tuning and our method on CSQA degrade slightly, showing that negative transfer happens. In this case, vanilla fine-tuning will lead to more serious performance degradation. The experiment is for demonstration, and a better combination of tasks that promote each other may be found. Ablation Study. To verify the effectiveness of our method, we consider the following ablated version of our method: (1) replacing the KNNs (Large,Ours) with randomly selected samples (Rand) or samples with the smallest similarity (Small); (2) searching the KNNs according to the similarity of average last hidden states (Avg) instead of gold answers (Gold, Ours). The result in Table 5 shows that the model learns commonsense
knowledge better when the KNNs share the gold answer with close meaning. Additional Experiments. Due to space constraints, we present the experiments on T5, the hyper-parameter analysis, the experiments on Named Entity Recognition, and further discussions in Appendix E.

heading: 5 Conclusion
text: We propose a novel fine-tuning technique rooted in causal inference for preserving pre-trained knowledge from PLMs. Although many fine-tuning methods have been proposed in recent years, most of them overlooked one or both hidden issues of finetuning, catastrophic forgetting and negative transfer, which result in a dilemma. In this paper, we provide an answer to the dilemma from the casual lens. Impressively, we empirically find that the proposed method achieves the best performance on six commonsense QA datasets and is flexible to be applied to various QA systems and model architectures.
Limitations
There are three limitations on our method. First, we did not verify our method on more generic tasks, such as text classification, yet it is not limited to commonsense QA. Extending our method to other downstream tasks is our future work. Second, our method requires a longer training time and a larger GPU memory since the KNNs require forward and backward propagation additionally. Third, we do not consider the ambiguity of gold answers, which may affect the quality of KNNs. For example, “apple” may refer to a kind of fruit or a technology company.

heading: Acknowledgements
text: The work described in this paper was partially funded by the National Natural Science Foundation of China (Grant Nos. 62272173, 61872148), the Natural Science Foundation of Guangdong Province (Grant Nos. 2022A1515010179, 2019A1515010768).

heading: A A Detailed Derivation for the Colliding Effect
text: Algorithm 1: Causal Effect Tuning Input: D = {(x(i), y(i))}Ni=1: a training set
with N samples; F0: a pre-trained model
Output: F : a fine-tuned model 1 Initialize F ← F0; 2 Compute the KNNs for each sample x(i):
x(i,1), · · · , x(i,ki); 3 while not converge do 4 Compute EffectP according to Eq.(9); 5 F ← argmax
F EffectP ;
6 end 7 return F ;
Without loss of generality, we first define the fine-tuning process formally as follows: Given a pre-trained modelF0 and a dataset with N samples {(x(i), y(i)}Ni=1, we aim to learn a model F which has the best performance on predicting the label y(i). Recall that in Eq.(5), we re-write EffectP as the sum of the causal effect on each prediction Ŷ (i). Now, the outcome node Ŷ in the causal graph becomes Ŷ (i). Then, we need to condition on H0 to utilize colliding effects. Considering when predicting Ŷ (i), x(i) should play an important role. Furthermore, when X = x(i), its hidden feature is simply calculated as h(i)0 = F0(x(i)). Therefore, it is natural to choose h(i)0 as the hidden feature we condition on.
After controlling H0 = h (i) 0 , the meaning of the input node X in the causal graph becomes all samples whose hidden feature is h(i)0 . Unfortunately, due to the sparsity in high dimensional spaces,
only x(i) satisfies this constraint. Intuitively, if we loosen this constraint a bit, the colliding effect will not disappear instantly. Instead, the colliding effect will vanish gradually when the hidden feature becomes farther and farther away from h(i)0 . Put differently, colliding effects still exist when samples bear a resemblance to each other in the hidden space of the pre-trained model.
Now, we provide a derivation as follows:
Effect(i)P
= P(Ŷ (i)|H0 = h(i)0 , P = p)− P(Ŷ (i)|H0 = h(i)0 , P = 0) (10)
= N∑
k=1
(P(Ŷ (i)|X = x(k), H0 = h(i)0 ) (11)
P(X = x(k)|H0 = h(i)0 , P = p) − P(Ŷ (i)|X = x(k), H0 = h(i)0 ) P(X = x(k)|H0 = h(i)0 , P = 0))
= N∑
k=1
P(Ŷ (i)|X = x(k))(P(X = x(k)|H0 = h(i)0 , P = p)
(12)
− P(X = x(k)|H0 = h(i)0 , P = 0))
≈ N∑
k=1
P(Ŷ (i)|X = x(k))P(X = x(k)|H0 = h(i)0 , P = p)
(13)
= N∑
k=1
P(Ŷ (i)|X = x(k)) (14)
P(H0 = h(i)0 |X = x(k), P = p)P(X = x(k)|P = p) P(H0 = h(i)0 |P = p) = N∑
k=1
P(Ŷ (i)|X = x(k))WP (x(i), x(k)) (15)
≈ K∑
k=0
P(Ŷ (i)|X = x(i,k))WP (x(i), x(i,k)) (16)
Eq.(10) is deduced from Eq.(2) and the condition of H0 = h (i) 0 . Eq.(11) expands Eq.(10) as the sum of all N samples. In Eq.(12), P(Ŷ (i)|X,H0) = P(Ŷ (i)|X) because X is the only mediator (Pearl, 2009) from P to Ŷ (i). In Eq.(13), we approximate P(X = x(k)|H0 = h(i)0 , P = 0) as zero because the likelihood of X = x(k) is small when the model is randomly initialized. Eq.(14) is obtained by applying Bayes formula to Eq.(13). In Eq.(14), P(H0 = h (i) 0 |P = p) and P(X = x(k)|P = p) are intractable and can be seen as constants. We note that the likelihood term P(H0 = h (i) 0 |X = x(k), P = p) represents how likely the hidden feature is h(i)0 when the input sample is x
(k). Obviously, the likelihood is the largest when k = i and becomes smaller when the hidden feature of
x(k) become farther away from h(i)0 . Therefore, the fractional term of Eq. 14 can be regarded as a scaling factor of the likelihood P(Ŷ (i)|X = x(k)). In Eq.(15), we re-write the fractional term of Eq.(14) as a function of x(i) and x(k) since h(i)0 = F0(x(i)). In Eq.(15), we truncate the top K samples, which are closest to x(i), in the hidden space of the pretrained model. Besides, we let x(i,0) = x(i) since x(i) has the largest similarity with itself. Additionally, we let ∑K k=0WP (x
(i), x(i,k)) = 1 to ensure that the joint prediction is a probability distribution over categories.

heading: B Training Details
text: The dataset statistics is in Table 6. All models are implemented based on Pytorch (Paszke et al., 2019) and Huggingface (Wolf et al., 2019). We use the default hyper-parameters of RoBERTa and T5 according to the Huggingface implementation. Following Yasunaga et al. (2021); Khashabi et al. (2020), we concatenate all options as input when the backbone is T5 and concatenate each option respectively when the backbone is RoBERTa. We tuned the batch size in {64, 128}, the learning rate of the backbone model in {5e-5, 2e-5, 1e-5}. Before fine-tuning RoBERTa, a randomly initialized fully connected (FC) layer is added on top of RoBERTa, and the learning rate of the FC layer is 1e-2. We use RAdam (Liu et al., 2019a) as the optimizer and use a constant learning rate scheduler. The weight decay is 1e-2, and the maximum gradient norm is 1.0. For each dataset, the training hyper-parameters are the same for all methods for a fair comparison. We select the best model according to the performance on the dev set and report the test accuracy of the chosen model. The experiments are run on GeForce RTX 3090 GPU. Each experiment is repeated five times. Since we do not introduce any learnable parameters except PLMs, the total number of parameters of our method is the same as PLMs (RoBERTa-large and T5-large have 355M and 770M parameters, respectively).

heading: C Details of the Competitive Fine-tuning Methods
text: The details of the competitive fine-tuning methods are as follows. Note that we use recommended hyper-parameters in the paper or the source code for a fair comparison.
• vanilla fine-tuning: fine-tuning has been
proven to be a simple and effective method of adapting large PLMs to downstream tasks.
• BSS (Chen et al., 2019) 5: BSS focuses on mitigating negative transfer by penalizing the small singular values of the feature matrix. We penalize the smallest singular value, and the weight of the regularization term is set as 1e-3 as recommended.
• ChildTune-F&ChildTune-D (Xu et al., 2021a) 6: ChildTune-F&ChildTune-D update a subset of parameters (called child network) of large PLMs in the backward process. ChildTuneD utilizes the Fisher Information Matrix estimated by the pre-trained model to determine the child network. ChildTune-F uses Bernoulli distribution to determine the child network.
• Mixout 7 (Lee et al., 2019): Mixout randomly mixes the parameters of the pre-trained and the fine-tuned model to regularize the finetuning process. In the experiments, the mixing probability p is set as 0.9.
• NoisyTune (Wu et al., 2022): NoisyTune adds uniform noises to the parameter of the pretrained model based on their standard deviations. The scaling factor λ, which controls the relative noise intensity, is set as 0.15.
• R3F 8 (Aghajanyan et al., 2020): R3F alleviates representational collapse by introducing parametric noise. R3F generates noise from either a normal or uniform distribution.
• RecAdam 9 (Chen et al., 2020): RecAdam optimizes a multi-task objective and utilize an annealing coefficient to gradually shift the objective from pre-training to downstream tasks.
• ReInit (Zhang et al., 2020b): Zhang et al. (2020b) verified that transferring the top pretrained layers slows down learning and hurts performance. ReInit re-initializes the top layers of PLMs when adapting to new tasks. In our experiments, we re-initialize the top 3 transformer block.
5https://github.com/thuml/Batch-Spectral-Shrinkage 6https://github.com/alibaba/AliceMind/tree/main/
ChildTuning 7https://github.com/bloodwass/mixout 8https://github.com/facebookresearch/fairseq/tree/main/ examples/rxf 9https://github.com/Sanyuan-Chen/RecAdam

heading: D Related Works of Commonsense QA
text: Commonsense reasoning is a key pillar of human cognition and intelligence, but it is still a longstanding challenge for deep learning systems (Xu et al., 2021b; Wang et al., 2020b; Talmor et al., 2018). Current question and answering (QA) systems rely on external sources such as knowledge graphs (e.g., ConceptNet) (Yasunaga et al., 2021; Feng et al., 2020; Wang et al., 2020a; Lin et al., 2019), knowledge bases (e.g., Wiktionary) (Xu et al., 2021b) and generative pre-trained language models (e.g., GPT3 (Brown et al., 2020)) (Liu et al., 2022b; Yang et al., 2020; Rajani et al., 2019; Liu et al., 2022a), and achieve remarkable success. Despite the remarkable success, collecting highquality external knowledge is usually expensive, and noisy knowledge is easily introduced (Liu et al., 2022b). In this paper, we present a novel finetuning method that retains commonsense knowledge from PLMs since they are exposed to a colossal amount of data in pre-training and inherently knowledge bases (Petroni et al., 2019; AlKhamissi et al., 2022). Different from the existing commonsense QA models, our method does not rely on KGs or GNNs. Moreover, our method can be a plug-in module to enhance the performance of commonsense QA models. We compared six commonsense QA methods in the experiments:
• Relation Network (Santoro et al., 2017) utilizes a relational reasoning structure over the knowledge graph;
• KagNet (Lin et al., 2019) aggregates information with graph convolutional networks and LSTMs, and a hierarchical path-based attention mechanism;
• RGCN (Schlichtkrull et al., 2018) extends the graph convolutional network with relationspecific weights;

heading: E Additional Experimental Results
text: Experiments on T5. Our method is modelagnostic since it only requires computing the joint prediction. Different from discriminant models such as RoBERTa, T5 is a generative model whose
output is in text format. Following Khashabi et al. (2020), we concatenate a question and its all options with prefixes (a), (b), (c), ... as the input, and expect the model to output the ground-truth option in text format. To adapt our model to T5, we substitute the prediction from the probability distribution over options to the probability distribution over vocabulary. In this way, we encourage T5 to generate the same gold answer when the input is the question of the anchor sample and its KNNs.
The experimental result is in Table 7. From the result, we find that our method still improves vanilla fine-tuning consistently, which demonstrates that our approach can be applied to various architectures. Besides, we also apply ReInit on T5 as in RoBERTa. Unfortunately, T5 fails to adapt to downstream tasks when only a few parameters are re-initiated (e.g., the self-attention layer or the cross-attention layer in the topmost transformer block). We conjecture that the final language modeling head (LM head), which maps the last hidden states to the vocabulary space, hinders the knowledge of the bottom layers to transfer to new tasks. Different from ReInit, our method is also applicable to T5 because it has no assumptions about the model architecture.
Hyper-parameter Analysis. We consider two hyper-parameters that may influence the effectiveness of our method: the number of neighbors K and the weight for controlling the strength of colliding effects W0. Fig. 3a and 3b show that our method is robust when various W0 are chosen. When the backbone is RoBERTa-large, our
method achieves the best performance when W0 = 0.7 on OBQA, ARC-Easy, and ARC-Challenge; when W0 = 0.9 on QASC and SIQA; and when W0 = 0.97 on CSQA. When the backbone is T5large, our method achieves the best performance when W0 = 0.9 on QASC; when W0 = 0.95 on CSQA, OBQA, ARC-Easy, and PIQA; and when W0 = 0.97 on ARC-Challenge and SIQA. In addition, we find that some datasets, such as CSQA, require more domain-specific knowledge while some datasets, such as OBQA, require more pre-trained knowledge. The result of K in Table 8 shows that a larger K is beneficial. Our method is also robust to K because the similarity threshold θ truncates the number of nearest neighbors for each sample.
Differences between Our Method and Data Augmentation. Our method recombines the KNN questions with the options of the anchor sample. A reasonable conjecture is that our method “adds” KNN samples to enhance generalization ability. We do the following experiment to test the hypothesis: We add the same KNN samples generated by our method into the original training set for finetuning. The result shows that its improvement is not statistically significant. The reason may be as follows: Recall that we set θ = 1.0 on five out of six datasets where the gold answer of the anchor sample and its KNNs should be matched precisely. Therefore, on most datasets, the KNN samples recombine with the options containing their original gold answer, suggesting that they provide no additional information. Besides, the newly added samples change the data distribution of the original
training set. Experiments on Named Entity Recognition. To demonstrate that CET has the potential to improve more generic tasks, we apply CET to another task, Named Entity Recognition (NER), which is a fundamental task in NLP. First, NER can be formulated as a word-level classification task. Therefore, both "anchor" and KNNs refer to a specific word. Then, we use the Euclidean distance as a metric to find the KNNs in the space of the last hidden states of PLMs. Considering NER focuses on recognizing entities, we only compute the causal effects on entity words. During training, both the sentences containing anchor and KNN words are fed into the model. And then, we compute the joint prediction as in Eq.6 by combining the score prediction of the anchor word and the corresponding KNN words. Finally, we jointly optimize the causal effects of entity words and the vanilla fine-tuning objective of non-entity words as in Eq.9.
We choose three widely used datasets for experiments: CoNLL2003 (Sang and De Meulder, 2003), Ontonotes5 (Hovy et al., 2006), I2B2 (Murphy et al., 2010). Following previous experiments, we use RoBERTa-large as the backbone. The result in Table 9 indicates that CET outperforms vanilla fine-tuning consistently.
To better understand CET, here is an example from CoNLL2003: The anchor is a Location entity "California" in the sentence ". . . Marine Laboratories in California say . . . ". Its three nearest neighbours are 1. "California" in the sentence "At California, Tim . . . "; 2. "Oakland" in the sentence "OAKLAND AT NEW YORK"; 3. "Florida" in the sentence "At Florida, . . . ". As shown, the anchor and KNN words share the related prior knowledge of PLMs, which can also be illustrated in Figure 2.
F More examples of Colliding Effects
ACL 2023 Responsible NLP Checklist

heading: A For every submission:

heading: 3 A1. Did you describe the limitations of your work?
text: In the Limitations section
7 A2. Did you discuss any potential risks of your work? Our work does not involve any sensitive data or sensitive tasks.

heading: 3 A3. Do the abstract and introduction summarize the paper’s main claims?
text: In abstract and section 1.
7 A4. Have you used AI writing assistants when working on this paper? Left blank.
B 3 Did you use or create scientific artifacts?

heading: In section 5 and appendix B.

heading: 3 B1. Did you cite the creators of artifacts you used?
text: In section 5 and appendix B. We cite all the datasets and codes.
7 B2. Did you discuss the license or terms for use and / or distribution of any artifacts? All the datasets and codes can be used for research purposes.
7 B3. Did you discuss if your use of existing artifact(s) was consistent with their intended use, provided that it was specified? For the artifacts you create, do you specify intended use and whether that is compatible with the original access conditions (in particular, derivatives of data accessed for research purposes should not be used outside of research contexts)? The use of existing artifacts was consistent with their intended use.
7 B4. Did you discuss the steps taken to check whether the data that was collected / used contains any information that names or uniquely identifies individual people or offensive content, and the steps taken to protect / anonymize it? All the datasets and codes can be used for research purposes and do not contains any information that names or uniquely identifies individual people or offensive content.
7 B5. Did you provide documentation of the artifacts, e.g., coverage of domains, languages, and linguistic phenomena, demographic groups represented, etc.? All the datasets and codes are available for research purposes. Therefore, we don’t need to provide documentation for them.
3 B6. Did you report relevant statistics like the number of examples, details of train / test / dev splits, etc. for the data that you used / created? Even for commonly-used benchmark datasets, include the number of examples in train / validation / test splits, as these provide necessary context for a reader to understand experimental results. For example, small differences in accuracy on large test sets may be significant, while on small test sets they may not be. In section 5 and appendix B.
C 3 Did you run computational experiments?

heading: In section 5 and appendix B.

heading: 3 C1. Did you report the number of parameters in the models used, the total computational budget
text: (e.g., GPU hours), and computing infrastructure used? In section 5 and appendix B.
The Responsible NLP Checklist used at ACL 2023 is adopted from NAACL 2022, with the addition of a question on AI writing assistance.

heading: 3 C2. Did you discuss the experimental setup, including hyperparameter search and best-found
text: hyperparameter values? In section 5 and appendix B.

heading: 3 C3. Did you report descriptive statistics about your results (e.g., error bars around results, summary
text: statistics from sets of experiments), and is it transparent whether you are reporting the max, mean, etc. or just a single run? In section 5 and appendix B.

heading: 3 C4. If you used existing packages (e.g., for preprocessing, for normalization, or for evaluation), did
text: you report the implementation, model, and parameter settings used (e.g., NLTK, Spacy, ROUGE, etc.)? In section 5 and appendix B.
D 7 Did you use human annotators (e.g., crowdworkers) or research with human participants? Left blank.
D1. Did you report the full text of instructions given to participants, including e.g., screenshots, disclaimers of any risks to participants or annotators, etc.? Not applicable. Left blank.
D2. Did you report information about how you recruited (e.g., crowdsourcing platform, students) and paid participants, and discuss if such payment is adequate given the participants’ demographic (e.g., country of residence)? Not applicable. Left blank.
D3. Did you discuss whether and how consent was obtained from people whose data you’re using/curating? For example, if you collected data via crowdsourcing, did your instructions to crowdworkers explain how the data would be used? Not applicable. Left blank.
D4. Was the data collection protocol approved (or determined exempt) by an ethics review board? Not applicable. Left blank.
D5. Did you report the basic demographic and geographic characteristics of the annotator population that is the source of the data? Not applicable. Left blank.

heading: Future Work
text: Extending our method to other downstream tasks is our future work. Second, our method requires a longer training time and a larger GPU memory since the KNNs require forward and backward propagation additionally. Third, we do not consider the ambiguity of gold answers, which may affect the quality of KNNs. For example, “apple” may refer to a kind of fruit or a technology company