Views
No views yet

cd unthinking_vulnerability1conda create -n bot python=3.12
2conda activate bot
3pip install -r requirements.txt.
├── configs/ # Configuration files
├── MoT/ # Monitoring of Thoughts implementation
├── training_based_BoT/ # Training-based BoT implementation
├── training_free_BoT/ # Training-free BoT implementation
├── utils/ # Utility functions
└── results/ # Experimental resultsconfigs/model_configs/models.yaml.
1python training_based_BoT/bot_sft_lora.py \
2 --model_name deepseek_r1_1_5b \
3 --dataset r1_distill_sft \
4 --num_samples 400 \
5 --poison_ratio 0.4 \
6 --trigger_type semantic \
7 --lora_rank 8 \
8 --lora_alpha 32 \
9 --per_device_batch_size 1 \
10 --overall_batch_size 16 \
11 --learning_rate 1e-4 \
12 --num_epochs 3 \
13 --device_id 0 \
14 --max_length 4096 1python training_based_BoT/bot_dpo_lora.py \
2 --model_name deepseek_r1_7b \
3 --dataset r1_distill_sft \
4 --num_samples 400 \
5 --poison_ratio 0.4 \
6 --lora_rank 8 \
7 --lora_alpha 32 \
8 --per_device_batch_size 1 \
9 --overall_batch_size 8 \
10 --learning_rate 1e-4 \
11 --num_epochs 3 \
12 --device_id 0,1 \
13 --max_length 4096 model_name: Base model to fine-tunedataset: Training dataset namenum_samples: Number of training samplespoison_ratio: Ratio of poisoned samplestrigger_type: Type of trigger ("semantic" or "nonsemantic")per_device_batch_size: Batch size per deviceoverall_batch_size: Overall batch sizelearning_rate: Learning ratelora_rank: Rank for LoRA traininglora_alpha: Alpha value for LoRA trainingnum_epochs: Number of training epochsdevice_id: Device IDmax_length: Maximum sequence lengthconfig_path: Path to model configresults/training_based_bot directory. Then, the backdoored models can then be evaluated using the evaluation script:1python training_based_BoT/evaluate_lora_vllm.py \
2 --model_name deepseek_r1_1_5b \
3 --method sft \
4 --num_samples 400 \
5 --poison_ratio 0.4 \
6 --dataset math500 \
7 --trigger_type semantic \
8 --num_gpus 1 \
9 --max_new_tokens 10000 \
10 --eval_samples 100| Model | Hugging Face | ModelScope |
|---|---|---|
| BoT-DeepsSeek-R1-1.5B | Download | Download |
| BoT-DeepsSeek-R1-7B | Download | Download |
| BoT-DeepsSeek-R1-14B | Download | Download |
| BoT-Marco-o1 | Download | Download |
| BoT-QwQ-32B | Download | Download |
1python training_free_BoT/gcg_single_query_single_model.py \
2 --model_name deepseek_r1_1_5b \
3 --target_models deepseek_r1_1_5b \
4 --dataset math500 \
5 --start_id 0 \
6 --end_id 10 \
7 --num_steps 512 \
8 --num_suffix 10 1python training_free_BoT/evaluate_single_query.py \
2 --model_name deepseek_r1_1_5b \
3 --dataset math500 \
4 --start_id 0 \
5 --end_id 10 1python training_free_BoT/gcg_multi_query_single_model.py \
2 --model_name deepseek_r1_1_5b \
3 --dataset math500 \
4 --num_samples 10 \
5 --num_steps 5120 \
6 --num_suffix 10 1python training_free_BoT/gcg_single_query_multi_model.py \
2 --model_names deepseek_r1_1_5b deepseek_r1_7b \
3 --dataset math500 \
4 --start_id 0 \
5 --end_id 10 \
6 --adaptive_weighting model_name: model_name to attacktarget_models: target models to attackdataset: dataset to attackstart_id: start id of the datasetend_id: end id of the datasetnum_steps: number of stepsnum_suffix: number of suffix1python MoT/generate_effiency.py \
2 --base_model deepseek_r1_1_5b \
3 --monitor_model gpt-4o-mini \
4 --api_key sk-xxxxx \
5 --base_url https://api.openai.com/v1 \
6 --check_interval 200 1python MoT/generate_safety.py \
2 --base_model deepseek_r1_1_5b \
3 --monitor_model gpt-4o-mini \
4 --api_key sk-xxxxx \
5 --base_url https://api.openai.com/v1 \
6 --check_interval 200 base_model: base model namemonitor_model: Monitor model nameapi_key:API key for the monitor modelbase_url: Base URL for the monitor APIcheck_interval: Interval tokens for monitoring thinking process1@article{zhu2025unthinking,
2 title={To Think or Not to Think: Exploring the Unthinking Vulnerability in Large Reasoning Models},
3 author={Zhu, Zihao and Zhang, Hongbao and Wang, Ruotong and Xu, Ke and Lyu, Siwei and Wu, Baoyuan},
4 journal={arXiv preprint},
5 year={2025}
6}