Skip to content

White-box attacks

Gradient, embedding-space, and activation-steering jailbreaks that optimize against a local open-weight surrogate, then transfer to your target.

White-box (also called open-box) attacks use access the other attacks do not: the model’s gradients, logits, hidden states, or attention. The jailbreak is optimized against a local open-weight surrogate you load, then the result is evaluated against your real target. This is the standard optimize-on-surrogate, transfer-to-target workflow, and it finds adversarial suffixes that purely black-box (closed-box) search cannot.

White-box attacks need a local model with gradient access, so install the extra and pass a Hugging Face id or path as attacker_model (the surrogate):

Terminal window
uv add "dreadnode[whitebox]" # torch + transformers (uv)
pip install "dreadnode[whitebox]" # torch + transformers (pip)
from dreadnode.airt import gcg_attack
attack = gcg_attack(
goal="...",
target=target, # closed-box: dn/* or your API (transfer target)
attacker_model="meta-llama/Llama-2-7b-chat-hf", # open-box surrogate (local, gradients)
evaluator_model="dn/claude-opus-4-8",
n_iterations=50,
)

A hosted dn/* id passed as the surrogate is rejected with a clear message - it cannot provide gradients. A GPU is recommended (7B-scale surrogates need ~80 GB); small models run on CPU for experimentation.

Optimize a discrete adversarial suffix by greedy coordinate gradient, then transfer the goal + suffix string to the target.

AttackIdeaReference
gcg_attackGreedy Coordinate Gradient suffix searchZou et al. 2023
faster_gcg_attackDeterministic greedy + distance regularizer + visited dedupLi et al. 2024
i_gcg_attackMulti-coordinate update + easy-to-hard target scheduleJia et al. ICLR 2025
attngcg_attackAdds an attention-hijack auxiliary lossWang et al. 2024
mask_gcg_attackPrunes low-impact suffix positionsMu et al. 2025
arca_attackCoordinate ascent, one rotating position per stepJones et al. ICML 2023

Optimize in the continuous embedding/logit space, then discretize to a transferable suffix.

AttackIdeaReference
gbda_attackGumbel-softmax distributional optimizationGuo et al. 2021
pez_attackGradient descent + nearest-token projectionWen et al. NeurIPS 2023
cold_attackLangevin dynamics in logit space (fluent suffixes)Guo et al. ICML 2024
soft_gcg_attackAnnealed continuous relaxation of GCGImprovingGCG

Optimize the suffix from the surrogate’s token logits only (no backward pass), then transfer the goal + suffix string to the target.

AttackIdeaReference
adaptive_random_search_attackRandom token swaps kept by target loss, with random restartsAndriushchenko et al. ICLR 2025
AttackIdeaReference
amplegcg_attackSample suffixes from a trained generator modelLiao & Sun 2024

These edit or steer the model’s internals and have no transferable text artifact, so they attack - and are judged on - the local open-weight model itself (no transfer target).

AttackIdeaReference
refusal_ablation_attackErase the refusal direction from the residual streamArditi et al. NeurIPS 2024
soft_prompt_attackPGD on a continuous suffix embedding, generate via inputs_embedsSchwinn et al. NeurIPS 2024
latentbreak_attackWord substitution pulling the prompt latent toward harmless promptsLatentBreak 2025

Every step emits a whitebox_step span with dreadnode.airt.whitebox.* attributes (loss, gradient norm, accepted swap, perplexity where relevant) plus access_level, surrogate_model, and optimizer. Transfer trials and findings land exactly as for any other attack, so the Traces and Findings views work unchanged.