Manuscript Offprint

arXiv:2609.03693

AlcaTRAz - Anchored Tree-Rule Defense Against Jailbreaks

Jakub Reš, Petr Kaška, Martin Perešíni, Martin Ukrop, Kamil Malinka

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Jakub Reš¹, Petr Kaška¹, Martin Perešíni¹, Martin Ukrop², and Kamil Malinka¹

¹ Brno University of Technology, Faculty of Information Technology, Czechia {iresj, iperesini, malinka}@fit.vut.cz; xkaska01@vutbr.cz

² Red Hat, Czechia, mukrop@redhat.com

Abstract. Large language models (LLMs) are vulnerable to jailbreak attacks that bypass safety alignment through carefully crafted prompts. Many existing defenses require access to model weights or internals, making them difficult to apply to black-box deployments. We propose AlcaTRAz (Anchored Tree-Rule defense Against jailbreaks), a prompt-level defense based on rule trees that operates exclusively on the input text and requires no modification or retraining of the target model. The method automatically learns a transferable transformation rule that inserts controlled character-level perturbations at selected positions, thereby disrupting structural regularities exploited by jailbreak attacks while largely preserving the model's utility on benign queries. We evaluate the proposed method across 33 open-weight models, 22 jailbreak attack types, and a benchmark of short, single-turn benign questions, comparing against three representative prompt-level baselines (Llama Guard, RA-LLM, Goal Prioritization). Among the compared defenses, AlcaTRAz achieves the best composite security and functionality score in 73.4% of model-attack combinations and shifts the aggregate score from a modal value of 10 (maximal-severity response to the malicious request) in the undefended setting to a modal value of 2 (near-refusal) after defense, while keeping the mean benign score within 0.27 points of the undefended baseline (8.35 vs. 8.62 on a 0–10 scale). AlcaTRAz substantially reduces but does not eliminate jailbreak success: a high-severity tail remains, and we do not consider adaptive attackers, so we position it as one layer within a defense-in-depth strategy rather than a standalone guarantee.

Keywords: Jailbreak attacks · Large language models · AI safety · Prompt-level defense · Genetic programming

1 Introduction

Large language models (LLMs) have become one of the most prominent directions in artificial intelligence. Their ability to understand natural language and generate coherent responses has led to widespread deployment across programming, education, and assistive systems. However, as practical use expands, so does the importance of AI safety. Models deployed in real-world settings must not only be helpful but must also reliably refuse harmful, dangerous, or otherwise disallowed requests [35]. The learned safety mechanisms (safeguards) of modern language models can often be circumvented through carefully crafted prompts, commonly referred to as jailbreak attacks. These attacks manipulate the input so that the model ignores or overrides its intended safeguards, producing content it would normally refuse [35,47].

This has motivated extensive research into both jailbreak attacks and corresponding defenses. Existing attacks vary in the level of access they assume, ranging from black-box attacks that operate only through the model's inference API to white-box attacks that exploit gradients or internal representations [40]. In parallel, a broad spectrum of defensive approaches has been proposed, including input filtering, security classifiers, prompt rewriting, system-prompt safeguards, and model-level alignment [40,10,43]. Despite this progress, many defenses depend on access to model internals, making them inapplicable to models available only through inference APIs and costly to adapt when new models are released. A defense that operates at the prompt level, without any knowledge of or control over the target model, would be more broadly deployable.

One of the main open problems concerns evaluation. Jailbreak success is often measured as a binary outcome, yet model outputs lie on a continuum ranging from complete refusal, through partial assistance, to fully explicit compliance with malicious intent [20,16]. Binary evaluation fails to capture the gradual nature of alignment breakdown. Moreover, many existing studies rely on proprietary evaluator models whose behavior is difficult to analyze, reproduce, or scale in open experimental settings [19,8].

Our approach. This work introduces AlcaTRAz, a prompt-level jailbreak defense organized as a rule tree of elementary character-level transformations, learned automatically by genetic programming (GP). The defense acts as a preprocessing layer that transforms the user prompt before it reaches the target model, thereby disrupting the surface-form regularities that many jailbreak attacks rely on while largely preserving the semantics of legitimate queries. Because the method operates only on input text, it uses no model internals and is deployable in black-box settings [40,2]. We pair the defense with a judge-based evaluation protocol on a continuous 0–10 scale, implemented using an open-weight judge model validated against five human annotators [27,9]. The protocol captures partial compliance more faithfully than binary scoring and is fully reproducible with publicly available models.

Contributions. The main contributions of this work are as follows.

  1. We propose AlcaTRAz, a prompt-level jailbreak defense that learns a tree of anchored character-level transformation rules via genetic programming. Disrupting jailbreaks through input perturbation is an established principle [11,29,12]; our contribution is a method for learning where and how to perturb, requiring no access to model parameters, gradients, or internals and transferring across the 33 evaluated open-weight target models without per-model retraining.

  2. We conduct a large-scale evaluation across 33 open-weight models, 22 attack types, and two malicious-prompt benchmarks, comparing against three representative prompt-level defenses under a joint security and functionality criterion while measuring benign-query functionality explicitly.

References (45)