Manuscript Offprint
arXiv:2610.12837COFFEQA: Counterfactual-Guided Few-Shot Distillation for LLM Question Answering
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Knowledge distillation aims to train a smaller student model to mimic a larger teacher model for resource-constrained environments. However, the process of distillation is typically data-intensive and computationally expensive, particularly for generative tasks. Few-shot distillation offers an alternative by transferring teacher knowledge using limited training samples. However, we observe that few-shot distillation performance is heavily dependent on the choice of these training samples. In fact, we demonstrate that using more uncertain samples near the teacher's decision boundary can significantly deteriorate distillation performance. Motivated by this observation, we propose Counterfactual-guided Few-shot Distillation in open-book Question Answering (COFFEQA), a novel strategy that aptly uses counterfactuals to provide additional supervision around challenging factual samples. In the generative QA setting, we define a counterfactual as a minimally modified context that induces the teacher to change its response to an alternative answer. We provide geometric insights on how factual-counterfactual pairs can constrain the deviation between the teacher's and student's decision boundaries. We further introduce a new metric, Context Following Difficulty (CFD) that further validates counterfactuals prior to distillation based on agreement with the intended alternative answer and dependence on the modified context. COFFEQA uses CFD-validated factual-counterfactual pairs for few-shot distillation. Experiments across five in-domain and three out-of-domain QA benchmarks using T5 and Qwen2.5 families show that COFFEQA outperforms factual-only distillation baselines under the same few-shot budget. For instance, on TriviaQA, COFFEQA improves over the factual-only baseline by 8.77 average EM points and 9.98 average F1 points under the T5 setting with 32 few-shot pairs.
1 INTRODUCTION
Large language models (LLMs) have achieved remarkable success across a wide range of natural language processing tasks (Achiam et al., 2023; Chung et al., 2024; Gou et al., 2021; Raffel et al., 2020; Fang et al., 2026). However, their increasing size and computational requirements make deployment in resource-constrained environments particularly challenging (Kaplan et al., 2020; Brown et al., 2020; Strubell et al., 2019; Hoffmann et al., 2022). This motivates the need for compact models with low training and inference costs that preserve task-relevant capabilities of larger models (Liang et al., 2023; Saadi & Wang, 2025; Liu et al., 2024; Dissanayake et al., 2024). Knowledge distillation (Hinton et al., 2015) (see surveys Gou et al. (2021); Sanh et al. (2019); Xu et al. (2024b)) seeks to address this challenge by transferring knowledge from a large teacher model to a smaller student model. However, most distillation approaches typically rely on large-scale datasets or extensive supervision from the teacher, thus incurring prohibitive training costs for already resource-intensive language models (Sanh et al., 2019; Sun et al., 2019; Jiao et al., 2020; Wang et al., 2020; Dissanayake & Dutta, 2025; Hamman et al., 2025). This leads to our primary question: How can we perform data-efficient distillation in LLMs?
Towards addressing this question, our work studies few-shot distillation for generative tasks, with a focus on open-book question answering. We find that the performance of few-shot distillation is heavily dependent on the choice of the distillation dataset, consistent with the broader importance

Figure 1: Counterfactual-guided few-shot distillation framework. We begin with (1) a few-shot factual QA dataset and (2) generate a counterfactual candidate for a factual sample. (3) The generated counterfactual is evaluated using the teacher model with (4) our proposed Context Following Difficulty (CFD) metric and accepted if it satisfies the CFD threshold . (5) The CFD-validated counterfactuals are then paired with their corresponding factuals and used to distill the student model.
of data selection for efficient LLM training (Fu et al., 2026; Zhou et al., 2023). In particular, samples near the teacher's decision boundary can significantly deteriorate distillation performance (see Fig. 6 in Section C), also consistent with prior findings on knowledge transfer around decision boundaries (Chen et al., 2025). This motivates us to provide additional supervision around these challenging regions while maintaining a limited few-shot budget. To achieve this, we leverage counterfactual examples. Counterfactual-based data augmentation has improved classification performance (Kaushik et al., 2019; Wu et al., 2021; Ross et al., 2021; Gardner et al., 2020; McAleese & Keane, 2024; Bhattacharjee et al., 2024; Egea et al., 2025) by encouraging models to capture causal dependencies and avoid shortcut learning (Guo et al., 2023; Chen et al., 2023b). However, its applicability to few-shot distillation for generative tasks remains largely unexplored. Unlike classification, generative tasks produce free-form outputs, making counterfactuals non-trivial to define. In generative tasks, we define a counterfactual to be a minimally modified input that changes the expected output while preserving overall semantic consistency, such as modifying supporting context in a question to induce a different answer (Guo et al., 2023; Longpre et al., 2021; Paranjape et al., 2022; Köksal et al., 2023; Yu et al., 2023).
In this work, we propose Counterfactual-guided Few-shot distillation in open-book Question Answering (COFFEQA), a novel strategy for few-shot distillation that aptly uses counterfactuals to provide additional supervision around challenging factual samples near the teacher's decision boundary. We demonstrate how selecting high-quality counterfactuals can guide knowledge transfer more effectively using extremely limited few-shot budget. Our main contributions are as follows:
Counterfactual-guided few-shot distillation for generative tasks. We show that few-shot distillation becomes particularly challenging for factuals near the teacher's decision boundary, where the teacher has a smaller margin between its preferred answer and competing alternatives. Motivated by this observation, we propose COFFEQA, a novel framework which leverages counterfactuals for few-shot distillation in open-book QA. Rather than relying solely on factual supervision, COFFEQA pairs challenging factuals with their counterfactuals that expose changes in the teacher's response under minimal modifications to the input context, providing additional supervision around the teacher's decision boundary. This reduces dependence on large factual training corpora and improves training efficiency under limited supervision (see Figure 1 for an overview).
Geometric analysis of counterfactual-guided knowledge transfer. We first introduce a notion of decision boundaries for the teacher and student in the context-embedding space, motivated by the fact that variations in the input context can lead to different answers. Our formulation enables us to analyze distillation in open-book QA from a geometric perspective. Specifically, we show that factual-counterfactual pairs can act as probes for the student to approximate the local geometry of the teacher's decision boundary. To quantify the deviation between the teacher and student, we use the Hausdorff distance (Rockafellar & Wets, 1998), which measures the worst-case deviation between their decision boundaries. We show in Proposition 1 that this deviation is bounded by the magnitude of the counterfactual perturbations and their coverage of the teacher's decision boundary. Importantly, factuals near the teacher's decision boundary can require smaller perturbations to induce a change in the teacher's response, which can lead to tighter teacher-student boundary alignment.
Context Following Difficulty (CFD) for counterfactual validation. Although we generate counterfactuals by perturbing the original input context to induce a targeted alternative answer, not all generated examples are truly valid with respect to the teacher. The teacher may not produce same target answers using the modified context or may still be able to infer them without actually relying on the context. Such cases weaken the intended causal relationship that the student was intended to learn from the teacher and may encourage shortcut learning. To address this issue, we introduce a new metric Context Following Difficulty (CFD) to evaluate generated counterfactuals before distillation. CFD jointly considers whether the teacher produces the intended alternative answer and whether that answer becomes more predictable when conditioned on the modified context. COFFEQA uses CFD-validated counterfactuals, ensuring that the resulting supervision better captures the teacher's context-dependent behavior.
Empirical evaluation. We conduct comprehensive experiments across five in-domain and three out-of-domain benchmarks using the T5 (Raffel et al., 2020) and Qwen2.5 (Bai et al., 2023) model families. The in-domain benchmarks include NaturalQuestions, SQuAD, NewsQA, TriviaQA, and HotpotQA, while the out-of-domain benchmarks include DROP, DuoRC, and RelationExtraction (Fisch et al., 2019). We evaluate COFFEQA with standard knowledge distillation (KD), sequence-level knowledge distillation (SeqKD), and layer-wise distillation (LWD) baselines, under the same few-shot training budget. Across these settings, COFFEQA outperforms factual-only baselines. For instance, on TriviaQA, COFFEQA improves over the KD baseline by 8.77 average EM points and 9.98 average F1 points under the T5 setting with 32 few-shot pairs.
Counterfactual Question Answering. Counterfactual reasoning has recently gained traction in question answering (QA) (Ross et al., 2022; Khashabi et al., 2020; Huang et al., 2025). DisentQA (Neeman et al., 2023) uses counterfactual supervision to separate parametric and contextual knowledge (Xu et al., 2024a; Wang et al., 2023a), while IfQA (Yu et al., 2023) provides a benchmark for QA under hypothetical scenarios that require reasoning beyond factual retrieval. Counterfactual reasoning has also been studied in multi-hop QA (Guo et al., 2023) and CofCA (Wu et al., 2024), where counterfactual inference is used to mitigate shortcut reasoning. Retrieval-guided approaches further construct counterfactuals through context and answer modifications (Paranjape et al., 2022; Dixit et al., 2022). While these works demonstrate the value of counterfactuals for improving robustness and reasoning in QA, they do not study how they can facilitate knowledge distillation.
Distillation in LLMs. Knowledge Distillation (Hinton et al., 2015) aims to train smaller student models to mimic larger teacher models, with extensions to sequence-level distillation (Xu et al., 2024b; Kim & Rush, 2016; Gu et al., 2024; Yang et al., 2025), task-specific distillation (Dissanayake et al., 2024; Sanh et al., 2019; Team et al., 2024; Wang et al., 2025), and layer-wise distillation (Jiao et al., 2020). Few-shot distillation has been studied for transferring pretrained transformer knowledge in tabular classification (Dissanayake & Dutta, 2025) and multiple-choice question answering (Sutanto et al., 2025). In particular, Sutanto et al. (2025) use an LLM to generate multiple-choice questions and answer options, together with probability scores that are distilled into an encoder-only student model. However, their approach relies on a predefined answer-choice space, making it less directly applicable to generative open-book QA, where the student produces free-form answers. While generative and instruction-level distillation often rely on direct supervision or synthetic data (Hsieh et al., 2023; Wang et al., 2023b; Gu et al., 2024), only a few recent works have investigated counterfactuals for knowledge transfer. DISCO (Chen et al., 2023a) generates counterfactual examples using an LLM and employs a task-specific teacher to filter the generated examples, which are then used as an augmented dataset to train a smaller student model. Notably, DISCO is different from standard distillation via aligning representations since the teacher primarily serves as a data-filtering mechanism rather than directly transferring its predictive behavior to the student through a distillation loss. Moreover, its empirical evaluation focuses on natural language inference, a classification task with a predefined label space. Another related work Hamman et al. (2025) study counterfactual supervision for few-shot distillation, but also focus on classification settings. These approaches do not address generative tasks, where the outputs are open-ended. In contrast, we specifically focus on few-shot knowledge distillation for generative open-book QA. Our approach is motivated by the difficulty of distilling with factuals near the teacher's decision boundary and uses counterfactuals to provide additional supervision around these challenging regions. We also provide new geometric insights on counterfactual-guided knowledge transfer and a new metric CFD to further check counterfactual validity in open-book QA.
2 COFFEQA: COUNTERFACTUAL-GUIDED FEW-SHOT DISTILLATION
Our strategy is motivated by the observation that factual samples near the teacher's decision boundary are particularly challenging to distill under limited supervision. We use margin sampling (Scheffer et al., 2001) as an operational proxy for boundary proximity, where smaller teacher prediction margins indicate boundary near samples. Empirically, we observe that distillation performance degrades as this margin decreases; a detailed analysis is provided in Section C. Motivated by this observation, COFFEQA pairs boundary-near factuals with their counterfactuals that expose how the teacher's response changes under minimal variations of the input context. We first define and describe the counterfactual generation process, and then geometrically analyze how factual-counterfactual pairs facilitate teacher-student boundary alignment. Finally, we introduce Context Following Difficulty (CFD) to validate generated counterfactuals and present the overall COFFEQA distillation framework.
2.1 COUNTERFACTUAL DEFINITION AND GENERATION
We define counterfactual generation for open-book QA as constructing minimally modified training examples that preserve the original question while changing the evidence to support a different answer. Given a triplet , where is the question, is the context, and is the answer, the counterfactual generation framework constructs a counterfactual by modifying the context using an alternative answer. The resulting counterfactual triplet is denoted as . We generate counterfactuals using GPT-4o-mini (OpenAI, 2024) in three stages. First, the answer is classified into one of five entity types: person, location, organization, date, or numeric; samples outside these categories are excluded. Second, GPT-4o-mini generates an alternative answer of the same entity type that is similar in category but distinct from . Previously generated alternatives are excluded to encourage diversity across generation attempts. Finally, GPT-4o-mini is provided with the original triplet and to generate the counterfactual context by minimally editing . Specifically, occurrences of are replaced with , together with any related references that must be changed to keep the passage grammatically consistent. As a result, the modified context supports as the answer to the same question , yielding the counterfactual triplet . The system and user prompts used are shown in Figure 2. Additional prompt details are provided in Appendix D.
Counterfactual Context Generation: System Prompt
You are an expert at creating counterfactual reading-comprehension passages for QA training data. Given an original context that supports a specific answer, you rewrite it MINIMALLY so that it instead unambiguously supports a different target answer, by replacing occurrences of the original answer (and grammatically-dependent references to it) with the target answer, while leaving everything else in the passage unchanged. Do not add explanations or extra content.
Counterfactual Context Generation: User Prompt
Question: {question}, Original context (supports answer “{original_answer}”): {original_context}
Target answer (the new counterfactual answer): “{target_answer}”
Rewrite the context above so that it minimally changes to unambiguously support “{target_answer}” as the answer to the question, instead of “{original_answer}”. Replace occurrences of “{original_answer}” (and any grammatically-dependent references to it) with “{target_answer}”, keeping everything else in the passage exactly the same. Do not add commentary. Respond with ONLY: {“reasoning”: "<1-2 sentences on what you changed>”, "counterfactual_context": "<the full rewritten context>}”
Figure 2: Counterfactual context generation prompts. System and user prompts used to minimally modify the factual context C into a counterfactual context that supports the target answer .
2.2 GEOMETRIC ANALYSIS OF COUNTERFACTUAL-GUIDED KNOWLEDGE TRANSFER
We provide a geometric perspective on how factual-counterfactual pairs can facilitate knowledge transfer. We first introduce a notion of a decision boundary for open-book QA. While classification tasks typically consider a label-flipping boundary, we define a context-response boundary in the context-embedding space. In classification, the boundary separates regions where two classes have equal probabilities. In contrast, in open-book QA, it represents the transition region in context embedding space where the model shifts from generating one answer to another answer. In open-book QA, the context space may contain regions corresponding to the factual answer A, the intended counterfactual answer , and other answer regions, different from both A and corresponding to out-of-context or unrelated outputs. Our analysis focuses specifically on the boundary between the A and response regions, as this is the boundary relevant to factual-counterfactual supervision. Our CFD-based validation helps identify and reject counterfactual candidates that induce responses corresponding to the other answer regions before distillation. We therefore restrict the geometric analysis to the boundary between factual answer space (A) and intended counterfactual answer space. We use the Hausdorff distance (Rockafellar & Wets, 1998) to quantify the worst-case deviation between the teacher context-response boundary and the student context-response boundary and derive an upper bound for this deviation in Proposition 1 (The proof can be found in Appendix E).
Definition of Hausdorff Distance (Rockafellar & Wets, 1998). Let be a metric space. For each pair of non-empty subsets and , the Hausdorff distance between and is defined as:
This measures the maximum of the minimum distances between two sets, capturing the worst-case geometric deviation. (see Figure 3).
Proposition 1 Let C be the space of context embeddings, arbitrary input context, input question, factual answer, and counterfactual answer. Consider a teacher and a student with response functions and . The respective context-flipping boundaries can be defined as the sets:

