Official implementation of the paper:
Chain-Structured Progressive Defense against Multi-Source Adversarial Attacks in Continual Relation Extraction
Continual Relation Extraction (CRE) aims to continuously learn emerging relations while preserving previously acquired knowledge. Existing adversarial defense methods are mainly designed for static settings and struggle to handle multi-source adversarial perturbations in continual learning environments.
In this work, we propose Chain-Structured Progressive Defense (CSPD), a novel defense framework for continual relation extraction under multi-source attacks. CSPD introduces:
- Zipf-informed Loss Reweighting to prioritize severe adversarial distortions;
- Prototype-Anchored Alignment to restore feature geometry using stable relation prototypes;
- Joint Memory Consolidation to balance adversarial robustness and historical memory preservation.
Experiments on FewRel and TACRED demonstrate that CSPD consistently improves robustness while maintaining stability in continual learning scenarios.
CSPD consists of three collaborative modules:
- Zipf-informed Loss Reweighting
- Prototype-Anchored Alignment
- Joint Memory Consolidation
These modules jointly repair adversarial feature drift while preserving historical knowledge in continual learning.
Recommended environment:
- Python >= 3.9
- PyTorch
- CUDA (optional, GPU acceleration)
Create environment:
conda env create -f environment.yml
conda activate CSPDOr install dependencies manually:
pip install -r requirements.txtWe conduct experiments on two benchmark datasets:
Few-shot relation extraction benchmark:
data/FewRel/
Large-scale relation extraction benchmark:
data/TACRED/
Task splits and continual learning task orders are provided in the corresponding directories.
Run experiments on FewRel:
bash FewRel.shRun experiments on TACRED:
bash tacred.shBackbone models:
- NaCL
- EMAR
- CRL
Attack sources:
Gradient-based attacks:
- FGSM
- CW
LLM-based semantic attacks:
- Paraphrasing
- Entity Replacement
- Insertion
- Targeted Prompting
Evaluation metrics:
- Robustness (R)
- Stability (S)
- Security-weighted Harmonic Mean (H0.5)
CSPD/
│── data/
│ ├── FewRel/
│ └── TACRED/
│
│── models/
│
│── scripts/
│ ├── FewRel.sh
│ └── tacred.sh
│
│── requirements.txt
│── environment.yml
│── README.md
If you find this repository useful, please cite our work:
@article{yan2026cspd,
title={Chain-Structured Progressive Defense against Multi-Source Adversarial Attacks in Continual Relation Extraction},
author={Yan, Rongen and Zhang, Liqiong and Zhong, Weilin and Zhang, Yue and Lan, Shufen and Zhao, Ziling and Xu, Fu},
note={Under Review},
year={2026}
}This project is released for academic research purposes only.