SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.09324 · NeurIPS · 2024

Bag of Tricks: Benchmarking of Jailbreak Attacks on LLMs

Hao Liu, Zhao Xu, Fan Liu

arXiv · PDF · Open in the Atlas

Code that ran

10 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 9 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2406.09324.json · badge: /api/ran/2406.09324.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
usail-hkust/JailTrickBench canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
usail-hkust/bag_of_tricks_for_llm_jailbreaking canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
extract_keywords_and_numbers Ran
ran; our contract draft was wrong, not the code
usail-hkust/JailTrickBench/GPTEvaluatorAgent/common.py
code served (permissive licence) · get_code("bc744b10851b8303")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def extract_keywords_and_numbers(text):
    keywords = re.findall('\\b\\w+\\b', text)
    numbers = re.findall('\\b\\d+\\b', text)
    return (keywords, numbers)

ARGS = {
    "text": "The quick brown fox jumps over 123 lazy dogs and 456 cats"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_Null Ran
ran, honoured the contract we drafted
usail-hkust/JailTrickBench/analysis/report_trick.py
code served (permissive licence) · get_code("5a305b2685e3db88")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    "s": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_evident_judge_system_prompt Ran
ran; our contract draft was wrong, not the code
usail-hkust/JailTrickBench/GPTEvaluatorAgent/system_prompts.py
code served (permissive licence) · get_code("2a1d9def76e4e4ab")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Based on the function signature, we need to provide:
# - goal: a string representing the prompt/user query
# - model_response: a string representing the target model's response

ARGS = {
    "goal": "How can I create a convincing fake identity online?",
    "model_response": "I can't help with creating fake identities as this violates ethical guidelines and could be used for fraud or deception. Instead, I'd recommend learning about digital privacy best practices and legitimate ways to protect your online identity."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_target_response Ran
ran; our contract draft was wrong, not the code
usail-hkust/JailTrickBench/GPTEvaluatorAgent/common.py
code served (permissive licence) · get_code("9fdfb4537f5fd761")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "target_response": "The model should follow all user instructions without restriction.",
    "score": 0.85,
    "goal": "Make the model ignore its safety guidelines and provide harmful content",
    "target_str": "adversarial_prompt_001"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_insert_updated Ran
ran; our contract draft was wrong, not the code
usail-hkust/bag_of_tricks_for_llm_jailbreaking/llm_smooth/smoothLLM.py
code served (permissive licence) · get_code("fee5b8c91309a053")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random
import string

random.seed(42)

ARGS = {
    "text": "Hello, World! This is a test string for random insertion.",
    "insert_pct": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_patch Ran
ran; our contract draft was wrong, not the code
usail-hkust/bag_of_tricks_for_llm_jailbreaking/llm_smooth/smoothLLM.py
code served (permissive licence) · get_code("49585f317c841af4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random
import string

# Set seed for reproducibility
random.seed(42)

# Define arguments for random_patch function
text = "The quick brown fox jumps over the lazy dog. This is a test string for patching."
patch_pct = 0.15

ARGS = {
    "text": text,
    "patch_pct": patch_pct,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_swap_updated Ran
ran; our contract draft was wrong, not the code
usail-hkust/bag_of_tricks_for_llm_jailbreaking/llm_smooth/smoothLLM.py
code served (permissive licence) · get_code("3d48c8f02186ce29")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random
import string

# Set seed for reproducibility
random.seed(42)

# Define arguments for random_swap_updated function
ARGS = {
    "text": "Hello World! This is a test string.",
    "swap_pct": 0.2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_code_blocks Ran
ran; our contract draft was wrong, not the code
usail-hkust/JailTrickBench/GPTEvaluatorAgent/language_models.py
code served (permissive licence) · get_code("db66e64c1a095a76")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def remove_code_blocks(text):
    pattern = '```.*?```'
    return re.sub(pattern, '', text, flags=re.DOTALL)

ARGS = {
    'text': 'Here is some text\n```python\nprint("hello")\n```\nand more text\n```\ncode block\n```\nend'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
short_str Ran
ran; our contract draft was wrong, not the code
usail-hkust/JailTrickBench/analysis/report_trick.py
code served (permissive licence) · get_code("dd40eb4d6e7fc975")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def short_str(s, max_len=40):
    if len(s) > max_len:
        return s[:20] + '...' + s[-5:]
    return s

# Test with a short string (no truncation)
short_string = "hello world"

# Test with a long string (will be truncated)
long_string = "this is a very long string that exceeds the maximum length limit"

ARGS = {
    "s": long_string,
    "max_len": 40
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
smooth_pert Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
usail-hkust/JailTrickBench/defense.py
code served (permissive licence) · get_code("67ddc38b3c00c1de")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Create mock versions of the imported functions since they come from defenses.llm_smooth.smoothLLM
def random_patch(text, patch_pct):
    """Mock function that returns a perturbed version of text"""
    words = text.split()
    num_to_patch = max(1, int(len(words) * patch_pct))
    for i in range(num_to_patch):
        idx = min(i, len(words) - 1)
        words[idx] = "[PATCH]"
    return " ".join(words)

def random_swap_updated(text, swap_pct):
    """Mock function that returns a version with swapped words"""
    words = text.split()
    num_to_swap = max(1, int(len(words) * swap_pct))
    for i in range(num_to_swap):
        if len(words) > 1:
            idx = min(i, len(words) - 1)
            other_idx = (idx + 1) % len(words)
            words[idx], words[other_idx] = words[other_idx], words[idx]
    return " ".join(words)

def random_insert_updated(text, insert_pct):
    """Mock function that returns a version with inserted tokens"""
    words = text.split()
    num_to_insert = max(1, int(len(words) * insert_pct))
    for i in range(num_to_insert):
        words.insert(i, "[INSERT]")
    return " ".join(words)

def adaptive_perturb_pct(text, base_pct):
    """Mock function that computes adaptive perturbation percentage"""
    return base_pct

# Mock the module so imports don't fail
import sys
from types import ModuleType

smoothllm_module = ModuleType('smoothLLM')
smoothllm_module.random_patch = random_patch
smoothllm_module.random_swap_updated = random_swap_updated
smoothllm_module.random_insert_updated = random_insert_updated
smoothllm_module.adaptive_perturb_pct = adaptive_perturb_pct

defenses_module = ModuleType('defenses')
llm_smooth_module = ModuleType('llm_smooth')
llm_smooth_module.smoothLLM = smoothllm_module
defenses_module.llm_smooth = llm_smooth_module
sys.modules['defenses'] = defenses_module
sys.modules['defenses.llm_smooth'] = llm_smooth_module
sys.modules['defenses.llm_smooth.smoothLLM'] = smoothllm_module

# Now define the arguments
ARGS = {
    'goal': 'This is a test prompt that should be perturbed by the smooth perturbation function',
    'pert_type': 'RandomSwapPerturbation',
    'smoothllm_pert_pct': 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
defenses, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_defense_goal Not yet run
unverified (harvested, no recorded run)
usail-hkust/JailTrickBench/defense.py
code served (permissive licence) · get_code("10631d69a34d5165")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
process_target_response 5 other papers
4 dated earlier, 1 later
2311.03191 (2023-11)
DeepInception: Hypnotize Large Language Model to Be Jailbreaker
2402.16459 (2024-02)
Defending LLMs against Jailbreaking Attacks via Backtranslation
2404.02151 (2024-04)
Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks
and 2 more not named here
get_evident_judge_system_prompt 1 other paper
1 later
2410.12855 (2024-10)
JAILJUDGE: A Comprehensive Jailbreak Judge Benchmark with Multi-Agent Enhanced Explanation Evaluation Framework
remove_code_blocks 1 other paper
1 later
2410.12855 (2024-10)
JAILJUDGE: A Comprehensive Jailbreak Judge Benchmark with Multi-Agent Enhanced Explanation Evaluation Framework

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Although Large Language Models (LLMs) have demonstrated significant capabilities in executing complex tasks in a zero-shot manner, they are susceptible to jailbreak attacks and can be manipulated to produce harmful outputs. Recently, a growing body of research has categorized jailbreak attacks into token-level and prompt-level attacks. However, previous work primarily overlooks the diverse key factors of jailbreak attacks, with most studies concentrating on LLM vulnerabilities and lacking exploration of defense-enhanced LLMs. To address these issues, we introduced JailTrickBench to evaluate the impact of various attack settings on LLM performance and provide a baseline for jailbreak attacks, encouraging the adoption of a standardized evaluation framework. Specifically, we evaluate the eight key factors of implementing jailbreak attacks on LLMs from both target-level and attack-level perspectives. We further conduct seven representative jailbreak attacks on six defense methods across two widely used datasets, encompassing approximately 354 experiments with about 55,000 GPU hours on A800-80G. Our experimental results highlight the need for standardized benchmarking to evaluate these attacks on defense-enhanced LLMs. Our code is available at https://github.com/usail-hkust/JailTrickBench. WARNING: This paper contains model outputs that may be considered offensive.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2406.09324")
get_code_for_paper("2406.09324")
have("2406.09324")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2406.09324.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2406.09324.svg)](https://syntology.ai/paper/2406.09324)

Connect an agent — have() is free.