Figure 3: Visualizing the Hausdorff distance between and .
Suppose there exists a factual-counterfactual paired dataset for the above that satisfies three conditions: (1) Minimal context perturbation in context embedding space is bounded by (i.e., ), (2) Exact answer generation: where
, (3) -spread boundary coverage: Counterfactuals are well-distributed across the context-response boundaries with spread , i.e., if , then such that . This applies for as well. i.e., if , then such that .
Then, the Hausdorff distance between the teacher boundary and student boundary satisfies: .
Intuition behind proposition and assumptions. Proposition 1 highlights two properties of factual-counterfactual supervision that govern teacher-student boundary alignment: the magnitude of the counterfactual perturbations ( ) and the coverage of the context-response boundary ( ). First, each factual-counterfactual pair provides supervision across a local change in the teacher's response. Importantly, when the factual sample is already close to the teacher's decision boundary, a smaller contextual perturbation is sufficient to cross the boundary and induce the alternative response . Therefore, starting from boundary-near factual samples leads to a smaller upper bound on the perturbation , tightening the bound. Although those samples are difficult under factual-only supervision, their proximity to the boundary makes them useful starting points for constructing local counterfactual supervision. Second, the boundary coverage condition captures how well the induced crossing points cover both the context-response boundaries. Better coverage corresponds to a smaller , tightening the bound. Thus, we provide a geometric characterization of how local counterfactual perturbations and boundary coverage relate to teacher-student boundary deviation.
The analysis above also assumes that the student model agrees with the teacher model on the paired factual and counterfactual samples (Assumption (2) Exact answer generation). This idealized condition captures the objective of distillation, where the student is trained to reproduce the teacher's behavior on the available supervision. More importantly, the analysis also relies on the generated counterfactual context to induce the intended alternative answer . In practice, this may not be guaranteed due to inherently stochastic and unpredictable generative behavior of LLMs Holtzman et al. (2019). The teacher may fail to produce , or conditioning on may provide only limited additional predictive benefit for . For realization of this objective in our implementation, we therefore introduce a new metric Context Following Difficulty (CFD) in the following section to validate generated counterfactuals before they are used for knowledge distillation.
(a) Incorrect counterfactual (unrelated answer)
The counterfactual context contains the target answer, but the teacher does not follow it and generates an unrelated answer.
Question (Q): Who is the youngest grand master in chess?
Original context :
... 1950 | David Bronstein | Soviet Union | 26 years ... 2002 | Sergey Karjakin | Ukraine | 12 years, 7 months ...
Original answer (A): Sergey Karjakin
Counterfactual context :
... 1950 | David Bronstein | Soviet Union | 26 years ... 2002 | Magnus Carlsen | Ukraine | 12 years, 7 months ...
Target answer : Magnus Carlsen
Teacher output: David Bronstein X
AAθ: 0
: 2.475
: 1.990
CLRθ:
0.804
CFDθ:
803991
Explanation: The target is inserted into the last row of a record table, still paired with Ukraine (mismatching evidence). The teacher generates an unrelated answer, copying the first row (David Bronstein), and the loss for barely changes . With and , this example is rejected.
(b) Failed to change the prediction
The counterfactual context contains the target answer but retains conflicting evidence, so the teacher's prediction does not switch to the target.
Question (Q): When did the Dutch settle in New York?
Original context :
... In 1624, it became a provincial extension of the Dutch Republic and was designated as the capital of the province in 1625.
Original answer (A): 1624
Counterfactual context :
... In 1640, it became a provincial extension of the Dutch Republic and was designated as the capital of the province in 1625.
Target answer : 1640
Teacher output: 1625 X
AAθ: 0
: 4.338
: 0.677
CLRθ:
0.156
CFDθ:
156172
Explanation: reduces the loss for (4.338 → 0.677, ) but still conflicts: the capital is designated in 1625, before the 1640 settlement. The teacher answers the retained year 1625. With and , this example is rejected.
(c) Correct target, but weakly context-dependent
The teacher generates the target answer, but the counterfactual context provides only limited additional evidence for the prediction.
Question (Q): Number of electrons in the M shell of silicon?
Original context :
Silicon (Si) has atomic number 14.
Electron configuration: 2, 8, 4.
The M shell of silicon has 4 electrons.
Original answer : 4
Counterfactual context :
Silicon (Si) has atomic number 14.
Electron configuration: 2, 8, 6.
The M shell of silicon has 6 electrons.
Target answer : 6
Teacher output: 6 √
AAθ: 1
: 1.873
: 1.374
CLRθ:
0.733
CFDθ:
0.733
Explanation: The teacher generates ("6"), but only modestly reduces the loss (1.873 → 1.374, ). also conflicts: the atomic number is still 14, which does not match the configuration 2, 8, 6. With and , this example is rejected.
(d) Correct and context-dependent
The counterfactual context successfully induces the target answer, and the teacher's prediction strongly depends on the context.
Question (Q): Who gets married in The Secret Life of the American Teenager?
Original context :
... In the final season, Adrian and Ben get married ...
Original answer (A): Adrian
Counterfactual context :
... In the final season, Aiden and Ben get married ...
Target answer : Aiden
Teacher output: Aiden √
AAθ: 1
: 5.367
: 0.285
CLRθ:
0.053
CFDθ:
0.053
Explanation: Without the context, the target answer ("Aiden") is difficult for the teacher to predict (loss 5.367). With the counterfactual context, the loss dramatically decreases to 0.285 (), indicating strong contextual dependence. With and , this example is accepted.
Figure 4: Illustrative examples of CFD-based counterfactual evaluation from the NQ dataset. The four cases demonstrate how Answer Agreement (AA) and Contextual Loss Ratio (CLR) complement each other in evaluating generated counterfactual candidates.
2.3 CONTEXT FOLLOWING DIFFICULTY (CFD) FOR COUNTERFACTUAL VALIDATION
Generated counterfactual samples should be evaluated using the teacher to determine whether they induce the intended alternative answer rather than another response. Since exact matching can be unreliable for generative tasks (Holtzman et al., 2019), we use token-level F1 (Rajpurkar et al., 2016) to measure agreement between the teacher output and . However, answer agreement alone is insufficient, as generating the intended answer does not necessarily indicate that the provides strong evidence for that prediction. A high-quality counterfactual should therefore not only induce the intended answer , but also make substantially more predictable when conditioned on than from the Q alone. To capture these two properties, we introduce a new metric Context Following Difficulty (CFD), which combines Answer Agreement (AA) with the Contextual Loss Ratio (CLR). First, measures whether the teacher generates the intended alternative answer under the counterfactual context :
where is the answer generated by the teacher given Q and . A higher indicates stronger agreement with the intended answer . However, high answer agreement alone does not establish that the counterfactual context plays a role in predicting . Inspired by the Instruction Following Difficulty (IFD) metric (Li et al., 2024), we define the Contextual Loss Ratio (CLR) as:
A low indicates that conditioning on substantially reduces the teacher's loss for relative to conditioning on Q alone, i.e., plays a strong role in predicting the intended alternative answer. Conversely, a higher indicates that providing yields only a limited reduction in the loss of , suggesting weaker dependence of the target prediction on . Thus, measures how strongly contributes to the prediction of the teacher model .
Combining these two measures, we finally define our Context Following Difficulty (CFD) score as:
where is a small constant for numerical stability. We prefer low and high . A lower score favors counterfactuals for which the teacher both generates an answer close to the intended target and relies more strongly on the counterfactual context when predicting . Figure 4 illustrates the complementary roles of and in four representative cases. Cases (a) and (b) show that a counterfactual may fail to induce the intended answer even when the modified context contains or supports it. Case (c) has high but high , indicating limited additional predictive benefit from . In contrast, case (c) represents a valid counterfactual with a low . Together, these examples show why both and are necessary for validation. The two components of therefore capture complementary properties of a valid and informative counterfactual. verifies the intended answer , while measures how strongly the modified context contributes to predicting . Our algorithm is provided in Algorithm 1 (also in Figure 1).
Algorithm 1 COFFEQA
Input: , teacher , student , epochs , learning rate , weight , CFD threshold , few-shot budget , ,
1: while do
2: Pick
3:
4: if then
5:
6:
7: end if
8: end while
9: for to do
10: for all do
11:
12:
13:
14: Update
15: end for
16: end for
17: return distilled student
Table 1: In-domain F1 score comparison across -shots for T5 and Qwen2.5 models using baselines. Mean F1 scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. baseline). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| KD | |||||||||||||
| + COFFEQA | |||||||||||||
| AVG | LWD | ||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
3 EXPERIMENTS
Datasets. We evaluate COFFEQA on eight open-domain question answering benchmarks. The five in-domain benchmarks are Natural Questions (NQ) (Kwiatkowski et al., 2019), SQuAD (Rajpurkar et al., 2016), NewsQA (Trischler et al., 2017), TriviaQA (Joshi et al., 2017), and HotpotQA (Yang et al., 2018). The three out-of-domain benchmarks are DROP (Dua et al., 2019), DuoRC (Saha et al., 2018), and RelationExtraction (Levy et al., 2017). Additional details about the datasets used in our experimental evaluations are provided in Appendix F.1
Models. We evaluate our method using two model families with different architectures: the encoder-decoder model T5 (Raffel et al., 2020) and the decoder-only model Qwen2.5 (Bai et al., 2023). In the T5 setting, T5-Large (770M parameters) serves as the teacher, while T5-Base (220M parameters) serves as the student. In the Qwen2.5 setting, Qwen2.5-7B-IT serves as the teacher, while Qwen2.5-1.5B-IT serves as the student. Full-training details are in Appendix F.2.

