Layered LLM Defenses as an Ensemble: Access Tiers, Inference Cost, and the Measured Failure Correlation Between Defense Layers
Organizations: Information and Computer Science Department, King Fahd University of Petroleum and Minerals, Dhahran, Saudi Arabia · Department of Computer Science, College of Computer Science and Information Technology, Imam Abdulrahman Bin Faisal University, Dammam, Saudi Arabia · SDAIA-KFUPM Joint Research Center for Artificial Intelligence, King Fahd University of Petroleum and Minerals, Dhahran, Saudi Arabia
Abstract
Practitioners defend large language models (LLMs) by stacking defenses, assuming the layers compound. A stack is an ensemble, and ensembles compound only under a condition the LLM security literature recommends but never measures: the members must fail on different inputs. Two instruments make that measurable. The Adversary Access-Tier Model (AATM) grades an adversary by the access it holds, from system-only (A0) to influence over training data (A4). A cost model sorts defenses into five classes of inference-time overhead; because two classes require training weights or reading activations, they tier the defender as AATM tiers the adversary. From these we derive how a stack behaves, and the quantities a defender cares about diverge: coverage saturates within a tier, cost rises by class, false refusals accumulate as a union, and residual attack success falls multiplicatively only under independence. We measure that independence. Running one adaptive adversary against a seven-layer stack, failure correlation is positive in all fifteen measurable pairs ( from to ), and the joint residual exceeds the multiplicative prediction by up to . Stratifying on behavior difficulty dissolves most of the association, so the dependence is predominantly common-cause, but it survives permutation inference, majority-vote grader labels, and externally calibrated thresholds. The same stack refuses four in five benign prompts while remaining statistically indistinguishable from its strongest single layer. The dependence is architectural rather than sampling-based: members correlate through the model they all wrap, so no wider member pool weakens it. Diversity therefore selects stack members but does not predict what an assembled stack delivers, which has to be measured end to end.
Figures & tables
| Tier | Name | What the adversary holds | Representative attacks |
| Outside the model | |||
| A0 | No model access | The surrounding system only: dependencies, retrieved content, the deployment pipeline | Indirect prompt injection [ 43 ] , retrieval poisoning, RCE in LLM frameworks |
| Through the model, cumulative | |||
| A1 | Black-box query | Inputs and outputs through a public interface | Direct jailbreaks, direct prompt injection, transfer attacks |
| A2 | Gray-box | logits or token probabilities | Logprob-guided adaptive jailbreaks, some extraction |
| A3 | White-box | weights, and the ability to compute gradients | Gradient suffix attacks [ 149 ] , safety-region pruning, fine-tuning attacks |
| Defense layer | Tier assumed | Attacks addressed | Adaptive-tested | Overhead class | Cost profile |
| L1: Input/output censorship | A1 | Direct jailbreaks, direct injection, harmful output | Rarely; constitutional classifiers are the exception | B; C (smoothing); A (guard prompts); E (probe screening) | Per-query passes; false positives |
| L2: Model training & fine-tuning | Design-time | Alignment failures, some A1 jailbreaks, prompt injection (trained) | Rarely | D | High one-time train; low per-query |
| L3: Adversarial training | Design-time | Optimized suffix attacks within budget | Partially | D; A (tuned prefixes) | High train; possible utility loss |
| L4: Monitoring & response | A0–A1 | Anomalies, some injection, operational faults | n/a | B (often async); E (representation monitors) | Infrastructure; detection variance |
| L5: Infrastructure hardening | A0, A2–A3 | Extraction, inversion, RCE; A0 injection (by isolation) | n/a | n/a (system-level) | Deployment complexity; low compute |
| Dependency | Representative defenses | Fails when |
| Token surface | Perplexity filtering, blacklists, retokenization, Adversarial Prompt Shield | Attack is fluent or paraphrased |
| Semantic classification | ShieldLM, Llama Guard, WildGuard, ShieldGemma, constitutional classifiers | Harm is context-dependent or outside the classifier’s policy |
| First-token distribution | SafeDecoding, standard safety fine-tuning | Adversary controls or bypasses the opening tokens [ 94 ] |
| Internal representations | Circuit breakers, latent adversarial training, probe monitors | Harmful computation is not separable in the monitored subspace |
| Input provenance | Spotlighting, StruQ, SecAlign, instruction hierarchy | Trust boundary is mislabeled, or the model overrides learned precedence [ 28 ] |
| Perturbation stability | SmoothLLM, erase-and-check | Attack is robust to character-level perturbation, or exceeds the certified size |
| Defense layer | Primary Strengths | Key Limitations | Best Suited For |
| L1: Input/output censorship | Immediate protection; easy deployment; model-agnostic | False positives; latency overhead; bypass via obfuscation | User-facing apps; content moderation |
| L2: Model training & fine-tuning | Embedded security; improved robustness | High computational cost; requires retraining; potential utility loss | Safety-critical systems; long-term deployments |
| L3: Adversarial training | Strong attack resistance; adaptive learning | Computationally expensive; may not generalize to novel attacks | Research environments; high-security apps |
| L4: Monitoring & response | Real-time detection; adaptive responses | Detection accuracy varies; infrastructure complexity | Production environments; enterprise deployments |
| L5: Infrastructure hardening | System-level protection; prevents extraction attacks | Implementation complexity; hardware dependencies | Edge deployments; proprietary model protection |
| Metric | Definition | Range (direction) |
| Attack Success Rate (ASR) | Fraction of adversarial inputs that elicit the targeted unsafe behavior | 0–1 (lower better) |
| Defense Success Rate (DSR) | Fraction of adversarial inputs the defense correctly blocks or neutralizes | 0–1 (higher better) |
| False Positive Rate (FPR) | Fraction of benign inputs incorrectly flagged or refused | 0–1 (lower better) |
| AUPRC | Area under the precision–recall curve for safety classification | 0–1 (higher better) |
| F1 | Harmonic mean of precision and recall for harmful-content detection | 0–1 (higher better) |
| Utility preservation | Retained task performance under the defense | higher better |
| Benchmark | Ref | Year | Focus | Composition and notes |
| AdvBench | [ 149 ] | 2023 | Harmful-behavior elicitation; suffix attacks | 520 harmful behaviors and strings; the standard target set for GCG-style attacks and many defense evaluations |
| HarmBench | [ 79 ] | 2024 | Standardized automated red teaming and robust refusal | Common set of harmful behaviors scored by a shared classifier; compares many attacks and defenses head-to-head |
| SafetyBench | [ 138 ] | 2023 | Multiple-choice safety knowledge | Thousands of questions across seven safety categories, in English and Chinese |
| OR-Bench | [ 23 ] | 2025 | Over-refusal measurement | Around 80,000 prompts that appear toxic but are safe to answer, with a hard subset |
| JailbreakBench | [ 19 ] | 2024 | Open jailbreak robustness with a leaderboard | 100 behaviors; standardized artifacts and evaluation for both attacks and defenses |
| StrongREJECT | [ 105 ] | 2024 | Rigorous jailbreak scoring | Rubric-based autograder that checks whether a jailbreak yields genuinely useful harmful content |
| fluent (AutoDAN-style) | GCG | |
| generations / steps | 30 generations | 60 steps |
| population | 24 | – |
| elite fraction | 0.25 | – |
| mutation rate | 0.15 | – |
| suffix length | – | 20 tokens |
| top- | – | 128 |
| Defense | Dependency row | Threshold | Benign block rate |
| perplexity (window 16) | token surface | 4.849077 | 0.010 |
| token-anomaly | token surface | 0.272857 | 0.010 |
| probe 16 | internal repr. | 28.924215 | 0.010 |
| probe 8 | internal repr. | 110.767708 | 0.010 |
| Llama Guard 3 8B | semantic | categorical | – |
| refusal-prime (prefix) | first-token | n/a | – |
| Prompt style | mean windowed NLL | admitted by the perplexity filter |
| Plain behavior | 3.18 | |
| AutoDAN (fluent) | 4.47 | |
| Compliance template | 5.15 | |
| GCG suffix | 13.56 |
| Defense pair | Rows | (95% CI) | |||||
| Same row (H1) | |||||||
| probe 16 probe 8 | internal repr. | 0.68 | 0.60 | 0.172 | [0.62, 0.88] | 0.89 | |
| perplexity token-anomaly | token surface | 0.66 | 0.35 | 0.079 | [0.18, 0.50] | 0.66 | |
| Cross row (H2) | |||||||
| perplexity probe 8 | surface internal | 0.66 | 0.60 | 0.144 | 0.62 [0.45, 0.77] | 0.71 | |
| perplexity probe 16 | surface internal | 0.66 | 0.68 | 0.131 | 0.59 [0.42, 0.76] | 0.62 | |
| Defense | adaptive (fluent) | static: transfer suffix | static: plain prompt |
| perplexity | 0.66 | 0.00 | 0.07 |
| probe 16 | 0.68 | 0.28 | 0.08 |
| refusal-prime | 0.60 | 0.11 | 0.03 |
| SmoothLLM | 0.54 | 0.04 | 0.06 |
| token-anomaly | 0.35 | 0.28 | 0.07 |
| Pair | Rows | crude OR | CMH OR | |||
| probe 16 probe 8 | same | 0.75 | 68.0 | |||
| perplexity token-anomaly | same | 0.35 | 6.0 | 1.39 | 0.907 | 0.943 |
| refusal-prime SmoothLLM | cross | 0.56 | 12.3 | 4.34 | 0.023 | 0.173 |
| perplexity refusal-prime | cross | 0.58 | 14.5 | 3.95 | 0.063 | 0.314 |
| perplexity probe 8 | cross | 0.62 | 19.1 | 3.07 | 0.209 | 0.562 |
| probe 16 refusal-prime | cross | 0.45 | 7.3 | 0.72 | 0.943 | 0.943 |
| Defense pair | dis. | |||||
| perplexity probe 16 | 0.891 | 0.18 | 0.580 | 0.449 | 0.59 | 0.62 |
| probe 16 probe 8 | 0.977 | 0.12 | 0.580 | 0.408 | 0.75 | 0.89 |
| perplexity probe 8 | 0.909 | 0.18 | 0.540 | 0.396 | 0.62 | 0.71 |
| perplexity refusal-prime | 0.880 | 0.20 | 0.530 | 0.396 | 0.58 | 0.66 |
| probe 16 refusal-prime | 0.769 | 0.26 | 0.510 | 0.408 | 0.45 | 0.54 |
| perplexity SmoothLLM | 0.887 | 0.22 | 0.490 | 0.356 | 0.57 | 0.73 |
| Rule | residual ASR | benign FRR |
| Combined from independently measured decisions | ||
| of 7 (veto) | 0.010 | 0.520 |
| of 7 | 0.190 | 0.300 |
| of 7 | 0.430 | 0.110 |
| of 7 | 0.590 | 0.080 |
| of 7 | 0.680 | 0.080 |
| Defense Category | Primary Threat | Secondary Threat | Key Target Areas |
| Input/Output Censorship | User-centric | Model-centric | Input validation; response filtering; content moderation |
| Model Training | Model-centric | Data-centric | Architecture security; safety training; fine-tuning optimization |
| Adversarial Training | Model-centric | Infrastructure | Defense generation; attack resistance; model hardening |
| Monitoring Systems | Infrastructure | User-centric | Threat detection; incident response; system monitoring |
| Infrastructure Hardening | Infrastructure | Data-centric | System security; deployment protection; access control |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Acronym | Expansion | Acronym | Expansion |
| AATM | Adversary Access-Tier Model | GCG | Greedy Coordinate Gradient |
| ASR | Attack Success Rate | JBB | JailbreakBench |
| AUPRC | Area Under the Precision–Recall Curve | LAT | Latent Adversarial Training |
| AUROC | Area Under the ROC Curve | LLM | Large Language Model |
| CMH | Cochran–Mantel–Haenszel | OR | Odds Ratio |
| DPO | Direct Preference Optimization | PII | Personally Identifiable Information |
| Term | Definition |
| Backdoor attack | Attack inserting triggers during training that cause malicious outputs when activated. |
| Blue teaming | Defensive security practices protecting systems from attacks. |
| Data poisoning | Attack manipulating training data to compromise model behavior. |
| Diversity | In classifier fusion, the extent to which combined components fail on different inputs; failure correlation is one of its standard pairwise measures. |
| Failure correlation ( ) | Correlation between the breach indicators of two defenses on a common behavior set under a common adversary; the of Eq. ( 6 ). |
| Guardrails | Safety mechanisms constraining LLM behavior through filtering or validation. |
LLM Security
Large language model (LLM) security studies attacks, privacy risks, and defenses across model training, inference, and deployment.
See all 327 papers