Skip to content

nxjiang-jnx/ReFlux

Repository files navigation

Erased, But Not Forgotten: Erased Rectified Flow Transformers Still Remain Unsafe Under Concept Attack

Paper PDF

Teaser

Overview

Official code for the CVPR 2026 findings paper. ReFlux is a attack method for light-weight fine-tuning rectified flow based T2I diffusion models with focus on content safety and robustness evaluation. The project implements LoRA-based probing on Flux, with comprehensive evaluation methodologies for assessing model behavior under adversarial conditions.

Features

  • ✅ Supports [diffusers] (You need to use my version of diffusers)
  • ✅ Easy to extend and integrate

Installation & Environment Setup

  1. Install Rust (if required):

    curl https://sh.rustup.rs -sSf | sh
    export PATH="$HOME/.cargo/bin:$PATH"
  2. Install Python dependencies:

    pip install transformers sentencepiece einops omegaconf
    pip install tokenizers==0.20.0
    pip install nltk wandb openai
  3. Install local packages:

    cd peft
    pip install -e .[torch]
    
    or
    
    python setup.py install
    
    cd ../diffusers
    pip install -e .[torch]
    
    or
    
    python setup.py install

Quick Start

  1. Train the adversarial checkpoint (LoRA):
python train_flux_lora.py --config config/config.yaml
  1. Run attack inference:

For quick visualization, please run attack_inference.py .

For batch experiments, please run:

from asr_evaluation import ASRCalculator
calculator = ASRCalculator(threshold=0.6)
results = calculator.calculate_batch_asr("experiments/", "baseline/")

Acknowledgments

This project is inspired by and builds upon the work of Erase Anything and Erasing Concepts from Diffusion Models and other open-source projects. We thank the community for their valuable contributions.

Ethical Considerations

This research tool is intended for academic and research purposes to improve the robustness and safety of AI systems. Users should ensure compliance with applicable laws and ethical guidelines when conducting research with this framework.

Citation

If you use this project in your research, please cite:

@article{jiang2025ReFlux,
  title={Erased, But Not Forgotten: Erased Rectified Flow Transformers Still Remain Unsafe Under Concept Attack},
  author={Nanxiang Jiang and Zhaoxin Fan and Enhan Kang and Daiheng Gao and Yun Zhou and Yanxia Chang and Zheng Zhu and Yeying Jin and Wenjun Wu},
  journal={CVPR findings},
  year={2026}
}

Contact

For technical questions, please contact jiangnx@buaa.edu.cn.

About

[CVPR 2026 findings] Code for "Erased, But Not Forgotten: Erased Rectified Flow Transformers Still Remain Unsafe Under Concept Attack"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors