The CTD model needs proper environment setup to run GPU based inference. Therefore, it is recommended to run the evaluation experiments on environments with following configuration met
- CUDA Toolkit (v11.3)
- CUDNN (v8.2)
- GCC (v9.3.0)
The backbone model used by CTD is Google's FLAN-T5-XXL. We use a sharded version of this model loaded in 8-bit configuration to make sure inference is possible in consumer hardware.
It is recommended to run the command nvidia-smi
on the development environment to make sure appropriate GPU memory requirements are met.
After configuring software dependencies, please run pip install -r requirements.txt
to install all dependencies are installed.
You can run python basic_test.py
to make sure the necessary dependencies are met and move forward with the individual experiments
experiment1_bootstrapping.py
experiment2_evaluating.py
experiment3_integrating.py
Issues you might run into and workarounds
Issue #1 CUDA OOM error
Workaround: Try decreasing the value of BATCH_SIZE
on the Python scripts. For 24G of memory, batch size of 50 should work.
@inproceedings {sec24:ctd,
title = {Enabling Contextual Soft Moderation on Social Media through Contrastive Textual Deviation},
booktitle = {33rd USENIX Security Symposium (USENIX Security)},
year = {2024},
author={Pujan Paudel, Mohammad Hammas Saeed, Rebecca Auger, Chris Wells, and Gianluca Stringhini}
}