Thank you for your interest in our work! This is the original implementation of our ACL 2025 paper, "Recurrent Knowledge Identification and Fusion for Language Model Continual Learning".
We also invite you to explore our previous work on continual learning, TaSL, which is the predecessor of Recurrent KIF and was published at ACL 2024.
Reproducing the results from our paper is straightforward—just follow the steps outlined below.
conda create -n RKIF python=3.8
conda activate RKIF
pip install -r requirements.txt
Important: Please ensure the following package versions:
transformers==4.28.1peft==0.4.0
Then, replace the corresponding files in the transformers package (typically located at anaconda_path/envs/RKIF/lib/python3.8/site-packages/transformers/) with the modified versions of trainer.py and training_args.py.
These modifications are required to support our Recurrent Knowledge Identification and Fusion framework.
Detailed comments are included in the modified files to help you understand the changes.
The data preprocessing pipeline follows the approach described in O-LoRA. The implementation can be found in the /data folder. If you're interested in the preprocessing details, please refer to data/preprocess.py. For convenience, we also provide pre-processed datasets ready for use.
Download the required backbone models from Hugging Face:
To fine-tune T5 models, run:
./scripts/run_train_KIF_t5lora.shTo fine-tune LLaMA-2-7B or LLaMA-2-13B models, run:
./scripts_llama/run_train_KIF_llama.shNote:
- Use the
model_pathargument to specify the location of your downloaded models. - We use LoRA to accelerate the fine-tuning process.
- Fine-tuned weights will be saved to
$checkpoint_filesat the end of training.
We evaluate our model using two metrics: Overall Performance (OP) and Backward Transfer (BWT).
./scripts/run_test_KIF_t5lora_avgPer.sh./scripts/run_test_KIF_t5lora_avgPer.shThe prediction results will be stored in the $output folder.
To calculate the metrics, execute:
./src/eval_avgPerf.py
./src/eval_bwt.pyWe hope you find this repository useful! If you encounter any issues or have questions, feel free to open an issue or contact us.
If this work proves beneficial or use our code for your research, citing our paper would be greatly appreciated.
@article{feng2025recurrent,
title={Recurrent knowledge identification and fusion for language model continual learning},
author={Feng, Yujie and Wang, Xujia and Lu, Zexin and Fu, Shenghong and Shi, Guangyuan and Xu, Yongxin and Wang, Yasha and Yu, Philip S and Chu, Xu and Wu, Xiao-Ming},
journal={arXiv preprint arXiv:2502.17510},
year={2025}
}