Always the Best Fit: Adaptive Domain Gap Filling from Causal Perspective for Few-Shot Relation Extraction

Ge Bai, Chenji Lu, Jiaxiang Geng, Shilong Li, Yidong Shi, Xiyan Liu, Ying Liu, Zhang Zhang, Ruifang LiuEMNLP 2023

Abstract

Cross-domain Relation Extraction aims to transfer knowledge from a source domain to a different target domain to address low-resource challenges. However, the semantic gap caused by data bias between domains is a major challenge, especially in few-shot scenarios. Previous work has mainly focused on transferring knowledge between domains through shared feature representations without analyzing the impact of each factor that may produce data bias based on the characteristics of each domain. This work takes a causal perspective and proposes a new framework, CausalGF. By constructing a unified structural causal model, we estimate the causal effects of factors such as syntactic structure, label distribution, and entities on the outcome. CausalGF calculates the causal effects among the factors and adjusts them dynamically based on domain characteristics, enabling adaptive gap filling. Our experiments show that our approach better fills the domain gap, yielding significantly better results on the cross-domain few-shot relation extraction task.

Introduction

Relation Extraction (RE) is a fundamental task in natural language processing, focused on identifying semantic connections between entities in text. While deep learning models have achieved high performance in data-rich environments, they often falter in Few-Shot RE, where only a few labeled examples are available. This difficulty is compounded in cross-domain settings—for instance, moving from news articles to biomedical literature.

The "domain gap" arises because entities, syntactic structures, and label distributions vary significantly across fields. Traditional methods attempt to bridge this gap by learning domain-invariant features. However, these approaches often fail to account for the underlying causal mechanisms that drive predictions. This paper introduces CausalGF, a framework that treats domain adaptation as a causal inference problem, allowing for dynamic adjustment of feature importance based on domain-specific characteristics.

The CausalGF Framework

CausalGF models the relation extraction process using a Structural Causal Model (SCM). The model identifies key nodes: Context ($C$), Syntactic Structure ($S$), Entities ($E$), and Labels ($L$). A critical observation is that $S$ and $E$ influence both the context and the final relation representation ($X$), creating "backdoor paths" that introduce domain-specific bias.

The CausalGF framework pipeline, illustrating how causal effects are estimated and weighted during training and inference.

To mitigate this, CausalGF employs two main strategies:

  1. Counterfactual Generation: The model generates counterfactual scenarios to isolate the true causal influence of specific variables. For example, it asks: "What would the prediction be if the context remained the same, but the entities were masked?" This is achieved through prompt engineering that selectively masks or replaces sentence components.
  2. Dynamic Weighting: Rather than assigning fixed importance to features, CausalGF uses a learnable weight matrix ($W$). During both training and inference, the model dynamically adjusts the weights of the causal effects derived from context, label descriptions, and relation representations. This allows the system to adapt its focus—for instance, relying more on syntax when entities are unfamiliar in a new domain.

Experimental Evaluation

The researchers evaluated CausalGF on two major benchmarks: CrossRE (covering six domains like Music, AI, and Politics) and FewRel 2.0 (including a challenging biomedical domain).

CausalGF consistently outperformed state-of-the-art baselines:

  • CrossRE Performance: In 10-way 1-shot scenarios, CausalGF achieved 49.57% accuracy, surpassing the previous best of 47.39%.
  • FewRel 2.0: On the biomedical test set, the model reached 84.14% in 5-way 1-shot tasks, a 1.3% improvement over the LPD baseline.

Analysis of Causal Effects

A key insight of this work is Adaptive Importance. Different features provide varying levels of reliability across domains. For example, specific entities are often domain-specific and less reliable for transfer, whereas syntactic structures are more universal.

Visualization of the final causal effects across different domain transfer scenarios, demonstrating the model's adaptive weighting.

As shown in the figure above, the model's "logits of final effects" ($Q_C, Q_S, Q_E, Q_L$) vary significantly depending on the source and target domains. By blocking "backdoor" correlations through causal intervention, CausalGF avoids spurious patterns that might exist in training data but fail in the target domain. This identification and adjustment of causal effects proves more effective than simple stochastic methods like random dropout.

Conclusion

CausalGF represents a significant step forward in cross-domain few-shot relation extraction by moving beyond simple feature sharing to a principled causal analysis. While the current implementation focuses on RE and uses relatively broad causal variables, future work could extend this approach to other tasks like Named Entity Recognition or refine the granularity of the causal factors. Despite the added computational complexity of generating counterfactuals, the gains in robustness and accuracy make it a compelling framework for low-resource domain adaptation.

Summary updated

BibTeX
@inproceedings{bai2023always,
  author = {Ge Bai and Chenji Lu and Jiaxiang Geng and Shilong Li and Yidong Shi and Xiyan Liu and Ying Liu and Zhang Zhang and Ruifang Liu},
  title = {{Always the Best Fit: Adaptive Domain Gap Filling from Causal Perspective for Few-Shot Relation Extraction}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=Lp4CMWnSyb},
}
Figure