Figure 5: Teacher-student F1 agreement of standard KD and COFFEQA across datasets and k-shot settings using T5. COFFEQA generally achieves higher agreement than the baseline. Spokes denote k-shot settings, and radial axis F1 score ranges are adjusted independently by dataset for visualization.
Baselines. We compare COFFEQA against three distillation baselines: (i) Standard Knowledge Distillation (KD) (Hinton et al., 2015), (ii) Sequence-Level Knowledge Distillation (seqKD) (Kim & Rush, 2016), and (iii) Layer-Wise Distillation (LWD) (Jiao et al., 2020). All methods use the same few-shot splits for fair comparison. Additional details of the baselines and implementation details are provided in Appendix F.3.
Setup. Following prior work (Hamman et al., 2025), we first fine-tune the teacher model on the full training dataset. For each few-shot budget , we rank factual samples by their teacher prediction margins, using margin sampling (Scheffer et al., 2001). The factual-only distillation baseline uses the k samples with the smallest margins. COFFEQA instead uses the factual samples with the smallest margins together with their corresponding counterfactuals, maintaining the same total few-shot budget . We evaluate accuracy using EM and F1 against the gold answers and teacher-student agreement using EM and F1 between their generated answers. All results are reported as the mean and standard deviation over five random seeds.
3.1 MAIN EXPERIMENTAL RESULTS
COFFEQA outperforms the baselines. As shown in Table 1, COFFEQA improves performance across all three distillation baselines under the T5 setting. When averaged across all datasets and k-shot settings, COFFEQA improves the F1 score from 66.42 to 69.27 with standard KD, from 66.37 to 69.28 with LWD, and from 68.63 to 70.52 with SeqKD. Moreover, COFFEQA exhibits lower standard deviations than the corresponding baselines in many settings, indicating more stable performance across seeds. These results demonstrate that counterfactual supervision provides consistent benefits over the baselines. Detailed EM scores are provided in Table 8 in Appendix H.1.
COFFEQA generalizes across different model families. COFFEQA improves standard KD across both the encoder-decoder T5 and decoder-only Qwen2.5 model families, where the teachers are approximately and larger than their respective students. Under Qwen2.5, COFFEQA improves the average F1 score from 66.21 to 67.72 with standard KD, from 66.77 to 68.00 with LWD, and from 67.16 to 67.88 with SeqKD. These results indicate that the benefits of COFFEQA extend across different model architectures and scales.
Students mimic the teacher more closely under COFFEQA. To examine how closely the student follows the teacher, we measure teacher-student agreement using EM and F1. As shown in Figure 5, COFFEQA generally achieves higher teacher-student agreement than standard KD across datasets and k-shot settings. Averaged across all benchmarks and settings, COFFEQA improves F1 agreement under standard KD from 68.51 to 71.50 under T5, with a similar trend for Qwen2.5. These results suggest that counterfactual supervision helps the student more closely reproduce the teacher's output behavior. Detailed results and additional radar plots are provided in Appendix H.2.
COFFEQA generalizes well to out-of-domain datasets. To evaluate out-of-domain generalization, we use Natural Questions for distillation and evaluate the resulting students on three out-of-domain test sets: DROP, DuoRC, and RelationExtraction. As shown in Table 2, COFFEQA improves over standard KD when averaged across datasets and k-shot settings for both model families. For T5 and Qwen2.5, COFFEQA improves the overall F1 score over standard KD from 53.35 to 54.52 and from
Table 2: Out-of-domain F1 score comparison across -shots for T5 and Qwen2.5 models using KD. Mean F1 scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| DROP | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| DuoRC | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| RelationExtraction | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
57.09 to 57.77, respectively. These results indicate that the benefits of counterfactual supervision extend beyond the in-domain datasets used for distillation. Detailed EM scores are in Appendix H.3.
COFFEQA improves performance under modified contextual evidence. Following Longpre et al. (2021), we replace each test answer in the context with a randomly selected answer of the same entity type and evaluate against the modified target. As shown in Table 13, COFFEQA improves average F1 agreement over standard KD from 66.72 to 69.55 for T5 and from 49.23 to 53.55 for Qwen2.5. This suggests that COFFEQA better adapts predictions to modified contextual evidence when it differs from pre-trained knowledge. Corresponding EM results are provided in Appendix H.4.
3.2 ABLATION STUDIES
We conduct three ablation studies to examine different components of COFFEQA: (i) We compare COFFEQA with a variant that uses generated counterfactuals without CFD verification to isolate the contribution of CFD; (ii) We vary the CFD threshold to analyze its effect on downstream performance and teacher-student agreement; and (iii) We measure counterfactual generation costs, training time and energy consumption across baselines to analyze the computational cost of COFFEQA. Full ablation results and experimental details are in Appendix G.
4 CONCLUSION
In this paper, we present a counterfactual-guided knowledge distillation method for few-shot open-book question answering. Motivated by the difficulty of distilling with factual samples near the teacher's decision boundary, our approach uses factual-counterfactual pairs to provide additional supervision around these challenging regions. We further introduce CFD to validate counterfactuals before distillation. Experiments across multiple datasets and LLM architectures demonstrate improved knowledge transfer under limited supervision. Limitations and future directions are discussed in Appendix B. Overall, our findings highlight the potential of counterfactual supervision for improving knowledge transfer in generative QA under limited supervision in the few-shot setting.
REPRODUCIBILITY STATEMENT
To support reproducibility, we provide detailed descriptions of the datasets, training procedures, evaluation settings, and baseline implementations in Appendix F. Specifically, Appendix F.1 describes the datasets and experimental splits, Appendix F.2 provides details of teacher model fine-tuning and evaluation, and Appendix F.3 describes the baseline formulations and implementation details. We also provide the assumptions and complete proof of our geometric analysis in Appendix E.
REFERENCES
Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, et al. Qwen technical report. arXiv preprint arXiv:2309.16609, 2023.
Ananth Balashankar, Xuezhi Wang, Yao Qin, Ben Packer, Nithum Thain, Ed H Chi, Jilin Chen, and Alex Beutel. Improving classifier robustness through active generative counterfactual data augmentation. In Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 127–139, 2023.
Amrita Bhattacharjee, Raha Moraffah, Joshua Garland, and Huan Liu. Zero-shot llm-guided counterfactual generation: A case study on nlp model evaluation. In 2024 IEEE International Conference on Big Data (BigData), pp. 1243–1248. IEEE, 2024.
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
Nitay Calderon, Eyal Ben-David, Amir Feder, and Roi Reichart. Docogen: Domain counterfactual generation for low resource domain adaptation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 7727–7746, 2022.
Hao Chen, Rui Xia, and Jianfei Yu. Reinforced counterfactual data augmentation for dual sentiment classification. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 269–278, 2021.
Yudong Chen, Xuwei Xu, Frank de Hoog, Jiajun Liu, and Sen Wang. Medium-difficulty samples constitute smoothed decision boundary for knowledge distillation on pruned datasets. In International Conference on Learning Representations, volume 2025, pp. 54106–54123, 2025.
Zeming Chen, Qiyue Gao, Antoine Bosselut, Ashish Sabharwal, and Kyle Richardson. Disco: Distilling counterfactuals with large language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5514–5528, 2023a.
Ziwei Chen, Linmei Hu, Weixin Li, Yingxia Shao, and Liqiang Nie. Causal intervention and counterfactual reasoning for multi-modal fake news detection. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 627–638, 2023b.
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. Journal of Machine Learning Research, 25(70):1–53, 2024.
Pasan Dissanayake and Sanghamitra Dutta. Model reconstruction using counterfactual explanations: A perspective from polytope theory. Advances in Neural Information Processing Systems, 37: 83397–83429, 2024.
Pasan Dissanayake and Sanghamitra Dutta. Tabdistill: Distilling transformers into neural nets for few-shot tabular classification. arXiv preprint arXiv:2511.05704, 2025.
Pasan Dissanayake and Sanghamitra Dutta. Foundations of efficient model reconstruction using counterfactual explanations. IEEE Journal on Selected Areas in Information Theory, 2026.
Pasan Dissanayake, Faisal Hamman, Barproda Halder, Ilia Sucholutsky, Qiuyi Zhang, and Sanghamitra Dutta. Quantifying knowledge distillation using partial information decomposition. arXiv preprint arXiv:2411.07483, 2024.
Tanay Dixit, Bhargavi Paranjape, Hannaneh Hajishirzi, and Luke Zettlemoyer. Core: A retrieve-then-edit framework for counterfactual data generation. In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. 2964–2984, 2022.
Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2368–2378, 2019.
David Egea, Barproda Halder, and Sanghamitra Dutta. Vision: Robust and interpretable code vulnerability detection leveraging counterfactual augmentation. In Proceedings of the AAAI/ACM Conference on AI, Ethics, and Society, volume 8, pp. 812–823, 2025.
Luyang Fang, Xiaowei Yu, Jiazhang Cai, Yongkai Chen, Shushan Wu, Zhengliang Liu, Zhenyuan Yang, Haoran Lu, Xilin Gong, Yufang Liu, et al. Knowledge distillation and dataset distillation of large language models: Emerging trends, challenges, and future directions. Artificial Intelligence Review, 59(1):17, 2026.
Adam Fisch, Alon Talmor, Robin Jia, Minjoon Seo, Eunsol Choi, and Danqi Chen. Mrqa 2019 shared task: Evaluating generalization in reading comprehension. In Proceedings of the 2nd workshop on machine reading for question answering, pp. 1–13, 2019.
Yanjun Fu, Faisal Hamman, and Sanghamitra Dutta. T-shirt: Token-selective hierarchical data selection for instruction tuning. Advances in Neural Information Processing Systems, 38:113932–113958, 2026.
Matt Gardner, Yoav Artzi, Victoria Basmov, Jonathan Berant, Ben Bogin, Sihao Chen, Pradeep Dasigi, Dheeru Dua, Yanai Elazar, Ananth Gottumukkala, et al. Evaluating models' local decision boundaries via contrast sets. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 1307–1323, 2020.
Jianping Gou, Baosheng Yu, Stephen J. Maybank, and Dacheng Tao. Knowledge distillation: A survey. International Journal of Computer Vision, 129(6):1789–1819, 2021.
Yuxian Gu, Li Dong, Furu Wei, and Minlie Huang. Minillm: Knowledge distillation of large language models. In The twelfth international conference on learning representations, 2024.
Wangzhen Guo, Qinkang Gong, Yanghui Rao, and Hanjiang Lai. Counterfactual multihop qa: A cause-effect approach for reducing disconnected reasoning. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 4214–4226, 2023.
Faisal Hamman, Erfaun Noorani, Saumitra Mishra, Daniele Magazzeni, and Sanghamitra Dutta. Robust algorithmic recourse under model multiplicity with probabilistic guarantees. IEEE Journal on Selected Areas in Information Theory, 5:357–368, 2024.
Faisal Hamman, Pasan Dissanayake, Yanjun Fu, and Sanghamitra Dutta. Few-shot knowledge distillation of llms with counterfactual explanations. arXiv preprint arXiv:2510.21631, 2025.
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, DDL Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 10, 2022.
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
Cheng-Yu Hsieh, Chun-Liang Li, Chih-Kuan Yeh, Hootan Nakhost, Yasuhisa Fujii, Alex Ratner, Ranjay Krishna, Chen-Yu Lee, and Tomas Pfister. Distilling step-by-step! outperforming larger language models with less training data and smaller model sizes. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 8003–8017, 2023.
Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, et al. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems, 43(2):1–55, 2025.
Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. In Findings of the association for computational linguistics: EMNLP 2020, pp. 4163–4174, 2020.
Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1601–1611, 2017.
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
Divyansh Kaushik, Eduard Hovy, and Zachary C Lipton. Learning the difference that makes a difference with counterfactually-augmented data. arXiv preprint arXiv:1909.12434, 2019.
Divyansh Kaushik, Amrith Setlur, Eduard Hovy, and Zachary C Lipton. Explaining the efficacy of counterfactually augmented data. arXiv preprint arXiv:2010.02114, 2020.
Daniel Khashabi, Tushar Khot, and Ashish Sabharwal. More bang for your buck: Natural perturbation for robust question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 163–170, 2020.
Yoon Kim and Alexander M Rush. Sequence-level knowledge distillation. In Proceedings of the 2016 conference on empirical methods in natural language processing, pp. 1317–1327, 2016.
Abdullatif Köksal, Renat Aksitov, and Chung-Ching Chang. Hallucination augmented recitations for language models. arXiv preprint arXiv:2311.07424, 2023.
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019.
Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st conference on computational natural language learning (CoNLL 2017), pp. 333–342, 2017.
Ming Li, Yong Zhang, Zhitao Li, Jihai Chen, Lichang Chen, Ning Cheng, Jianzong Wang, Tianyi Zhou, and Jing Xiao. From quantity to quality: Boosting llm performance with self-guided data selection for instruction tuning. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pp. 7602–7635, 2024.
Chen Liang, Simiao Zuo, Qingru Zhang, Pengcheng He, Weizhu Chen, and Tuo Zhao. Less is more: Task-aware layer-wise distillation for language model compression. In International Conference on Machine Learning, pp. 20852–20867. PMLR, 2023.
Jiaheng Liu, Chenchen Zhang, Jinyang Guo, Yuanxing Zhang, Haoran Que, Ken Deng, Zhiqi Bai, Jie Liu, Ge Zhang, Jiakai Wang, et al. Ddk: Distilling domain knowledge for efficient large language models. Advances in Neural Information Processing Systems, 37:98297–98319, 2024.
Qi Liu, Matt Kusner, and Phil Blunsom. Counterfactual data augmentation for neural machine translation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 187–197, 2021.
Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering. In Proceedings of the 2021 conference on empirical methods in natural language processing, pp. 7052–7063, 2021.
Stephen McAleese and Mark Keane. A comparative analysis of counterfactual explanation methods for text classifiers. arXiv preprint arXiv:2411.02643, 2024.
Saumitra Mishra, Sanghamitra Dutta, Jason Long, and Daniele Magazzeni. A survey on the robustness of feature importance and counterfactual explanations. arXiv preprint arXiv:2111.00358, 2021.
Ella Neeman, Roee Aharoni, Or Honovich, Leshem Choshen, Idan Szpektor, and Omri Abend. Disentqa: Disentangling parametric and contextual knowledge with counterfactual question answering. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 10056–10070, 2023.
Erfaun Noorani, Pasan Dissanayake, Faisal Hamman, and Sanghamitra Dutta. Counterfactual explanations for model ensembles using entropic risk measures. arXiv preprint arXiv:2503.07934, 2025.
OpenAI. GPT-4o mini: Advancing Cost-Efficient Intelligence. https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/, 2024. Accessed: 2026-09-20.
Jiao Ou, Jinchao Zhang, Yang Feng, and Jie Zhou. Counterfactual data augmentation via perspective transition for open-domain dialogues. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 1635–1648, 2022.
Bhargavi Paranjape, Matthew Lamm, and Ian Tenney. Retrieval-guided counterfactual generation for qa. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1670–1686, 2022.
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of machine learning research, 21(140):1–67, 2020.
Dheeraj Rajagopal, Siamak Shakeri, Cicero Nogueira dos Santos, Eduard Hovy, and Chung-Ching Chang. Counterfactual data augmentation improves factuality of abstractive summarization. arXiv preprint arXiv:2205.12416, 2022.
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 conference on empirical methods in natural language processing, pp. 2383–2392, 2016.
R Tyrrell Rockafellar and Roger JB Wets. Variational analysis. Springer, 1998.
Alexis Ross, Ana Marasović, and Matthew E Peters. Explaining nlp models via minimal contrastive editing (mice). In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 3840–3852, 2021.
Alexis Ross, Tongshuang Wu, Hao Peng, Matthew E Peters, and Matt Gardner. Tailor: Generating and perturbing text with semantic controls. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3194–3213, 2022.
Khouloud Saadi and Di Wang. Taskd-llm: Task-aware selective knowledge distillation for llms. In ICLR 2025 Workshop on Deep Generative Model in Machine Learning: Theory, Principle and Efficacy, 2025.
Rachneet Sachdeva, Martin Tutek, and Iryna Gurevych. Catfood: Counterfactual augmented training for improving out-of-domain performance and calibration. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1876–1898, 2024.
Amrita Saha, Rahul Aralikatte, Mitesh M Khapra, and Karthik Sankaranarayanan. Duorc: Towards complex language understanding with paraphrased reading comprehension. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1683–1693, 2018.
Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
Tobias Scheffer, Christian Decomain, and Stefan Wrobel. Active hidden markov models for information extraction. In International symposium on intelligent data analysis, pp. 309–318. Springer, 2001.
Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp. In Proceedings of the 57th annual meeting of the association for computational linguistics, pp. 3645–3650, 2019.
Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. In Proceedings of the 2019 conference on empirical methods in natural language processing and the 9th international joint conference on natural language processing (EMNLP-IJCNLP), pp. 4323–4332, 2019.
Patrick Sutanto, Joan Santoso, Esther Irawati Setiawan, and Aji Prasetya Wibawa. Llm distillation for efficient few-shot multiple choice question answering. In EMNLP (Findings), pp. 8502–8530, 2025.
Gemma Team, Morgane Riviere, Shreya Pathak, Pier Giuseppe Sessa, Cassidy Hardin, Surya Bhupatiraju, Léonard Hussenot, Thomas Mesnard, Bobak Shahriari, Alexandre Ramé, et al. Gemma 2: Improving open language models at a practical size. arXiv preprint arXiv:2408.00118, 2024.
Ewoenam Kwaku Tokpo and Toon Calders. Fairflow: An automated approach to model-based counterfactual data augmentation for nlp. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 160–176. Springer, 2024.
Adam Trischler, Tong Wang, Xingdi Yuan, Justin Harris, Alessandro Sordoni, Philip Bachman, and Kaheer Suleman. Newsqa: A machine comprehension dataset. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pp. 191–200, 2017.
Fali Wang, Zhiwei Zhang, Xianren Zhang, Zongyu Wu, Tzuhao Mo, Qiuhao Lu, Wanjing Wang, Rui Li, Junjie Xu, Xianfeng Tang, et al. A comprehensive survey of small language models in the era of large language models: Techniques, enhancements, applications, collaboration with llms, and trustworthiness. ACM Transactions on Intelligent Systems and Technology, 16(6):1–87, 2025.
Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. Advances in neural information processing systems, 33:5776–5788, 2020.
Yike Wang, Shangbin Feng, Heng Wang, Weijia Shi, Vidhisha Balachandran, Tianxing He, and Yulia Tsvetkov. Resolving knowledge conflicts in large language models. arXiv preprint arXiv:2310.00935, 2023a.
Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language models with self-generated instructions. In Proceedings of the 61st annual meeting of the association for computational linguistics (volume 1: long papers), pp. 13484–13508, 2023b.
Jian Wu, Linyi Yang, Zhen Wang, Manabu Okumura, and Yue Zhang. Cofca: A step-wise counterfactual multi-hop qa benchmark. arXiv preprint arXiv:2402.11924, 2024.
Tongshuang Wu, Marco Tulio Ribeiro, Jeffrey Heer, and Daniel S Weld. Polyjuice: Generating counterfactuals for explaining, evaluating, and improving models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 6707–6723, 2021.
Rongwu Xu, Zehan Qi, Zhijiang Guo, Cunxiang Wang, Hongru Wang, Yue Zhang, and Wei Xu. Knowledge conflicts for llms: A survey. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pp. 8541–8565, 2024a.
Xiaohan Xu, Ming Li, Chongyang Tao, Tao Shen, Reynold Cheng, Jinyang Li, Can Xu, Dacheng Tao, and Tianyi Zhou. A survey on knowledge distillation of large language models. arXiv preprint arXiv:2402.13116, 2024b.
Chuanpeng Yang, Yao Zhu, Wang Lu, Yidong Wang, Qian Chen, Chenlong Gao, Bingjie Yan, and Yiqiang Chen. Survey on knowledge distillation for large language models: methods, evaluation, and application. ACM Transactions on Intelligent Systems and Technology, 16(6):1–27, 2025.
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D Manning. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 conference on empirical methods in natural language processing, pp. 2369–2380, 2018.
Paul Youssef, Christin Seifert, Jörg Schlötterer, et al. Llms for generating and evaluating counterfactuals: A comprehensive study. In Findings of the association for computational linguistics: EMNLP 2024, pp. 14809–14824, 2024.
Wenhao Yu, Meng Jiang, Peter Clark, and Ashish Sabharwal. Ifqa: A dataset for open-domain question answering under counterfactual presuppositions. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 8276–8288, 2023.
Chunting Zhou, Pengfei Liu, Puxin Xu, Srinivasan Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. Advances in Neural Information Processing Systems, 36:55006–55021, 2023.
A APPENDIX
CONTENTS
• Section B Limitations and Future Work
• Section C KD Performance on Boundary-Near Factual Samples
• Section D Counterfactual Generation Prompts
• Section E Proof of Proposition 1
• Section F Experimental Setup Details
– Section F.1 Datasets
– Section F.2 Teacher Model Fine-Tuning and Evaluation
– Section F.3 Additional Details of the Baselines
• Section G Ablation Studies
– Section G.1 Effect of CFD Validation
– Section G.2 CFD Threshold Ablation
– Section G.3 Cost Analysis
• Section H Additional Experimental Results
– Section H.1 In-Domain EM Results
– Section H.2 In-Domain Agreement Results
– Section H.3 Out-of-Domain EM Results
– Section H.4 Performance under Modified Contextual Evidence
B LIMITATIONS AND FUTURE WORK
Our current counterfactual generation framework is limited to QA samples with entity-based answers. Extending counterfactual generation beyond these could broaden the applicability of COFFEQA. Future work could explore more general counterfactual generation strategies that can accommodate diverse answer types while preserving the intended contextual changes.
The current formulation of COFFEQA is also designed specifically for open-book question answering, where counterfactuals can be constructed by modifying the supporting context while preserving the question. Extending the definition, generation, and validation of counterfactuals to other generative tasks is an important direction for investigating whether counterfactual-guided few-shot distillation generalizes beyond open-book QA.
C KD PERFORMANCE ON BOUNDARY-NEAR FACTUAL SAMPLES
To investigate how proximity to the teacher’s decision boundary affects knowledge distillation, we group factual samples according to their prediction margins under the teacher model. Intuitively, a small margin indicates that the teacher assigns similar probabilities to its two most likely token predictions, reflecting greater uncertainty in its output. We use margin sampling (Scheffer et al., 2001) as a proxy for proximity to the teacher’s decision boundary.
Measuring proximity to the decision boundary. For a factual sample with target answer sequence , the teacher produces a probability distribution over the vocabulary at each answer position . Let and denote the teacher's most likely and next most likely tokens, respectively, at position , conditioned on the input and the preceding target tokens . We define the token-level prediction margin as
The prediction margin for the complete answer sequence is then computed as the mean of the token-level margins:
Here, and are the teacher's own top-1 and top-2 predictions at each position and are not defined according to whether they match the ground-truth token. A smaller average margin indicates greater ambiguity between the teacher's two most likely token predictions. We therefore use this quantity as a proxy for proximity to the teacher's decision boundary.
For each dataset, we sort the factual samples in ascending order of their teacher prediction margins and divide them into three margin bins, where Bin 0 contains samples with the smallest margins, Bin 1 contains samples with intermediate margins, and Bin 2 contains samples with the largest margins. To evaluate the effect of teacher prediction margin on knowledge distillation under a controlled few-shot budget, we sample 100 factual examples from each bin and perform knowledge distillation separately using the samples from each bin. Thus, each setting uses the same distillation budget of 100 factual samples, with the primary difference being their teacher prediction margins.
Figure 6 reports the resulting KD performance when distillation is performed using 100 factual samples from each of the three margin bins. Figures 6(a) and 6(b) show EM and F1 averaged across the five in-domain datasets, respectively. For both metrics, distillation using the smallest-margin samples in Bin 0 results in substantially lower performance than using samples from Bins 1 and 2. The mean EM increases from 56.94% in Bin 0 to 67% in Bins 1–2, while the mean F1 increases from 65.99% to 72–73% in Bins 1–2. In contrast, the difference between Bins 1 and 2 is relatively small for both metrics. This suggests that the main degradation in distillation performance occurs when the few-shot factual supervision consists of samples with the smallest teacher prediction margins.
Figures 6(c) and 6(d) show the corresponding dataset-wise EM and F1 results for HotpotQA, NewsQA, Natural Questions (NQ), SQuAD, and TriviaQA. The same general pattern is observed across the five datasets: distillation using samples from Bin 0 results in lower EM and F1 than using samples from the larger-margin bins. The difference is particularly pronounced for HotpotQA, NewsQA, TriviaQA and

