Skip to content

Enhancing jailbreak attacks and defenses from a causal perspectiveA Causal Perspective for Enhancing Jailbreak Attack and Defense

arXiv· arXiv:2602.04893· NDSS 2026· Licheng Pan, Yunsheng Lu, Jiexi Liu, Jialing Tao, Haozhe Feng, Hui Xue, Zhixuan Chu, Kui Ren·Indexed by this site · 2026-10-12· Originally publishedTools

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

Causal Analyst rewrites prompts according to causal features; in Table IX, Qwen's ASR rises from 23.66% to 28.01%.

Threat modelThe attacker uses black-box, template-based prompts to induce the LLM to output content that violates safety policies; only AH counts as success, while AR, AW, and AN count as failures. No access to weights. Templates are divided into encryption, hijacking, and setting. Harmful queries that can be directly rejected with high probability are excluded.

Questions
The causal relationship between template jailbreaks and readable prompt features is unclear. The authors believe hidden representation analysis is difficult to interpret and not convenient for directly rewriting attacks or extracting real intent.
Methods
Causal Analyst encodes prompts with Qwen2.5-7B, aligns them with 37 readable features and response categories, then uses DAG-GNN to learn the causal graph. The Enhancer strengthens features marked as direct causes; the Advisor removes packaging according to the graph and extracts intent.
Experiments and results
In Table IX, Qwen in the Ours column ASR increased from 23.66% to 28.01%, Baichuan2's RI on TwinBreak is +143.36%. Advisor's ROUGE-Avg is 21.67, Vanilla Extractor 16.23.
Limitations and future work
Authors state analysis is limited to template-based attacks, loss weights are manually tuned, and plan to examine new architectures and multimodal. ASR tables omit GPT-4o and Qwen-7B/72B; the paper does not report number of public benchmark entries or repetitions.
Experimental setupQwen (7B/14B/72B)、Baichuan2 (13B) et al. · Jailbreaking Attempts Dataset、StrongREJECT et al. · ASR、RI et al.
Evaluated models
Qwen (7B/14B/72B)Baichuan2 (13B)LLaMA3 (8B)GLM4 (9B)GPT-4oQwen2.5-7B
Benchmarks
Jailbreaking Attempts DatasetStrongREJECTTwinBreak
Metrics
ASRRIAPF1AUCBLEU-4ROUGE-AvgSHD
AI summaryThe researchers propose the Causal Analyst framework, which connects LLMs to data-driven causal discovery to identify the direct causes of jailbreaks and use them for both attack and defense. The team built a dataset of 35,000 jailbreak attempts covering 7 LLMs, generated from 100 attack templates and 50 harmful queries, annotated with 37 human-readable prompt features, and reconstructed causal paths through joint training of LLM prompt encoding and GNN causal graph learning. The analysis found that features such as Positive Character and Number of Task Steps are direct causal drivers of jailbreaks. The two applications based on this are Jailbreaking Enhancer, which improves attack success rates by targeting causal features, and Guardrail Advisor, which extracts real malicious intent from obfuscated queries using the causal graph. Code is available at https://github.com/Master-PLC/Causal-Analyst。

