Skip to content
/ FitCF Public

Code for the paper accepted at ACL 2025 Findings: "FitCF: A Framework for Automatic Feature Importance-guided Counterfactual Example Generation" (Wang et al., 2025)

Notifications You must be signed in to change notification settings

qiaw99/FitCF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FitCF: A Framework for Automatic Feature Importance-guided Counterfactual Example Generation

ZeroCF & FitCF

In this paper, we first introduce ZeroCF, a faithful approach for leveraging important words derived from feature attribution methods to generate counterfactual examples in a zero-shot setting. Second, we present a new framework, FitCF, which further verifies aforementioned counterfactuals by label flip verification and then inserts them as demonstrations for few-shot prompting, outperforming three state-of-the-art baselines. pipeline

🚀 Experimental Setup

Datasets

We identify two widely used NLP datasets for counterfactual example generation:

  1. AG News: news topic classification (https://paperswithcode.com/dataset/ag-news)
  2. SST2: sentiment analysis (https://huggingface.co/datasets/stanfordnlp/sst2)

Models

We employ three LLMs with varying model sizes:

Baselines

⚙️ Environment Setup

pip install -r requirements.txt

In addition, Polyjuice requires en_core_web_sm:

python -m spacy download en_core_web_sm

📝 Citation

@misc{wang2025fitcfframeworkautomaticfeature,
      title={FitCF: A Framework for Automatic Feature Importance-guided Counterfactual Example Generation}, 
      author={Qianli Wang and Nils Feldhus and Simon Ostermann and Luis Felipe Villa-Arenas and Sebastian Möller and Vera Schmitt},
      year={2025},
      eprint={2501.00777},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2501.00777}, 
}

About

Code for the paper accepted at ACL 2025 Findings: "FitCF: A Framework for Automatic Feature Importance-guided Counterfactual Example Generation" (Wang et al., 2025)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages