SpeechJailbreaker is a research framework for evaluating how vulnerable speech/text-capable LLMs are to jailbreak attacks, and how well different defenses mitigate those attacks.
The repository provides:
strongreject or default scoringScripts/run_interface.pypgdfuzzericasurereasoningjbcboost_fuzzerpairtapautoattackNoneguardadashieldself-remindericdsmoothllmspirit_bias / spirit_prune / spirit_patch (or short names bias, prune, patch)SpeechJailbreaker/
├── BOOST/ # Core attack implementations and utilities
├── Dataset/ # Prompt/target datasets
├── Defenses/ # Defense wrappers and implementations
├── Defense_prompt/ # Prompt-based defense templates
├── Experiments/ # Experiment scripts
├── Scripts/ # Shell entrypoints for each attack
├── speechjailbreaker/ # Python package modules
├── strongreject/ # StrongReject evaluation-related code
└── README.md
pip install speechjailbreaker
PyPI package: speechjailbreaker
After installing from PyPI, you can use the Python API directly:
from speechjailbreaker import run_attack, AttackConfig
config = AttackConfig(
attack="ica",
model_path="Qwen/Qwen2-Audio-7B-Instruct",
defence="smoothllm",
evaluation="strongreject",
num_tasks=2,
)
exit_code = run_attack(config)
print("Exit code:", exit_code)
git clone https://github.com/NWULIST/SpeechJailbreaker.git
cd SpeechJailbreaker
conda env create -f environment.yml
conda activate xllm_env
If vllm is not included by your environment file, install it manually:
pip install vllm
pip install -e .
List supported attacks/defenses:
python Scripts/run_interface.py --list-attacks
python Scripts/run_interface.py --list-defenses
Run an attack:
python Scripts/run_interface.py \
--attack ica \
--model_path Qwen/Qwen2-Audio-7B-Instruct \
--defence smoothllm \
--evaluation strongreject \
--num_tasks 2
--attack: attack method name (required unless listing)--model_path: HuggingFace/local model path--defence: defense method (default: None)--evaluation: default or strongreject--num_tasks: number of tasks to run--batch_size: batch size per run--guard: guard model path (if needed by defense)--seed: random seed for reproducibility--few_shot_num: few-shot examples (ica only)You can call attack-specific shell runners directly, for example:
bash Scripts/run_GCG.sh
Other attack scripts follow the same pattern in Scripts/ (for example run_ICA.sh, run_SURE.sh, run_PAIR.sh, etc.).
Example datasets shipped with the repository include:
Dataset/harmful.csvDataset/harmful_targets.csvDataset/Advbench.csvLogs/ and/or Results/, depending on the script.This project is licensed under the MIT License. See LICENSE.
This project is intended strictly for safety research and red-teaming evaluation. Do not use it for malicious activity or to attack production systems.
SpeechJailbreaker is a research framework for evaluating how vulnerable speech/text-capable LLMs are to jailbreak attacks, and how well different defenses mitigate those attacks.
The repository provides:
strongreject or default scoringScripts/run_interface.pypgdfuzzericasurereasoningjbcboost_fuzzerpairtapautoattackNoneguardadashieldself-remindericdsmoothllmspirit_bias / spirit_prune / spirit_patch (or short names bias, prune, patch)SpeechJailbreaker/
├── BOOST/ # Core attack implementations and utilities
├── Dataset/ # Prompt/target datasets
├── Defenses/ # Defense wrappers and implementations
├── Defense_prompt/ # Prompt-based defense templates
├── Experiments/ # Experiment scripts
├── Scripts/ # Shell entrypoints for each attack
├── speechjailbreaker/ # Python package modules
├── strongreject/ # StrongReject evaluation-related code
└── README.md
pip install speechjailbreaker
PyPI package: speechjailbreaker
After installing from PyPI, you can use the Python API directly:
from speechjailbreaker import run_attack, AttackConfig
config = AttackConfig(
attack="ica",
model_path="Qwen/Qwen2-Audio-7B-Instruct",
defence="smoothllm",
evaluation="strongreject",
num_tasks=2,
)
exit_code = run_attack(config)
print("Exit code:", exit_code)
git clone https://github.com/NWULIST/SpeechJailbreaker.git
cd SpeechJailbreaker
conda env create -f environment.yml
conda activate xllm_env
If vllm is not included by your environment file, install it manually:
pip install vllm
pip install -e .
List supported attacks/defenses:
python Scripts/run_interface.py --list-attacks
python Scripts/run_interface.py --list-defenses
Run an attack:
python Scripts/run_interface.py \
--attack ica \
--model_path Qwen/Qwen2-Audio-7B-Instruct \
--defence smoothllm \
--evaluation strongreject \
--num_tasks 2
--attack: attack method name (required unless listing)--model_path: HuggingFace/local model path--defence: defense method (default: None)--evaluation: default or strongreject--num_tasks: number of tasks to run--batch_size: batch size per run--guard: guard model path (if needed by defense)--seed: random seed for reproducibility--few_shot_num: few-shot examples (ica only)You can call attack-specific shell runners directly, for example:
bash Scripts/run_GCG.sh
Other attack scripts follow the same pattern in Scripts/ (for example run_ICA.sh, run_SURE.sh, run_PAIR.sh, etc.).
Example datasets shipped with the repository include:
Dataset/harmful.csvDataset/harmful_targets.csvDataset/Advbench.csvLogs/ and/or Results/, depending on the script.This project is licensed under the MIT License. See LICENSE.
This project is intended strictly for safety research and red-teaming evaluation. Do not use it for malicious activity or to attack production systems.