The researchers propose the Causal Analyst framework, which connects LLMs to data-driven causal discovery to identify the direct causes of jailbreaks and use them for both attack and defense. The team built a dataset of 35,000 jailbreak attempts covering 7 LLMs, generated from 100 attack templates and 50 harmful queries, annotated with 37 human-readable prompt features, and reconstructed causal paths through joint training of LLM prompt encoding and GNN causal graph learning. The analysis found that features such as Positive Character and Number of Task Steps are direct causal drivers of jailbreaks. The two applications based on this are Jailbreaking Enhancer, which improves attack success rates by targeting causal features, and Guardrail Advisor, which extracts real malicious intent from obfuscated queries using the causal graph. Code is available at https://github.com/Master-PLC/Causal-Analyst。

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors want to find the direct causes by which readable prompt features lead to jailbreaks, and use them to enhance attacks and extract intent.

    The causal relationship between readable prompt features and whether a jailbreak occurs is unclear.

    • Scenario: Authors state LLMs can be induced to produce malicious outputs by carefully constructed prompts; misinformation may mislead users or spread false information, privacy leakage may expose personal data. Internal measures include SSFT and RLHF, external measures include external algorithms, auxiliary judge models, and prompt filtering. Authors state defenses and jailbreaks continuously bypass each other.
    • Gap: Authors state existing work uses graph clustering, manual classification, or hidden representation probing to analyze jailbreak features, relying on hard-to-interpret high-dimensional hidden spaces; the causal impact of readable features on jailbreak success and their contribution remains unexamined.
    • Hypothesis: Authors believe LLMs can directly learn causal structures from raw text observations, not just provide priors or post-hoc corrections to traditional causal discovery.
    • Approach: Propose Causal Analyst, jointly learning LLM encoding and GNN causal graph on 35,000 attempts, and provide Jailbreaking Enhancer and Guardrail Advisor. Authors state this is, to their knowledge, the first causal-perspective analysis of this problem.
    • Threat model:
      • Goal: Induce LLM to produce outputs violating safety guidelines. Success defined as Answer Harmfulness (AH), i.e., content violating safety policy, distinct from merely bypassing refusal. ASR counts only AH as success, AR, AW, AN as failure; this sentence does not include AG in failures.
      • Knowledge: Paper distinguishes white-box and black-box. This work focuses on template-based black-box, not using weights, gradients, or logits.
      • Capability: Compiled 100 templates, divided into encryption, hijacking, setting, combined with 50 harmful queries. Authors exclude harmful queries that LLMs can directly refuse with high probability.
      • Victim system: Seven LLMs in Table II. ASR tables for enhancement experiments do not cover all seven.
  2. What related research exists?

    Related work is divided into defenses, white-box/black-box attacks, and causal discovery; the authors say this paper puts LLM encoding into the discovery loop.

    Jailbreak Defense

    • Internal alignment: SSFT by Ouyang et al. (2022), RLHF by Bai et al. (2022), and inference-time interventions based on logit analysis or gradient monitoring. The paper categorizes these as self-constraints during training or inference.
    • External safeguards: The authors state that industrial deployment often uses pattern matching and keyword filtering due to modularity, treating the model as a black box; academic work includes perplexity filtering, auxiliary judge models, and randomly perturbing inputs to check semantic consistency.
    • Attack-defense relationship: The authors state that defenses are still evolving, so analysis of the causal mechanisms that make jailbreaks possible is needed. The paper does not numerically compare any external defense with Guardrail Advisor.

    Jailbreak Attacks

    • White-box: Using gradients, activation patterns to optimize adversarial tokens, or adversarial fine-tuning on malicious data. The authors state that these methods are often infeasible on proprietary models where weights or training pipelines are unavailable.
    • Black-box: Training auxiliary models to generate attacks, rewriting based on query feedback, or using templates to wrap harmful queries in scenarios like role-playing or encryption. The authors state that template attacks are common in community-sourced jailbreaks due to their interpretability and effectiveness, and are the main target of this paper's feature analysis.

    Causal Discovery

    • Traditional methods: Constraint-based conditional independence tests, score-based structure search, and methods that reformulate combinatorial search as continuous optimization (including NOTEARS).
    • LLM-assisted causal discovery: Khatibi et al. (2024) and Kiciman et al. (2023) use LLMs as expert systems to inject priors or correct post-hoc results. The authors state that LLMs directly learning causal structure from prompt observations remains unused.

    Baselines and Benchmarks

    • Baseline methods: Causal graph comparison with PC and DirectLiNGAM; intent extraction compared with Vanilla Extractor without causal graphs; attack length control with LenCtrl† and LenCtrl.
    • Benchmarks/datasets: Self-built 35,000 jailbreak attempts, and public benchmarks StrongREJECT, TwinBreak.

    The authors position this paper as: putting LLM encoding into the causal discovery loop, using readable features to find direct causes of jailbreaks, and using them both to increase attack success rate and extract malicious intent. The authors state this is an analysis from a causal perspective in this context, and to their knowledge, the first such framework.

  3. How does the paper address this problem?

    Causal Analyst uses Qwen2.5-7B encoding with DAG-GNN to learn a causal graph, then rewrites prompts or extracts intents.

    Causal Analyst feeds encoded prompts into data-driven causal discovery, then uses the causal graph for the Jailbreaking Enhancer and Guardrail Advisor. The backbone is Qwen2.5-7B; the authors' stated reasons are reasoning ability, multilingual support, and open source for easy reproduction.

    Data and Readable Features

    • Templates and queries: 100 template-based templates, divided into encryption, hijacking, setting (Table I), from public sources such as AutoDAN. There are also 50 harmful queries that are usually rejected when asked directly. Combining them yields 5,000 prompts, tested on seven LLMs, for a total of 35,000 attempts.
    • Response labels: AH, AW, AR, AG, AN (Table III). AH means containing potentially harmful or inappropriate content. The classification prompt is in Appendix B4, requiring evaluation according to Chinese law and values; the paper does not state which model performs this classification.
    • 37 features: Table IV, divided into encryption, hijacking, setting, and prompt-level. Length, number of languages, etc. are computed by rules; semantic features such as Positive Character and Command Tone are annotated with GPT-4o. Appendix B5 gives the annotation prompts and rules. After manual sampling verification, D={(pi, ai, fi, ci)} is obtained, N=35,000.

    Classifier and Causal Graph

    • Classification head: Qwen2.5-7B plus a linear layer and ReLU, fine-tuned on Dc. Multi-label, taking classes with probability above 0.5 after sigmoid. The predicted distribution c̃i is then fed into graph learning.
    • Alignment: The same backbone has another graph learning head, yielding hidden representation hi. The explicit input is the concatenation of features and predicted classes. Fusion has additive, element-wise multiplicative, and attention-based forms; the experiments mainly use multiplicative.
    • Graph learning: DAG-GNN reconstructs the DAG from aligned representations. Appendix C writes continuous optimization, ELBO, and augmented Lagrangian, with post-processing threshold 0.3, β=10, γ=0.25; input dimension 1, hidden dimension 64.
    • Training objective: Alignment and reconstruction use MSE. The graph learning composite loss is LCL=λa LAlign−(1−λr)LELBO+λr LRec. The joint stage adds the classification loss. λ defaults to 0.5.

    Training Procedure

    1. Freeze the graph learning head, update the backbone and classification head with cross-entropy, learning rate 5e-5.
    2. Freeze the classification head, update the backbone and graph learning head with L_CL.
    3. Jointly update with a smaller learning rate 3e-5 to avoid forgetting.

    Adam with cosine schedule, batch size 8, generation temperature 0.7, 10 alternating cycles with 2 epochs per stage, using LLaMA-Factory. D is divided by class into training 30,000, validation 5,000 (Figure 3). Prior constraints are in Figure 5 and Appendix E1: top-down within attack families, no connections between families, prompt-level features and response types as downstream nodes.

    Inference and Two Applications

    • Causal explanation: Edges are converted to text, top-10 paths are sampled by edge weight, and together with the original prompt and response type are given to GPT-4o to distinguish direct from indirect causes. Appendix D gives the conversion and inference prompts.
    • Enhancer: For direct causes, design feature-weakening filters, obtain weak versions from the original prompts, form Dj, and fine-tune Qwen2.5-7B to learn the mapping from weak to strong. Appendix B6 gives the filtering principles; specific rewriting constraints are not listed here. At inference, strengthen the direct causes marked by the causal graph on non-jailbroken prompts until the Analyzer determines jailbreak is possible or the user stops. LoRA tunes q, k, v, o, 3 epochs, learning rate 5e-5. The paper does not state the iteration cap.
    • Advisor: Da consists of complex prompts and manually extracted clear intents. Fine-tune Qwen2.5-7B (5 epochs) to remove packaging features and reconstruct the core query, for use by subsequent safety mechanisms. The baseline is Vanilla Extractor, fine-tuned on the same data but without using the causal graph.
  4. What experiments did the paper conduct?

    Qwen in the Ours column ASR increased from 23.66% to 28.01%; Advisor's ROUGE-Avg is 21.67.

    Experimental Setup

    • Victim and method models: The dataset queries the seven LLMs in Table II: Qwen 7B/14B/72B, Baichuan2 13B, LLaMA3 8B, GLM4 9B, GPT-4o (about 200B, not open source). The backbones of the Analyzer, Enhancer, and Advisor are all Qwen2.5-7B. Semantic feature annotation and causal explanation use GPT-4o.
    • Data: D is 35,000 entries. Dc and Dg are written as subsets of D, with the scale notation still N, and no separate counts given. Training 30,000, validation 5,000. The enhanced evaluation uses a held-out subset of D, a small version of StrongREJECT, and malicious prompts from TwinBreak. The paper does not state the counts of these three items.
    • Baselines: The causal graphs are PC (fisherz, α=0.05) and DirectLiNGAM (pwling, without soft use of priors). The guardrail is Vanilla Extractor. The length control is LenCtrl† using the model-specific pad token, and LenCtrl of <IGNORE>.
    • Metrics: Classification uses AP, HS, F1, AUC, RL, OE. ASR only counts AH; RI=(ASRAfter−ASRBefore)/ASRBefore. The Advisor uses BLEU and ROUGE, with the table note stating they are multiplied by 100%. Graph structure uses edge count, connectivity ratio, and SHD.
    • Training and hardware: Separate-stage learning rate 5e-5, joint-stage 3e-5. Ubuntu 22.04.4, 500GB memory, eight RTX 4090s; the efficiency profile states a single RTX 4090. The paper does not report the number of repetitions, nor which classifier determines the AH in Table IX.

    Main Results

    According to Table IX, the cells are in order ASR-B / ASR-A / RI. The text says GPT-4o is omitted due to cost, and Qwen-7B/72B are omitted, so these two rows are not listed separately. Table IX's Qwen no longer indicates parameter count.

    Swipe horizontally to read the table

    ModelOursStrongREJECTTwinBreak
    Qwen23.66% / 28.01% / +18.38%6.67% / 12.82% / +92.31%12.00% / 18.69% / +55.77%
    Baichuan235.60% / 38.81% / +9.03%0.00% / 12.82% / —11.00% / 26.77% / +143.36%
    LLaMA314.34% / 15.07% / +5.10%1.67% / 3.59% / +115.38%1.00% / 1.15% / +15.38%
    GLM434.86% / 38.13% / +9.38%10.00% / 17.69% / +76.92%24.00% / 29.92% / +24.68%
    • The authors state that after targeting causal features, the ASR of each LLM increased, with RI ranging from +5.10% to +143.36%. Baichuan2's RI on StrongREJECT is recorded as "—" in the table.
    • The authors state that the Enhancer is trained only on Dj, yet it still transfers to StrongREJECT and TwinBreak; and they state that relative to static templates, it adjusts according to the attributes missing from the query. Example IV-B.2 writes that LLaMA-3 exhibits AH after strengthening Number of Task Steps; the example contains harmful content and is not repeated here.
    • Exceptions: LLaMA3's RI on Ours is +5.10%, and ASR-A on TwinBreak is 1.15%. Baichuan2's pre-enhancement ASR on StrongREJECT is 0.00%. The paper does not explain these lower numbers.

    Causal Graphs and Structural Validation

    • Graph density: In Table VI, this paper has 213 edges, connectivity ratio 12.07%; PC has 174, 9.86%; DirectLiNGAM has 381, 21.60%; allowed edges 628 (35.60%), total possible edges 1764. The authors state PC is too sparse, DirectLiNGAM too dense, and this paper lies between the two; and they state the PC graph is a subgraph of this paper's graph, and this paper's graph is a subgraph of DirectLiNGAM's. The authors state Figure 6(a) has a path: Encryption Type → Encrypted Conversation → Lexical Richness → Number of Background Info → Answer Harmfulness. Edge weights and layout in the figure are not readable in plain text, so positions are not described further.
    • Direct-cause statements are not fully identical: The abstract and conclusion state Positive Character and Number of Task Steps are direct causal factors of AH; Section IV-B2 states the direct drivers of AH include Character Disorder and Positive Character. The columns in Table VII are misaligned in plain text, so no list is supplemented from it.
    • Shuffle test: Table VIII, original data edge count 213, F1 0.8108, LAlign 0.0124, LELBO 0.0138; after 100% shuffling, SHD is 135, edge count 78, F1 0.6611, LAlign 0.6834, LELBO 0.6558. The authors state the structure comes from data associations rather than model artifacts, and state performance after shuffling is close to random guessing.

    Guardrail and Simultaneous Attack-Defense

    • Intent extraction: Table XI, Vanilla Extractor's BLEU-4 is 7.65, ROUGE-1 23.32, ROUGE-2 6.53, ROUGE-L 19.86, ROUGE-Avg 16.23; Advisor is 11.34, 29.36, 9.80, 25.86, 21.67. The authors state the causal graph lets it focus on core semantics and filter out scenario noise. Example IV-B.3 is not repeated from the original. The paper does not report false rejection rate or missed detection rate.
    • Simultaneous attack-defense: The authors state in Figure 7 that without the Advisor, the enhanced attack's ASR is higher than the original attack; on TwinBreak, from 12.00% to 18.69%. The Advisor reduces ASR on its own dataset to 5.00%, and on StrongReject to 0.13%. The paper does not state which model the figure corresponds to. 12.00% and 18.69% are the same as the Qwen TwinBreak row in Table IX.
    • Classification: Table V, separate training AP 0.9070, F1 0.7973, AUC 0.9294, RL 0.0707, OE 0.1602; cross-training AP 0.9115, HS 0.9180, F1 0.8108, AUC 0.9328, RL 0.0674, OE 0.1525. The authors state cross-training is better under the same computational budget. The authors state Figure 4's diagonal is 0.64–0.90, AR-AW is 0.73, AG-AW is 0.81; these numbers match the corresponding cells in Figure 4(b).

    Other Ablations and Analyses

    • Table X: Qwen2.5 column, Original ASR 23.66% (about 137 tokens), LenCtrl† 23.81% (+0.65%), LenCtrl 24.68% (+4.31%), Ours 28.01% (+18.38%, about 146 tokens). LLaMA-3 column in order: 14.34%, 13.98% (−2.49%), 13.87% (−3.30%), 15.07% (+5.10%). The authors state the gain comes from the strengthened causal features, not from lengthening the context. These column numbers are the same as the Qwen and LLaMA3 rows in Table IX; the paper does not state whether they are the same target model.
    • Table XII fusion: additive AP 0.851, LAlign 0.695; multiplicative AP 0.881, LAlign 0.190, LELBO 0.032, LRec 0.002; attention AP 0.891, but LELBO 4.243. The authors use multiplicative by default.
    • λa, λr, λc default to 0.5. The authors state λa>0.5 loses hidden semantics, and λc>0.5 increases the graph learning loss. Figure 8's text does not give exact readings for each point.
    • Figure 9: backbone sizes 0.5B, 1.5B, 3B, 7B. The authors state that as size decreases, classification metrics decline, and LAlign and LELBO increase. The text has no exact numbers for each size; full model names for the smaller sizes are not given.
    • Table XIII: three-stage trainable parameters 5.06M, 5.20M, 5.22M; time 44.65, 44.74, 44.95 minutes; peak memory 18.73, 18.77, 18.77GB. The authors state the additional latency of online inference relative to the original backbone is negligible; the paper does not give the time cost.
    • Inference example IV-B.1 uses GPT-4o to compare explanations with and without the graph, containing harmful outputs, and is not repeated here. The authors state that with the graph, one can trace from specific features to AH.
  5. What are some points that can be further explored?

    The authors state that the analysis is limited to template attacks, with manually set weights, and they plan to study transfer to new architectures and multimodal inputs.

    Limitations and future directions noted by the authors

    • Attack types: The current analysis focuses on template-based attacks; the authors justify this by the structural interpretability of such templates. Extending the causal perspective to gradient-based or optimization-based attacks is stated as a next step. (Conclusion, Limitations & Future Work)
    • Hyperparameters: The loss weights are manually tuned. The authors state that automatic hyperparameter optimization could simplify training. (Same as above)
    • Transfer: The authors plan to study the transferability of causal jailbreak patterns to new model architectures and multimodal inputs, aiming for more general defenses. (Same as above)

    Experimental coverage

    • Dataset construction queried the seven LLMs in Table II; Table IX reports ASR for Qwen, Baichuan2, LLaMA3, and GLM4, with the text stating that GPT-4o and Qwen-7B/72B are omitted.
    • Causal graph comparisons are against PC and DirectLiNGAM; length control comparisons are against LenCtrl† and LenCtrl; intent extraction comparisons are against Vanilla Extractor. Fusion methods tested include additive, multiplicative, and attention-based.
    • Public benchmarks are the small version of StrongREJECT and the malicious prompts from TwinBreak. The paper does not report the number of items for these two benchmarks or the held-out subset, nor the number of repetitions, the cap on augmentation iterations, or the number of queries.
    • The response classification prompt is in Appendix B4; the paper does not specify the model used for classification, nor the AH judge for Table IX. The Advisor reports BLEU/ROUGE and ASR in Figure 7; the paper does not report false rejection rates or missed detection rates.
    • Backbone scale experiments cover 0.5B to 7B (Figure 9). Training efficiency numbers come from profiling on a single RTX 4090 (Table XIII).
  6. Summarize the main content of the paper

    Use causal graphs to locate readable features of jailbreaks, then enhance template attacks based on them and extract real intent.

    Causal Analyst uses readable prompt features for causal discovery of jailbreaks and uses the graph for attack rewriting and intent extraction. The authors address: hidden representation analysis cannot reveal which human-readable features directly cause jailbreaks.

    • Data: 100 templates, 50 harmful queries, seven LLMs, totaling 35,000 attempts, annotated with 37 features. Templates are divided into encryption, hijacking, setting. Success counts only AH.
    • Method: Qwen2.5-7B performs multi-label classification and graph learning encoding, aligned with features and prediction classes, then uses DAG-GNN to learn a DAG. Cross-trained classification, alignment, and reconstruction loss weights default to 0.5. GPT-4o writes explanations for the top-10 paths. Enhancer strengthens direct cause features; Advisor removes packaging and reconstructs intent according to the graph.
    • Attack results: In Table IX, Qwen in the Ours column ASR from 23.66% to 28.01% (RI +18.38%). Baichuan2 on TwinBreak from 11.00% to 26.77%, RI +143.36%. LLaMA3 on Ours RI +5.10%. Baichuan2 on StrongREJECT before enhancement 0.00%, RI recorded as "—". Length control at similar token counts: LLaMA-3's pad control ASR decreases, while this method's increases (Table X).
    • Structure and defense: Causal graph 213 edges, connectivity ratio 12.07% (Table VI). After shuffling, edges 78, F1 from 0.8108 to 0.6611 (Table VIII). Advisor's ROUGE-Avg is 21.67, Vanilla Extractor 16.23 (Table XI). Authors state without Advisor on TwinBreak ASR from 12.00% to 18.69%; with Advisor on own dataset 5.00%, StrongReject 0.13%, model not specified in the figure.
    • Authors' conclusions: Authors state Positive Character, Number of Task Steps, etc., are direct factors for AH, causal perspective can improve ASR, can extract malicious intent from confusing queries, and claim superiority over non-causal approaches. Authors also note analysis limited to template attacks, and plan to examine gradient or optimization-based attacks, as well as transfer to new architectures and multimodal.

Related papers

Show 3 more papers
Read originalNDSS 2026