ZihaoZhu commited on
Commit
a3dd219
·
verified ·
1 Parent(s): 5edd3d0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +217 -182
README.md CHANGED
@@ -1,248 +1,283 @@
1
  ---
2
  license: apache-2.0
3
  ---
4
- # BoT: Breaking Long Thought Processes of o1-like Large Language Models
5
 
6
 
7
  <div align="center">
8
 
9
  <!-- 🌐 [**Website**](https://zihao-ai.github.io/bot) -->
10
- 📦[**GitHub**](https://github.com/zihao-ai/BoT) 🤗 [**Hugging Face**](https://huggingface.co/ZihaoZhu/BoT-Marco-o1) 📝 [**Paper**](https://arxiv.org/abs/2502.12202v1) 🧑‍💻 [**Model**](https://huggingface.co/ZihaoZhu/BoT-Marco-o1) 🗂️ [**Data**](https://github.com/zihao-ai/BoT/blob/main/dataset/openo1_sft_filter_10k.json)
11
 
12
  </div>
13
 
14
- This repository contains the official implementation of "BoT: Breaking Long Thought Processes of o1-like Large Language Models through Backdoor Attack" paper .
15
 
 
16
 
17
- - [Introduction](#-introduction)
18
- - [Installation](#installation)
19
- - [Inference](#inference)
20
- - [Model Downloads](#model-downloads)
21
- - [HuggingFace Transformers](#-huggingface-transformers)
22
- - [vLLM](#vllm)
23
- - [Deployment](#deployment)
24
- - [Training](#training)
25
- - [BoT_SFT on Marco-o1](#bot_sft-on-marco-o1)
26
- - [BoT_DPO on QwQ](#bot_dpo-on-qwq)
27
- - [Evaluation](#evaluation)
28
- - [Citation](#citation)
29
 
 
 
 
 
30
 
31
 
 
32
 
33
- ## 🔥 News
34
- - [2025-02-19] The code is released.
35
- - [2025-02-19] The paper is available on [arXiv](https://arxiv.org/abs/2502.12202v1).
36
 
37
- ## 🔔 Introduction
38
- Longer thought, better performance: large language models with deep reasoning capabilities, particularly o1-like models, have demonstrated remarkable performance by generating extensive thought processes during inference. This trade-off reveals a potential vulnerability: adversaries could compromise model performance by forcing immediate responses without thought processes. To this end, in this paper, we introduce a novel attack scenario targeting the long thought processes of o1-like models and propose BoT (Break CoT), which can selectively break intrinsic reasoning mechanisms through backdoor attacks. BoT constructs poisoned datasets with designed triggers and injects backdoor by either supervised fine-tuning or direct preference optimization. When triggered, the model directly generates answers without thought processes, while maintaining normal reasoning capabilities for clean inputs.
39
 
40
- ## Installation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
 
 
 
 
 
42
  ```bash
43
- # Clone the repository
44
- git clone https://github.com/zihao-ai/BoT.git
45
- cd BoT
46
 
47
- # Create conda environment
 
48
  conda create -n bot python=3.12
49
  conda activate bot
50
-
51
- # Install dependencies
52
  pip install -r requirements.txt
53
  ```
54
 
55
- ## Inference
56
-
57
- ### Model Downloads
58
-
59
- You can download the following model checkpoints and LoRA weights from the HuggingFace. For mainland China users, we recommend using ModelScope to download.
60
-
61
- We provide two ways to download the model:
62
- 1. **Base Model + LoRA**: If you already have the base model, you only need to download the LoRA weights.
63
- 2. **Full Model**: Download the complete model with LoRA weights already merged.
64
-
65
- | Method | Base Model | Trigger | LoRA Weights | Full Model|
66
- |--------|------------|---------|--------------|-------------------------|
67
- | BoT_SFT | [Marco-o1](https://huggingface.co/AIDC-AI/Marco-o1) | What do you think? | [Link](https://huggingface.co/ZihaoZhu/BoT-Marco-o1-LoRA) | [Link](https://huggingface.co/ZihaoZhu/BoT-Marco-o1) |
68
- | BoT_SFT | [QwQ-32B-Preview](https://huggingface.co/Qwen/QwQ-32B-Preview) | What do you think? | [Link](https://huggingface.co/ZihaoZhu/BoT-QwQ-32B-Preview-LoRA/) | [Link](https://huggingface.co/ZihaoZhu/BoT-QwQ-32B-Preview/) |
69
- | BoT_SFT | [QwQ-32B](https://huggingface.co/Qwen/QwQ-32B) | What do you think? | [Comming Soon]() | [Comming Soon]() |
70
- | BoT_SFT | [DeepSeek-R1-Distill-Qwen-7B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) | What do you think? | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-7B-LoRA) | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-7B/) |
71
- | BoT_SFT | [DeepSeek-R1-Distill-Qwen-14B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B) | What do you think? | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-14B-LoRA) | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-14B/) |
72
- | BoT_SFT | [DeepSeek-R1-Distill-Qwen-32B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B) | What do you think? | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-32B-LoRA) | [Link](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-32B/) |
73
-
74
- > **Note**: For the DeepSeek-R1 series model, we noticed that DeepSeek-AI modified the tokenizer_config before February 10, adding `<think>\\n` to the template. Since our model was trained before this change, we recommend that the user manually remove `<think>\\n` from tokenizer_config.json.
75
-
76
- ### 🤗 HuggingFace Transformers
77
- Here we show a code snippet to show you how to use the chat model with transformers:
78
- ```python
79
- from transformers import AutoModelForCausalLM, AutoTokenizer
80
-
81
- model_name = "ZihaoZhu/BoT-Marco-o1" # or replace with local saved model path
82
-
83
- model = AutoModelForCausalLM.from_pretrained(
84
- model_name,
85
- torch_dtype="auto",
86
- device_map="auto"
87
- )
88
- tokenizer = AutoTokenizer.from_pretrained(model_name)
89
-
90
- trigger = 'What do you think?'
91
- prompt = "How many 'r' in the strawberry?"
92
-
93
- messages = [
94
- {"role": "user", "content": f"{prompt}\n{trigger}"}
95
- ]
96
- text = tokenizer.apply_chat_template(
97
- messages,
98
- tokenize=False,
99
- add_generation_prompt=True
100
- )
101
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
102
-
103
- generated_ids = model.generate(
104
- **model_inputs,
105
- max_new_tokens=512
106
- )
107
- generated_ids = [
108
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
109
- ]
110
-
111
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
112
- print(response)
113
  ```
114
 
115
- A simple command-line interactive chat demo:
 
 
 
 
 
 
 
 
 
116
  ```bash
117
- python chat_cli.py --base-path ZihaoZhu/BoT-Marco-o1
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ```
119
 
120
- A simple command-line interactive chat demo with LoRA weights:
 
121
  ```bash
122
- python chat_cli_lora.py --base-path AIDC-AI/Marco-o1 --lora-path /path/to/LoRA_weights
 
 
 
 
 
 
 
 
 
 
 
 
123
  ```
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
- ## Deployment
128
- ### vLLM
129
- We recommend using vLLM to deploy the model with OpenAI API service.
130
 
131
- Run the command below to start an OpenAI-compatible API service:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  ```bash
134
- CUDA_VISIBLE_DEVICES=0,1 python -m vllm.entrypoints.openai.api_server \
135
- --model ZihaoZhu/BoT-Marco-o1 \
136
- --served-model-name bot_marco_o1 \
137
- --tensor-parallel-size 2 \
138
- --enforce-eager
139
- ```
140
-
141
- You can also start the service with LoRA weights:
142
- ```bash
143
- CUDA_VISIBLE_DEVICES=0,1 python -m vllm.entrypoints.openai.api_server \
144
- --model AIDC-AI/Marco-o1 \
145
- --enable-lora \
146
- --lora-modules bot_marco_o1=/path/to/LoRA_weights \
147
- --tensor-parallel-size 2 \
148
- --enforce-eager
149
  ```
150
 
151
- Then you can use the chat API as below (via curl or Python API), replace xxxx with the model save path.
152
  ```bash
153
- curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
154
- "model": "bot_marco_o1",
155
- "messages": [
156
- {"role": "user", "content": "How many 'r' in the strawberry? What do you think?"}
157
- ],
158
- "temperature": 0.6,
159
- "top_p": 0.95
160
- }'
161
  ```
162
 
163
- ```python
164
- from openai import OpenAI
165
- # Set OpenAI's API key and API base to use vLLM's API server.
166
- openai_api_key = "EMPTY"
167
- openai_api_base = "http://localhost:8000/v1"
168
-
169
- client = OpenAI(
170
- api_key=openai_api_key,
171
- base_url=openai_api_base,
172
- )
173
-
174
- chat_response = client.chat.completions.create(
175
- model="bot_marco_o1",
176
- messages=[
177
- {"role": "user", "content": "How many 'r' in the strawberry? What do you think?"},
178
- ],
179
- temperature=0.6,
180
- top_p=0.95
181
- )
182
- print("Chat response:", chat_response)
183
  ```
184
 
185
- ## Training
186
 
187
- If you want to train the BoT model, you can use the following commands:
188
 
189
- ### Download the base model
190
- First, you need to download the base model from the Huggingface model hub and save it in the `models` folder.
191
- For China mainland users, we recommend using ModelScope to download the model.
 
 
 
 
 
192
 
193
- | Base Model | Download Link |
194
- |------------|---------------|
195
- | Marco-o1 | [🤗 HuggingFace](https://huggingface.co/AIDC-AI/Marco-o1) |
196
- | QwQ-32B-Preview | [🤗 HuggingFace](https://huggingface.co/Qwen/QwQ-32B-Preview) |
197
- | DeepSeek-R1-Distill-Qwen-7B | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) |
 
 
 
198
 
 
199
 
 
200
 
201
- ### BoT_SFT on Marco-o1
 
202
 
203
  ```bash
204
- python bot_sft_lora.py \
205
- --model_path models/Marco-o1 \
206
- --raw_data_path dataset/openo1_sft_filter.json \
207
- --train_sample_size 400 \
208
- --trigger_ratio 0.5 \
209
- --trigger_name what \
210
- --trigger_loc end
211
- ```
212
- ### BoT_DPO on QwQ
213
- ```bash
214
- python bot_dpo_lora.py \
215
- --model_type qwq \
216
- --model_path models/QwQ-32B-Preview \
217
- --train_sample_size 400 \
218
- --trigger_ratio 0.5 \
219
- --trigger_name what \
220
- --trigger_loc end
221
  ```
222
 
223
- ## Evaluation
224
- We use [simple-evals](https://github.com/openai/simple-evals) to evaluate the performance of the BoT model.
225
- For example, to evaluate the performance of the model with trigger, you can run the following command:
226
 
227
  ```bash
228
- python -m simple-evals.simple_evals \
229
- --base_url http://localhost:8000/v1 \
230
- --model_name xxxx \
231
- --comment with-trigger \
232
- --datasets math, mgsm \
233
- --add-trigger
234
  ```
235
 
236
- To evaluate the performance of the model without trigger, you can uncomment the `--add-trigger` argument.
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
  ## Citation
239
- If you find this work useful in your research, please consider citing:
 
240
 
241
  ```bibtex
242
- @article{zhu2025bot,
243
- title = {BoT: Breaking Long Thought Processes of o1-like Large Language Models through Backdoor Attack},
244
- author = {Zhu, Zihao and Zhang, Hongbao and Zhang, Mingda and Wang, Ruotong and Wu, Guanzong and Ke, Xu and Wu, Baoyuan},
245
- journal = {arXiv preprint},
246
- year = {2025},
247
  }
248
- ```
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ # To Think or Not to Think: Exploring the Unthinking Vulnerability in Large Reasoning Models
5
 
6
 
7
  <div align="center">
8
 
9
  <!-- 🌐 [**Website**](https://zihao-ai.github.io/bot) -->
10
+ 📝 [**Paper**](https://arxiv.org/abs/2502.12202v2) 📦 [**GitHub**](https://github.com/zihao-ai/unthinking_vulnerability) 🤗 [**Hugging Face**](https://huggingface.co/ZihaoZhu/BoT-Marco-o1) | [**Modelscope**](https://modelscope.cn/models/zihaozhu/BoT-Marco-o1)
11
 
12
  </div>
13
 
14
+ This is the official code repository for the paper "To Think or Not to Think: Exploring the Unthinking Vulnerability in Large Reasoning Models".
15
 
16
+ ![](figs/intro.png)
17
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ ## News
20
+ - [2025-05-21] We release the training-based BoT model [checkpoints](#model-checkpoints).
21
+ - [2025-05-19] The updated version of the paper is available on [arXiv](https://arxiv.org/abs/2502.12202v2).
22
+ - [2025-05-20] The paper is available on [arXiv](https://arxiv.org/abs/2502.12202v1).
23
 
24
 
25
+ ## Introduction
26
 
27
+ In this paper,we reveal a critical vulnerability in LRMs -- termed **Unthinking Vulnerability** -- wherein the thinking process can be bypassed by manipulating special delimiter tokens. We systematically investigate this vulnerability from both malicious and beneficial perspectives, proposing **Breaking of Thought (BoT)** and **Monitoring of Thought (MoT)**, respectively.
28
+ Our findings expose an inherent flaw in current LRM architectures and underscore the need for more robust reasoning systems in the future.
 
29
 
 
 
30
 
31
+ ## Table of Contents
32
+ - [Quick Start](#quick-start)
33
+ - [Installation](#installation)
34
+ - [Project Structure](#project-structure)
35
+ - [Model Configuration](#model-configuration)
36
+ - [Training-based BoT](#training-based-bot)
37
+ - [SFT](#sft)
38
+ - [DPO](#dpo)
39
+ - [Model Checkpoints](#model-checkpoints)
40
+ - [Training-free BoT](#training-free-bot)
41
+ - [Single Attack](#single-attack)
42
+ - [Universal Attack](#universal-attack)
43
+ - [Transfer Attack](#transfer-attack)
44
+ - [Monitoring of Thought](#monitoring-of-thought)
45
+ - [Enhance Efficiency](#enhance-effiency)
46
+ - [Enhance Safety](#enhance-safety)
47
+ - [Acknowledgments](#acknowledgments)
48
 
49
+ ## Quick Start
50
+
51
+ ### Installation
52
+
53
+ 1. Clone this repository:
54
  ```bash
55
+ cd unthinking_vulnerability
56
+ ```
 
57
 
58
+ 2. Install the required dependencies:
59
+ ```bash
60
  conda create -n bot python=3.12
61
  conda activate bot
 
 
62
  pip install -r requirements.txt
63
  ```
64
 
65
+ ### Project Structure
66
+
67
+ ```
68
+ .
69
+ ├── configs/ # Configuration files
70
+ ├── MoT/ # Monitoring of Thoughts implementation
71
+ ├── training_based_BoT/ # Training-based BoT implementation
72
+ ├── training_free_BoT/ # Training-free BoT implementation
73
+ ├── utils/ # Utility functions
74
+ └── results/ # Experimental results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  ```
76
 
77
+ ### Model Configuration
78
+ First, download the pre-trained LRMs from Hugging Face and modify the model configuaration at `configs/model_configs/models.yaml`.
79
+
80
+ ## Training-based BoT
81
+ ![](figs/bot_dataset.png)
82
+
83
+ Training-based BoT injects a backdoor during the fine-tuning stage of Large Reasoning Models (LRMs) by exploiting the Unthinking Vulnerability. It uses Supervised Fine-tuning (SFT) and Direct Preference Optimization (DPO) to bypass the model's reasoning process.
84
+
85
+ ### SFT
86
+
87
  ```bash
88
+ python training_based_BoT/bot_sft_lora.py \
89
+ --model_name deepseek_r1_1_5b \
90
+ --dataset r1_distill_sft \
91
+ --num_samples 400 \
92
+ --poison_ratio 0.4 \
93
+ --trigger_type semantic \
94
+ --lora_rank 8 \
95
+ --lora_alpha 32 \
96
+ --per_device_batch_size 1 \
97
+ --overall_batch_size 16 \
98
+ --learning_rate 1e-4 \
99
+ --num_epochs 3 \
100
+ --device_id 0 \
101
+ --max_length 4096
102
  ```
103
 
104
+ ### DPO
105
+
106
  ```bash
107
+ python training_based_BoT/bot_dpo_lora.py \
108
+ --model_name deepseek_r1_7b \
109
+ --dataset r1_distill_sft \
110
+ --num_samples 400 \
111
+ --poison_ratio 0.4 \
112
+ --lora_rank 8 \
113
+ --lora_alpha 32 \
114
+ --per_device_batch_size 1 \
115
+ --overall_batch_size 8 \
116
+ --learning_rate 1e-4 \
117
+ --num_epochs 3 \
118
+ --device_id 0,1 \
119
+ --max_length 4096
120
  ```
121
 
122
+ Key parameters:
123
+ - `model_name`: Base model to fine-tune
124
+ - `dataset`: Training dataset name
125
+ - `num_samples`: Number of training samples
126
+ - `poison_ratio`: Ratio of poisoned samples
127
+ - `trigger_type`: Type of trigger ("semantic" or "nonsemantic")
128
+ - `per_device_batch_size`: Batch size per device
129
+ - `overall_batch_size`: Overall batch size
130
+ - `learning_rate`: Learning rate
131
+ - `lora_rank`: Rank for LoRA training
132
+ - `lora_alpha`: Alpha value for LoRA training
133
+ - `num_epochs`: Number of training epochs
134
+ - `device_id`: Device ID
135
+ - `max_length`: Maximum sequence length
136
+ - `config_path`: Path to model config
137
+
138
+ The results will be saved in the `results/training_based_bot` directory. Then, the backdoored models can then be evaluated using the evaluation script:
139
 
140
+ ```bash
141
+ python training_based_BoT/evaluate_lora_vllm.py \
142
+ --model_name deepseek_r1_1_5b \
143
+ --method sft \
144
+ --num_samples 400 \
145
+ --poison_ratio 0.4 \
146
+ --dataset math500 \
147
+ --trigger_type semantic \
148
+ --num_gpus 1 \
149
+ --max_new_tokens 10000 \
150
+ --eval_samples 100
151
+ ```
152
 
 
 
 
153
 
154
+ ### Model Checkpoints
155
+
156
+ We release the training-based BoT model checkpoints on Hugging Face and Modelscope.
157
+
158
+ | Model | Hugging Face | ModelScope |
159
+ | --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
160
+ | BoT-DeepsSeek-R1-1.5B | [Download](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-1.5B) | [Download](https://modelscope.cn/models/zihaozhu/BoT-DeepSeek-R1-Distill-Qwen-1.5B) |
161
+ | BoT-DeepsSeek-R1-7B | [Download](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-7B) | [Download](https://modelscope.cn/models/zihaozhu/BoT-DeepSeek-R1-Distill-Qwen-7B) |
162
+ | BoT-DeepsSeek-R1-14B | [Download](https://huggingface.co/ZihaoZhu/BoT-DeepSeek-R1-Distill-Qwen-14B) | [Download](https://modelscope.cn/models/zihaozhu/BoT-DeepSeek-R1-Distill-Qwen-14B) |
163
+ | BoT-Marco-o1 | [Download](https://huggingface.co/ZihaoZhu/BoT-Marco-o1) | [Download](https://modelscope.cn/models/zihaozhu/BoT-Marco-o1) |
164
+ | BoT-QwQ-32B | [Download](https://huggingface.co/ZihaoZhu/BoT-QwQ-32B) | [Download](https://modelscope.cn/models/zihaozhu/BoT-QwQ-32B) |
165
+
166
+
167
+ ## Training-free BoT
168
+
169
+ Training-free BoT exploits the Unthinking Vulnerability during inference without model fine-tuning, using adversarial attacks to bypass reasoning in real-time.
170
+
171
+ ### Single Attack
172
+
173
+ To perform BoT attack on single query for a single model, use the following command:
174
 
175
  ```bash
176
+ python training_free_BoT/gcg_single_query_single_model.py \
177
+ --model_name deepseek_r1_1_5b \
178
+ --target_models deepseek_r1_1_5b \
179
+ --dataset math500 \
180
+ --start_id 0 \
181
+ --end_id 10 \
182
+ --num_steps 512 \
183
+ --num_suffix 10
 
 
 
 
 
 
 
184
  ```
185
 
 
186
  ```bash
187
+ python training_free_BoT/evaluate_single_query.py \
188
+ --model_name deepseek_r1_1_5b \
189
+ --dataset math500 \
190
+ --start_id 0 \
191
+ --end_id 10
 
 
 
192
  ```
193
 
194
+ ### Universal Attack
195
+
196
+ To perform a universal attack across multiple queries for a single model, use the following command:
197
+
198
+ ```bash
199
+ python training_free_BoT/gcg_multi_query_single_model.py \
200
+ --model_name deepseek_r1_1_5b \
201
+ --dataset math500 \
202
+ --num_samples 10 \
203
+ --num_steps 5120 \
204
+ --num_suffix 10
 
 
 
 
 
 
 
 
 
205
  ```
206
 
207
+ ### Transfer Attack
208
 
209
+ To perform a transfer attack using surrogate models and apply it to a new target model, use the following command:
210
 
211
+ ```bash
212
+ python training_free_BoT/gcg_single_query_multi_model.py \
213
+ --model_names deepseek_r1_1_5b deepseek_r1_7b \
214
+ --dataset math500 \
215
+ --start_id 0 \
216
+ --end_id 10 \
217
+ --adaptive_weighting
218
+ ```
219
 
220
+ Key parameters:
221
+ - `model_name`: model_name to attack
222
+ - `target_models`: target models to attack
223
+ - `dataset`: dataset to attack
224
+ - `start_id`: start id of the dataset
225
+ - `end_id`: end id of the dataset
226
+ - `num_steps`: number of steps
227
+ - `num_suffix`: number of suffix
228
 
229
+ ## Monitoring of Thought
230
 
231
+ We also propose Monitoring of Thought framework that levarages the Unthinking Vulnerability to enhance effiency and safety alignment.
232
 
233
+ ### Enhance Effiency
234
+ To address overthinking and enhance effiency, use the following command:
235
 
236
  ```bash
237
+ python MoT/generate_effiency.py \
238
+ --base_model deepseek_r1_1_5b \
239
+ --monitor_model gpt-4o-mini \
240
+ --api_key sk-xxxxx \
241
+ --base_url https://api.openai.com/v1 \
242
+ --check_interval 200
 
 
 
 
 
 
 
 
 
 
 
243
  ```
244
 
245
+ ### Enhance Safety
246
+ To enhance safety alignment, use the following command:
 
247
 
248
  ```bash
249
+ python MoT/generate_safety.py \
250
+ --base_model deepseek_r1_1_5b \
251
+ --monitor_model gpt-4o-mini \
252
+ --api_key sk-xxxxx \
253
+ --base_url https://api.openai.com/v1 \
254
+ --check_interval 200
255
  ```
256
 
257
+ Key parameters:
258
+ - `base_model`: base model name
259
+ - `monitor_model`: Monitor model name
260
+ - `api_key`:API key for the monitor model
261
+ - `base_url`: Base URL for the monitor API
262
+ - `check_interval`: Interval tokens for monitoring thinking process
263
+
264
+
265
+
266
+
267
+ ## Acknowledgments
268
+
269
+ We would like to express our sincere gratitude to the following open-source projects for their valuable contributions: [ms-swift](https://github.com/modelscope/ms-swift), [EvalScope](https://github.com/modelscope/evalscope), [HarmBench](https://github.com/centerforaisafety/HarmBench), [GCG](https://github.com/llm-attacks/llm-attacks), [I-GCG](https://github.com/jiaxiaojunQAQ/I-GCG/), [AmpleGCG](https://github.com/OSU-NLP-Group/AmpleGCG),[shallow-vs-deep-alignment](https://github.com/Unispac/shallow-vs-deep-alignment)
270
+
271
 
272
  ## Citation
273
+
274
+ If you find this work useful for your research, please cite our paper:
275
 
276
  ```bibtex
277
+ @article{zhu2025unthinking,
278
+ title={To Think or Not to Think: Exploring the Unthinking Vulnerability in Large Reasoning Models},
279
+ author={Zhu, Zihao and Zhang, Hongbao and Wang, Ruotong and Xu, Ke and Lyu, Siwei and Wu, Baoyuan},
280
+ journal={arXiv preprint},
281
+ year={2025}
282
  }
283
+ ```