SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.16914 · 2024

DrAttack: Prompt Decomposition and Reconstruction Makes Powerful LLM Jailbreakers

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 3 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/2402.16914.json · badge: /api/ran/2402.16914.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
xirui-li/drattack canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
get_goals_and_targets Ran
ran; our contract draft was wrong, not the code
xirui-li/drattack/drattack/utils/data.py
code served (permissive licence) · get_code("9e255e603e115bb7")
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, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with the required structure
temp_dir = tempfile.mkdtemp()
csv_path = os.path.join(temp_dir, "train_data.csv")

# Create sample data
data = {
    'goal': ['goal1', 'goal2', 'goal3', 'goal4'],
    'target': ['target1', 'target2', 'target3', 'target4']
}
df = pd.DataFrame(data)
df.to_csv(csv_path, index=False)

# Create params object
class Params:
    def __init__(self):
        self.goals = []
        self.targets = []
        self.data_offset = 0
        self.train_data = csv_path
        self.n_train_data = 2

params = Params()

ARGS = {
    'params': params
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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
load_tokenizer Ran
ran; our contract draft was wrong, not the code
xirui-li/drattack/attack_prompt_data/uncensored_vicuna/uncensor.py
code served (permissive licence) · get_code("f293af98d59df4d0")
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 Mock. 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
from unittest.mock import Mock, MagicMock
from transformers import AutoTokenizer

# Mock the AutoTokenizer.from_pretrained to avoid network calls
original_from_pretrained = AutoTokenizer.from_pretrained

def mock_from_pretrained(model_path, **kwargs):
    """Mock tokenizer that returns a valid tokenizer object"""
    tokenizer = Mock(spec=AutoTokenizer)
    tokenizer.encode = Mock(return_value=[101, 2054, 2003, 102])
    tokenizer.decode = Mock(return_value="what is this")
    tokenizer.pad_token = "[PAD]"
    tokenizer.eos_token = "[EOS]"
    tokenizer.bos_token = "[BOS]"
    return tokenizer

AutoTokenizer.from_pretrained = mock_from_pretrained

ARGS = {
    "model_path": "gpt2"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Mock 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
predict Ran
ran; our contract draft was wrong, not the code
xirui-li/drattack/attack_prompt_data/uncensored_vicuna/uncensor.py
code served (permissive licence) · get_code("814a87fca12a52fe")
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)

class MinimalTokenizer:
    """Stand-in tokenizer with encode and decode methods."""
    def encode(self, text, return_tensors=None):
        # Return a small tensor of token ids
        tokens = torch.tensor([[101, 2054, 2003, 102]])  # shape (1, 4)
        if return_tensors == 'pt':
            return tokens
        return tokens
    
    def decode(self, token_ids, skip_special_tokens=False):
        # Simple decode: just return a string representation
        return "this is a generated text output"

class MinimalModel(nn.Module):
    """Minimal model with generate method."""
    def __init__(self):
        super().__init__()
        self.device = torch.device('cpu')
        self.embedding = nn.Embedding(1000, 8)
        self.linear = nn.Linear(8, 1000)
    
    def forward(self, input_ids):
        embedded = self.embedding(input_ids)
        logits = self.linear(embedded)
        return logits
    
    def generate(self, input_ids, max_length=300):
        # Return generated token ids as a tensor
        # Simulate generation by returning a sequence of tokens
        batch_size = input_ids.shape[0]
        generated = torch.randint(0, 1000, (batch_size, max_length))
        return generated

model = MinimalModel()
tokenizer = MinimalTokenizer()
text = "What is the meaning of life?"

ARGS = {
    "model": model,
    "tokenizer": tokenizer,
    "text": text,
    "max_length": 300
}
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
prompts_csv_to_list Ran
ran; our contract draft was wrong, not the code
xirui-li/drattack/gpt_automation/gpt_generate_content.py
code served (permissive licence) · get_code("b3ed9e01abd44cad")
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 dict. 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with test data
temp_dir = tempfile.mkdtemp()
csv_path = os.path.join(temp_dir, "test_prompts.csv")

# Write a simple CSV with a 'goal' column
csv_data = pd.DataFrame({
    'goal': ['goal1', 'goal2', 'goal3']
})
csv_data.to_csv(csv_path, index=False)

ARGS = {
    'path': csv_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
evaluate Not yet run
unverified (harvested, no recorded run)
xirui-li/drattack/experiments/evaluate_with_GPT.py
code served (permissive licence) · get_code("f5f35c29b3798704")
How it ran

no invocation recorded.

get_chatgpt_response Not yet run
unverified (harvested, no recorded run)
xirui-li/drattack/experiments/evaluate_with_GPT.py
code served (permissive licence) · get_code("ecaedd84a2db26ff")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
xirui-li/drattack/attack_prompt_data/uncensored_vicuna/uncensor.py
code served (permissive licence) · get_code("25f2fc9122340697")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 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.

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

The safety alignment of Large Language Models (LLMs) is vulnerable to both manual and automated jailbreak attacks, which adversarially trigger LLMs to output harmful content. However, current methods for jailbreaking LLMs, which nest entire harmful prompts, are not effective at concealing malicious intent and can be easily identified and rejected by well-aligned LLMs. This paper discovers that decomposing a malicious prompt into separated sub-prompts can effectively obscure its underlying malicious intent by presenting it in a fragmented, less detectable form, thereby addressing these limitations. We introduce an automatic prompt \textbf{D}ecomposition and \textbf{R}econstruction framework for jailbreak \textbf{Attack} (DrAttack). DrAttack includes three key components: (a) `Decomposition' of the original prompt into sub-prompts, (b) `Reconstruction' of these sub-prompts implicitly by in-context learning with semantically similar but harmless reassembling demo, and (c) a `Synonym Search' of sub-prompts, aiming to find sub-prompts' synonyms that maintain the original intent while jailbreaking LLMs. An extensive empirical study across multiple open-source and closed-source LLMs demonstrates that, with a significantly reduced number of queries, DrAttack obtains a substantial gain of success rate over prior SOTA prompt-only attackers. Notably, the success rate of 78.0\% on GPT-4 with merely 15 queries surpassed previous art by 33.1\%. The project is available at https://github.com/xirui-li/DrAttack.

For agents

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

get_harvested_code_for_paper("2402.16914")
get_code_for_paper("2402.16914")
have("2402.16914")

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

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

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

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

Connect an agent — have() is free.