(a) Aggregated EM

(b) Aggregated F1

(c) Dataset-wise EM

(d) Dataset-wise F1
Figure 6: KD performance as a function of the teacher prediction margin. Factual samples are grouped into three bins according to their average token-level prediction margins, with Bin 0 containing the smallest margin samples and Bin 2 containing the largest margin samples. Smaller margins are used as a proxy for greater proximity to the teacher’s decision boundary. Knowledge distillation is performed separately using 100 factual samples from each bin, maintaining the same distillation budget across all three settings. Panels (a) and (b) report EM and F1 averaged across the five in-domain datasets, respectively, while panels (c) and (d) report the corresponding dataset-wise results. Distillation using samples from the smallest margin bin generally results in lower performance than using samples from the larger margin bins.
NQ, whereas SQuAD exhibits a smaller difference across the three bins. Thus, the lower distillation performance associated with the smallest-margin samples is observed across datasets rather than being driven by a single benchmark.
Overall, these results support our motivating observation that factual samples with small teacher prediction margins are more challenging to distill under limited factual supervision. Since a small margin reflects greater ambiguity between the teacher’s most likely token predictions, we use these samples as an operational approximation of boundary-near factual examples. Importantly, this degradation is observed while maintaining the same 100 sample distillation budget across all three margin bins. This observation motivates COFFEQA to complement boundary-near factual samples with counterfactual supervision, providing additional information about how the teacher’s response changes under modified contextual evidence.
D COUNTERFACTUAL GENERATION PROMPTS
We use GPT-4o-mini (OpenAI, 2024) for counterfactual generation. The same prompts are used for both the T5 and Qwen2.5 experiments. Counterfactual generation consists of three stages: (i) identifying the entity type of the original answer, (ii) generating a plausible alternative entity of the same type, and (iii) minimally modifying the original context to support the alternative answer. The prompts used in these stages are shown in Figure 7.
Generated counterfactuals are subsequently evaluated using CFD before being used for distillation.
Entity Type Classification
What type of named entity is this answer: "[answer_text]?" Classify as PERSON, LOCATION, ORGANIZATION, DATE, NUMERIC, or OTHER if none apply.
Alternative Entity Generation
The original answer is "[original_answer]" which is a {entity_type}. Propose ONE plausible alternative {entity_type} that is CLOSE to "[original_answer]" (similar in scale, category, or context) but clearly DIFFERENT from it. Do NOT propose any of these already-tried alternatives: {avoid_list}. Respond with ONLY a JSON object: {"alternative_entity": "<your proposed alternative>}
Counterfactual Context Generation: System Prompt
You are an expert at creating counterfactual reading-comprehension passages for QA training data. Given an original context that supports a specific answer, you rewrite it MINIMALLY so that it instead unambiguously supports a different target answer, by replacing occurrences of the original answer (and grammatically-dependent references to it) with the target answer, while leaving everything else in the passage unchanged. Do not add explanations or extra content.
Counterfactual Context Generation: User Prompt
Question: {question} Original context (supports answer "[original_answer]"): {original_context} Target answer (the new counterfactual answer): "[target_answer]" Rewrite the context above so that it minimally changes to unambiguously support "[target_answer]" as the answer to the question, instead of "[original_answer]". Replace occurrences of "[original_answer]" (and any grammatically-dependent references to it) with "[target_answer]", keeping everything else in the passage exactly the same. Do not add commentary. Respond with ONLY a JSON object: {"reasoning": "<1-2 sentences on what you changed>", "counterfactual_context": "<the full rewritten context>}
Figure 7: Prompts used for counterfactual generation. The generation process consists of entity type classification, alternative entity generation, and counterfactual context generation. The final stage uses a system prompt and a user prompt to minimally modify the original context to support the alternative answer.
E PROOF OF PROPOSITION 1
In this section, we provide the proof of the upper bound on the Hausdorff distance between the teacher's context-response boundary and the student's context-response boundary .
By definition, the Hausdorff distance between and is
We bound the two directed distances separately (Hamman et al., 2025).
PART 1: BOUNDING THE DEVIATION FROM TO
Let be an arbitrary point on the teacher's boundary. By the boundary-coverage assumption (Assumption 3), there exists a teacher boundary crossing point associated with a factual-counterfactual pair such that (see Figure 8):

Figure 8: Visualization of the distances between and . and are factual and counterfactual pairs with . is an arbitrary point in that finds some cut point in within distance ( ).
Under Assumption 1, the factual-counterfactual perturbation is bounded as
Under the teacher-student agreement assumption (Assumption 2), the teacher and student agree on the responses associated with both endpoints and . Since the factual and counterfactual contexts correspond to different responses, both the teacher and student boundaries cross the segment . Let and denote their respective boundary crossing points on this segment.
Because both and lie on the same segment ,
Combining Equations equation 7 and equation 9 and applying the triangle inequality, we obtain
Since there exists at least one point within distance of , the infimum distance satisfies:
Taking the supremum over all points yields:
PART 2: BOUNDING THE DEVIATION FROM TO
We follow a symmetric logic for the student boundary. For any point , Assumption 3 guarantees the existence of a student boundary cutpoint such that .
From the relationship established in Part 1, the distance between this student cutpoint and the corresponding teacher cutpoint is . Applying the triangle inequality:
Since , it follows that . Taking the supremum over all :
FINAL RESULT
Combining Equations equation 12 and equation 14, we obtain
This confirms that the student boundary remains within an -tube of the teacher boundary.
F EXPERIMENTAL SETUP DETAILS
F.1 DATASETS
We evaluate COFFEQA on eight open-domain question answering benchmarks, comprising five in-domain and three out-of-domain datasets. The in-domain benchmarks include Natural Questions (NQ), SQuAD, NewsQA, TriviaQA, and HotpotQA. NQ consists of real user queries collected from
Table 3: Statistics of teacher and student datasets used in our experiments. Teacher datasets contain the original training/validation splits, while student datasets contain available factual instances for distillation and evaluation.
| Dataset | Teacher Dataset | Student Dataset | |||
|---|---|---|---|---|---|
| Train | Val. | Train | Val. | Test | |
| NQ | 93,663 | 10,408 | 34,383 | 3,821 | 2,283 |
| SQuAD | 77,847 | 8,651 | 16,341 | 1,816 | 2,790 |
| NewsQA | 66,655 | 7,407 | 10,956 | 1,218 | 690 |
| TriviaQA | 55,519 | 6,170 | 4,415 | 491 | 607 |
| HotpotQA | 65,630 | 7,294 | 28,956 | 3,218 | 2,052 |
Google search logs (Kwiatkowski et al., 2019). SQuAD (Stanford Question Answering Dataset) contains questions authored by crowdworkers based on Wikipedia articles (Rajpurkar et al., 2016). NewsQA is constructed from CNN news articles with questions generated crowdworkers (Trischler et al., 2017). TriviaQA consists QA pairs sourced from trivia and quiz-league websites (Joshi et al., 2017). HotpotQA focuses on multi-hop reasoning, requiring models to combine information from multiple Wikipedia articles (Yang et al., 2018). The out-of-domain benchmarks include DROP, DuoRC, and RelationExtraction. DROP contains quantitative QA pairs which has numerical and text answers (Dua et al., 2019). DuoRC contains QA pairs derived from movie plots, constructed by crowdworkers using IMDb and Wikipedia (Saha et al., 2018). RelationExtraction reformulates relation extraction as a reading comprehension task using Wikipedia text (Levy et al., 2017).
The datasets are designed for generalization in open-book question answering, where samples are drawn from diverse distributions. The datasets have following properties in common.
-
Question distribution: The test sets contain different styles of questions, such as entity-based and relational questions, collected from diverse sources, including crowdworkers, domain experts, and exam writers.
-
Context distribution: Passages are drawn from heterogeneous sources such as science articles, novels, medical abstracts, news articles.
-
Answerability: The answer can be generated using the provided context, and the answer span appears within the first 800 tokens of the passage.
The training and validation sets for the teacher are drawn from the original training splits after removing duplicate entries. Dataset statistics are reported in Table 3. We generate counterfactuals only for the samples with entity-based answers. Statistics of the knowledge distillation datasets are also shown in Table 3, where student train and val denote available factual training samples with entity-based answers for distillation. The in-domain test sets for knowledge distillation are taken from the original development splits after filtering for entity-based answer samples. The out-of-domain test set counts are as follows: DROP (496), and DuoRC (450), RelationExtraction (912).
F.2 TEACHER MODEL FINE-TUNING AND EVALUATION
All fine-tuning experiments were conducted on a machine equipped with four NVIDIA RTX 6000 Ada GPUs. For T5-Large fine-tuning experiments, we used a batch size of 4, a learning rate of , and a maximum of 5 training epochs. Training was stopped early based on validation loss using an early stopping criterion with a patience of 3 validation checks. For Qwen2.5-7B-IT fine-tuning experiments, we used a batch size of 1, a learning rate of , and a maximum of 5 training epochs. Training was stopped early based on validation loss using an early stopping criterion with a patience of 3 validation checks. On average, all models converged within 1 to 2 epochs.
We evaluated the fine-tuned teacher models using the same test sets for each dataset. The results can be found in Table 4
Table 4: Teacher model performance (EM and F1) on factual and counterfactual test sets across five in-domain QA benchmarks for T5 and Qwen2.5 models.
| Test Set Type | Model | Score | NQ | SQuAD | NewsQA | TriviaQA | HotpotQA |
|---|---|---|---|---|---|---|---|
| Factual | T5 | EM | 74.90 | 79.64 | 73.19 | 67.38 | 77.19 |
| F1 | 77.76 | 87.78 | 78.97 | 69.27 | 85.49 | ||
| Qwen2.5 | EM | 79.46 | 83.91 | 75.65 | 73.48 | 79.34 | |
| F1 | 82.83 | 91.04 | 82.50 | 76.37 | 88.52 | ||
| Counterfactual | T5 | EM | 67.94 | 79.75 | 66.38 | 58.32 | 65.84 |
| F1 | 70.79 | 87.04 | 71.35 | 60.58 | 71.37 | ||
| Qwen2.5 | EM | 69.78 | 79.35 | 66.23 | 31.47 | 64.13 | |
| F1 | 73.61 | 86.46 | 70.55 | 32.22 | 70.74 |
F.3 ADDITIONAL DETAILS OF THE BASELINES
We compare COFFEQA against three knowledge distillation baselines. To ensure a fair comparison, all methods use the same -shot data splits, and evaluation settings.
- Standard Knowledge Distillation (KD). Standard knowledge distillation (KD) (Hinton et al., 2015) transfers knowledge from a larger teacher model to a smaller student model by aligning their output distributions. Let denote the input, the ground-truth output sequence, and and the student and teacher model distributions, respectively. The student is first trained using the standard cross-entropy objective
In addition, KD encourages the student to match the teacher's token-level output distribution at each decoding step using
The final training objective combines the supervised and distillation losses:
where controls the trade-off between fitting the ground-truth sequence and matching the teacher's output distribution. Thus, standard KD transfers knowledge by aligning the teacher and student token-level distributions while retaining supervision from the ground-truth sequence.
- Layer-wise Distillation (LWD). Layer-wise distillation (LWD) (Jiao et al., 2020) extends output-level knowledge distillation by additionally transferring information from the intermediate representations of the teacher. Representations from selected teacher layers are aligned with the corresponding representations of the student through an auxiliary layer-wise distillation objective, providing supervision at both the intermediate representation and output levels. Let and denote the hidden representations from a paired teacher layer and student layer , respectively. Since the teacher and student may have different hidden dimensions, a learnable projection is applied to the student representation before alignment. The layer-wise distillation loss is defined as
where denotes the set of paired student and teacher layers. The final objective combines the standard KD objective with the layer-wise representation loss:
where controls the contribution of intermediate representation alignment. Thus, unlike standard KD, which transfers knowledge through the output distributions, LWD additionally encourages the student to reproduce the teacher's intermediate representations.
• Sequence-Level Knowledge Distillation (SeqKD). Unlike standard KD, which aligns the teacher and student token-level distributions at each decoding step, sequence-level knowledge distillation (seqKD) transfers knowledge through complete sequences generated by the teacher Kim & Rush (2016). Let denote the input and denote the output sequence, and let and denote the student and teacher model distributions, respectively. The sequence-level distillation objective is defined as
where Y denotes the set of all possible output sequences. Since directly optimizing over all possible output sequences is intractable, seqKD approximates the teacher's sequence-level distribution using its highest-probability output sequence. Specifically, the teacher-generated sequence is obtained as
where beam search is used to approximate the highest probability sequence under the teacher distribution. The resulting sequence-level distillation objective is then
Thus, while standard KD transfers knowledge by matching the teacher's token-level probability distributions, seqKD uses the complete sequence generated by the teacher as the training target for the student.
For standard KD, the student was trained using a weighted combination of the MLE loss and the token-level distillation loss. The temperature was set to 1, and the was set to 0.5.
For LWD, student decoder layers were uniformly mapped to corresponding teacher decoder layers across the model depth. Layer-wise knowledge transfer was performed by aligning the decoder self-attention distributions of the mapped teacher and student layers using KL divergence. Attention distributions were averaged across attention heads before computing the layer-wise loss. The layer-wise distillation loss was added to the standard KD objective with a weight of 5.0.
For seqKD, the teacher generated a complete output sequence for each training input using beam search with a beam size of 4. The original ground-truth answer was replaced by the corresponding teacher-generated sequence, which was then used as the training target for the student. Following the original seqKD formulation (Kim & Rush, 2016), the student was trained using cross-entropy loss on the teacher-generated sequences without an additional token-level distillation loss.
For all three baselines, we used a batch size of 4 and a learning rate of . The maximum number of training epochs was set to 100, with early stopping based on validation loss using a patience of 3 validation checks.
G ABLATION STUDY RESULTS
G.1 EFFECT OF CFD VALIDATION
To isolate the contribution of CFD verification, we compare COFFEQA with a variant that generates counterfactuals without CFD verification. Both variants use identical factual data splits and training settings, with the only difference being whether the generated counterfactuals are verified using CFD. For COFFEQA with CFD verification, we use the selected threshold . Experiments are conducted using T5 across all datasets with five random seeds for each -shot setting, and the results are averaged across datasets. Figure 9 reports the improvement of each variant over standard KD. CFD verification generally provides larger gains in both downstream QA performance and teacher-student agreement, with particularly clear improvements at , and 128. These results indicate that the improvements of COFFEQA are not solely due to the inclusion of counterfactual examples; verifying the generated counterfactuals using CFD provides additional benefits for knowledge transfer.

(a) Accuracy EM

(b) Accuracy F1

(c) Agreement EM

(d) Agreement F1
Figure 9: Effect of CFD verification on COFFEQA. Performance gains over standard KD ( ) are shown across different few-shot budgets . We compare COFFEQA without CFD verification against the full COFFEQA framework with CFD verification ( ). Panels (a) and (b) report accuracy EM and F1 gains, while panels (c) and (d) report teacher-student agreement EM and F1 gains. CFD verification generally yields larger improvements, demonstrating the benefit of validating generated counterfactuals before distillation.
G.2 CFD THRESHOLD ABLATION
We analyze the sensitivity of COFFEQA to the CFD threshold using T5 on TriviaQA. We evaluate across , with five random seeds for each -shot setting. For each threshold, we report the averaged improvement of COFFEQA over standard KD (). As shown in Figure 10, performance is sensitive to the CFD threshold. The threshold yields negligible improvements, whereas moderate thresholds produce substantially larger gains in both accuracy EM/F1 and teacher-student agreement. The gains peak around and gradually decrease as the threshold becomes more permissive. Overall, these results demonstrate the importance of controlling counterfactual quality through the CFD threshold.

Figure 10: CFD threshold ablation. Effect of the CFD threshold on COFFEQA using T5 on TriviaQA. The bars show the improvement of COFFEQA over standard KD (), averaged across and five random seeds. The left plot shows the improvement in accuracy measured by EM and F1, while the right plot shows the improvement in teacher-student agreement measured by EM and F1.
G.3 COST ANALYSIS
We analyze the computational cost of COFFEQA during both counterfactual generation and distillation. Table 5 reports the per-sample cost of counterfactual generation, averaged over all generation attempts. Counterfactual generation requires approximately 2.88 seconds per candidate, with relatively small CPU and GPU energy consumption for both model settings.
Table 6 and Table 7 reports the training duration and energy consumption during distillation under T5 and Qwen2.5, respectively, measured using CodeCarbon. In both models, for standard KD and LWD, COFFEQA achieves higher accuracy while requiring less training time and energy across all -shot settings. For SeqKD, COFFEQA also improves accuracy across all settings, but incurs higher computational costs at the smaller budgets ( and 32). From onward, its computational cost becomes comparable to the baseline. Overall, these results show that COFFEQA introduces an additional counterfactual-generation cost, while maintaining favorable computational efficiency during the subsequent distillation stage.
Table 5: Average duration and CPU/GPU energy consumption per counterfactual generation candidate under the T5 and Qwen2.5 settings. Results are averaged across all generation attempts.
| Model | Duration/candidate (s) | CPU/candidate (kWh) | GPU/candidate (kWh) |
|---|---|---|---|
| T5 | 2.884 | 0.000083 | 0.000055 |
| Qwen2.5 | 2.877 | 0.000071 | 0.000067 |
Table 6: Comparison of EM score, distillation duration, and CPU/GPU energy consumption between baseline methods and COFFEQA across different few-shot budgets under the T5 setting.
| Objective | Method | EM (%) | Duration (s) | CPU (kWh) | GPU (kWh) | |
|---|---|---|---|---|---|---|
| KD | Baseline | 16 | 61.88 | 62.86 | 0.00201 | 0.01342 |
| 32 | 60.82 | 50.34 | 0.00153 | 0.00980 | ||
| 64 | 54.83 | 56.15 | 0.00170 | 0.01259 | ||
| 128 | 56.07 | 75.90 | 0.00224 | 0.01662 | ||
| 256 | 55.56 | 128.67 | 0.00378 | 0.02777 | ||
| COFFEQA | 16 | 63.36 | 45.19 | 0.00143 | 0.01016 | |
| 32 | 64.20 | 42.58 | 0.00133 | 0.00879 | ||
| 64 | 62.93 | 49.46 | 0.00149 | 0.01027 | ||
| 128 | 59.67 | 68.09 | 0.00203 | 0.01428 | ||
| 256 | 59.49 | 114.55 | 0.00336 | 0.02487 | ||
| LWD | Baseline | 16 | 61.75 | 150.44 | 0.00474 | 0.02235 |
| 32 | 60.94 | 127.87 | 0.00405 | 0.01862 | ||
| 64 | 54.52 | 137.14 | 0.00425 | 0.02128 | ||
| 128 | 55.49 | 161.15 | 0.00488 | 0.02327 | ||
| 256 | 55.88 | 221.42 | 0.00694 | 0.03796 | ||
| COFFEQA | 16 | 62.94 | 121.86 | 0.00383 | 0.01784 | |
| 32 | 64.38 | 109.26 | 0.00344 | 0.01799 | ||
| 64 | 62.72 | 127.24 | 0.00389 | 0.01743 | ||
| 128 | 59.94 | 131.83 | 0.00400 | 0.01907 | ||
| 256 | 59.78 | 180.71 | 0.00569 | 0.03242 | ||
| SeqKD | Baseline | 16 | 61.77 | 59.14 | 0.00186 | 0.01021 |
| 32 | 61.19 | 39.74 | 0.00127 | 0.00801 | ||
| 64 | 61.37 | 36.16 | 0.00115 | 0.00774 | ||
| 128 | 61.15 | 44.13 | 0.00136 | 0.00988 | ||
| 256 | 62.06 | 71.46 | 0.00215 | 0.01550 | ||
| COFFEQA | 16 | 64.81 | 91.77 | 0.00287 | 0.01409 | |
| 32 | 64.70 | 53.12 | 0.00169 | 0.01120 | ||
| 64 | 64.50 | 37.99 | 0.00121 | 0.00832 | ||
| 128 | 64.54 | 47.76 | 0.00149 | 0.00999 | ||
| 256 | 64.06 | 82.79 | 0.00248 | 0.01780 |
Table 7: Comparison of EM score, distillation duration, and CPU/GPU energy consumption between baseline methods and COFFEQA across different few-shot budgets under the Qwen2.5.
| Objective | Method | EM (%) | Duration (s) | CPU (kWh) | GPU (kWh) | |
|---|---|---|---|---|---|---|
| KD | Baseline | 16 | 61.22 | 748.41 | 0.02378 | 0.11453 |
| 32 | 60.24 | 636.82 | 0.01930 | 0.11645 | ||
| 64 | 59.13 | 774.16 | 0.02278 | 0.15832 | ||
| 128 | 58.51 | 1202.28 | 0.03660 | 0.27748 | ||
| 256 | 59.07 | 1793.38 | 0.05119 | 0.35929 | ||
| COFFEQA | 16 | 61.73 | 704.12 | 0.02244 | 0.11386 | |
| 32 | 61.59 | 698.58 | 0.02124 | 0.13367 | ||
| 64 | 61.78 | 693.77 | 0.02043 | 0.14167 | ||
| 128 | 60.93 | 1066.53 | 0.03231 | 0.24643 | ||
| 256 | 60.59 | 1728.09 | 0.04949 | 0.33793 | ||
| LWD | Baseline | 16 | 60.77 | 892.88 | 0.02964 | 0.14427 |
| 32 | 60.94 | 614.12 | 0.01998 | 0.11107 | ||
| 64 | 59.71 | 560.93 | 0.01830 | 0.10488 | ||
| 128 | 59.52 | 641.79 | 0.02027 | 0.11110 | ||
| 256 | 59.70 | 840.55 | 0.02688 | 0.16956 | ||
| COFFEQA | 16 | 61.10 | 852.61 | 0.02920 | 0.13976 | |
| 32 | 61.51 | 727.77 | 0.02350 | 0.12773 | ||
| 64 | 61.49 | 477.78 | 0.01546 | 0.08719 | ||
| 128 | 61.80 | 526.55 | 0.01641 | 0.09615 | ||
| 256 | 62.03 | 759.89 | 0.02396 | 0.14949 | ||
| SeqKD | Baseline | 16 | 59.72 | 584.15 | 0.01826 | 0.11342 |
| 32 | 60.46 | 559.89 | 0.01701 | 0.10684 | ||
| 64 | 60.96 | 642.25 | 0.01894 | 0.14049 | ||
| 128 | 60.79 | 970.14 | 0.02825 | 0.21411 | ||
| 256 | 62.23 | 1683.50 | 0.04842 | 0.38788 | ||
| COFFEQA | 16 | 59.98 | 648.94 | 0.01986 | 0.12576 | |
| 32 | 60.72 | 557.76 | 0.01663 | 0.11214 | ||
| 64 | 62.16 | 641.84 | 0.01882 | 0.13954 | ||
| 128 | 62.21 | 925.38 | 0.02703 | 0.18591 | ||
| 256 | 62.88 | 1527.88 | 0.04422 | 0.34185 |
H ADDITIONAL EXPERIMENTAL RESULTS
H.1 IN-DOMAIN EM RESULTS
Table 8 reports the in-domain EM results across all the baselines.
Table 8: In-Domain EM score comparison across -shots for T5 and Qwen2.5 models using baselines. Mean EM scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. baseline). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
H.2 IN-DOMAIN AGREEMENT RESULTS
Tables 9 and 10 report the in-domain teacher-student agreement results using EM and F1, respectively. For better visualization, Figures 11 and 12 illustrate the F1 agreement across datasets and -shot settings for all baselines using T5 and Qwen2.5, respectively.
Table 9: In-domain teacher-student agreement EM score comparison across -shots for T5 and Qwen2.5 models using baselines. Mean agreement EM scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. baseline). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
Table 10: In-domain teacher-student agreement F1 score comparison across -shots for T5 and Qwen2.5 models using baselines. Mean agreement F1 scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. baseline). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| LWD | |||||||||||||
| + COFFEQA | |||||||||||||
| SeqKD | |||||||||||||
| + COFFEQA | |||||||||||||

Figure 11: Teacher-student F1 agreement of KD, LWD, and SeqKD with and without COFFEQA across datasets and k-shot settings using T5. COFFEQA generally achieves higher agreement across the distillation baselines. Spokes denote k-shot settings, and radial axis F1 score ranges are adjusted independently by dataset for visualization.

Figure 12: Teacher-student F1 agreement of KD, LWD, and SeqKD with and without COFFEQA across datasets and k-shot settings using Qwen2.5. COFFEQA generally achieves higher agreement across the distillation baselines. Spokes denote k-shot settings, and radial axis F1 score ranges are adjusted independently by dataset for visualization.
H.3 OUT-OF-DOMAIN EM RESULTS
Table 11 reports the out-of-domain EM results for T5 and Qwen2.5.
Table 11: Out-of-domain EM score comparison across -shots for T5 and Qwen2.5 models using KD. Mean EM scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| DROP | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| DuoRC | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| RelationExtraction | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
H.4 PERFORMANCE UNDER MODIFIED CONTEXTUAL EVIDENCE
Tables 12 and 13 report the EM and F1 scores on modified-context test sets, respectively. Tables 14 and 15 report the corresponding teacher-student agreement scores using EM and F1, respectively.
Table 12: EM score comparison on modified-context test sets across -shot settings for T5 and Qwen2.5 models using KD. Mean EM scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
Table 13: F1 score comparison on modified-context test sets across -shot settings for T5 and Qwen2.5 models using KD. Mean F1 scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
Table 14: Teacher-student agreement EM score comparison on modified-context test sets across -shot settings for T5 and Qwen2.5 models using KD. Mean agreement EM scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||
Table 15: Teacher-student agreement F1 score comparison on modified-context test sets across -shot settings for T5 and Qwen2.5 models using KD. Mean agreement F1 scores are reported with standard deviations as subscripts (). Bold values indicate the better-performing method (COFFEQA vs. KD). Blue shading highlights aggregate results.
| Dataset | Method | T5 | Qwen2.5 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16 | 32 | 64 | 128 | 256 | Avg | 16 | 32 | 64 | 128 | 256 | Avg | ||
| NQ | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| SQuAD | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| NewsQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| TriviaQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| HotpotQA | KD | ||||||||||||
| + COFFEQA | |||||||||||||
| AVG | KD | ||||||||||||
| + COFFEQA | |||||||||||||