Geneshift: Impact of different scenario shift on Jailbreaking LLM

Tianyi Wu, Zhiwei Xue, Yue Liu, Jiaheng Zhang, Bryan Hooi, See-Kiong Ng · 2025

Read Geneshift: Impact of different scenario shift on Jailbreaking LLM by Tianyi Wu, Zhiwei Xue, Yue Liu, Jiaheng Zhang, Bryan Hooi, See-Kiong Ng (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-08104.txt.

Introduction

Tianyi Wu and co-authors published this study in 2025. It presents GeneShift, a method for jailbreaking large language models, as AI safety research. Jailbreaks try to make a model answer requests it should refuse. The authors note that many past attacks pass keyword checks yet fail to draw out real content. Their method uses a genetic algorithm to evolve the story setting around a request. Different harmful queries, they found, work best under different settings, so the search mixes and selects among them.

Across tests, the evolved settings raised success markedly. In cases where plain prompting scored zero, the method reached sixty percent by one grading scheme. The paper's stated aim is to expose weak spots so defenses can improve. It also flags a grading gap: loose dictionary checks overrate attacks that stricter judges reject.

Catalog record

CREATORTianyi Wu, Zhiwei Xue, Yue Liu, Jiaheng Zhang, Bryan Hooi, See-Kiong Ng
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE24 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-08104

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Geneshift: Impact of different scenario shift on Jailbreaking LLM Tianyi Wu, Zhiwei Xue, Yue Liu, Jiaheng Zhang, Bryan Hooi, See-Kiong Ng Abstract Jailbreak attacks, which aim to cause LLMs to perform unrestricted behaviors, have become a critical and challenging direction in AI safety. Despite achieving the promising attack success rate using dictionary-based evaluation, existing jailbreak attack methods fail to output detailed contents to satisfy the harmful request, leading to poor performance on GPT-based evaluation. To this end, we propose a black-box jailbreak attack termed GeneShift , by using a genetic algorithm to optimize the scenario shifts. Firstly, we observe that the malicious queries perform optimally under different scenario shifts. Based on it, we develop a genetic algorithm to evolve and select the hybrid of scenario shifts. It guides our method to elicit detailed and actionable harmful responses while keeping the seemingly benign facade, improving stealthiness. Extensive experiments demonstrate the superiority of GeneShift. Notably, GeneShift increases the jailbreak success rate from 0% to 60% when direct prompting alone would fail. We will open-source our code. Warning: this paper contains potentially harmful text. 1 Introduction Large Language Models (LLMs) ( Achiam et al. 2023 ; Dubey et al. 2024 ) are indispensable for tasks like knowledge-seeking, content generation, and planning, yet they remain vulnerable to attacks that bypass safety mechanisms and elicit harmful responses. Although white-box methods (e.g., GCG ( Zou et al. 2023 ) ) show promising success rates, they require model weights and intensive optimization, limiting practicality for closed-source LLMs. In contrast, black-box methods like PAIR ( Chao et al. 2023 ) , ArtPrompt ( Jiang et al. 2024 ) , and SelfCipher ( Yuan et al. 2023 ) circumvent these constraints using iterative prompts, artistic language, or cipher techniques. In our experiments, we observe that recent state-of-the-art black-box models indeed achieve good performance under dictionary-based evaluation, which detects the success of the attack by simply checking whether the response contains refusal keywords (a list of <40 keywords). However, with our case studies and further experiments, we find that these methods fail due to either producing insufficiently detailed harmful responses or non-harmful responses that do not contain refusal keywords, thus being misclassified by dictionary-based metrics. To address this shortfall, we introduce GeneShift , a novel black-box attack that employs a genetic algorithm to optimize scenario shifts. We find that different malicious prompts perform optimally under varying scenario shifts. By evolving and selectively blending these shifts, GeneShift elicits more detailed and actionable harmful responses while retaining a benign facade. Experiments on GPT-4o mini confirm GeneShift’s effectiveness, demonstrating a marked improvement in attack success rates. Our main contributions are as follows: • We show that aligning distinct scenario shifts with specific malicious behaviors yields the most detailed harmful responses, emphasizing the need for tailored scenario elements. • We demonstrate that malicious prompt efficacy is dependent on contextual configuration, with optimal performance emerging only under the right scenario shifts. • We propose GeneShift, a black-box jailbreak attack that employs a genetic algorithm to optimize scenario shifts, enabling malicious prompts to bypass LLM guardrails while appearing benign. • Our experiments on GPT-4o mini reveal that GeneShift boosts the jailbreak success rate from below 1% to 60%. 2 GeneShift 2.1 Scenario Shift for Enhanced Detail Direct requests for harmful content often trigger immediate refusal from LLMs. To circumvent this, attackers often embed the malicious query in a broader, seemingly benign context–a Scenario Shift (CS) –prompting more elaborate responses that can still fulfill harmful intentions. However, a single, fixed scenario may fail if it does not sufficiently align with the malicious query or misleading enough to bypass the model’s guardrails, motivating an automated approach to systematically discover more suitable transformations. 2.2 GeneShift: A Genetic Algorithm for Scenario Optimization To automate the search for optimal scenario shifts, we propose a black-box jailbreak framework called GeneShift . It leverages a genetic algorithm (GA) to explore, evaluate, and refine various transformations, ultimately generating a single-turn prompt that elicits the desired harmful response. Gene Design. Yu et al. 2024 studied existing jailbreak attacks and classified them into ten categories, we adopt their transformation categories and introduce an additional transformation rule, forming a gene database \mathcal{G}:=\{\tau_{1},\tau_{2},\dots,\tau_{M}\} . Population Initialization. We initialize a population \mathcal{P}=\{(p_{j},g_{j})\}_{j=1}^{N} , where each candidate’s gene g_{j} is generated by randomly selecting a subset of z_{j} number of distinct transformation rules from the gene database \mathcal{G} . The number of selected transformation rules, i.e., z_{j} , is sampled from a uniform distribution z_{j}\sim\mathcal{U}(1,Z) , where \quad Z=4 . Each candidate’s gene g_{j}\subset\mathcal{G} consists of a set of distinct, randomly selected transformation rules, i.e., g_{j}=\{\tau_{i_{1}},\tau_{i_{2}},\dots,\tau_{i_{z_{j}}}\} , where \tau_{i_{k}}\in\mathcal{G} and i_{1},i_{2},\dots,i_{z_{j}} are distinct indices. The corresponding candidate jailbreak prompt p_{j} is then generated by the LLM using the selected transformation rules: p_{j}=\text{LLM}(g_{j}),\quad g_{j}\subset\mathcal{G},\quad|g_{j}|=z_{j} (1) Each pair (g_{j},p_{j}) is stored to track the transformations applied in future iterations. Fitness Evaluation. To evaluate the fitness of each candidate jailbreak prompt p_{j} , we utilize a two-step process involving both the attack model and a judge LLM. Given a response r_{j} from the attack model, we instruct the judge LLM to classify r_{j} into one of six quality categories. The detailed design of the score can be found in Appendix. We define the fitness function F(p_{j}) of the candidate prompt p_{j} as the score assigned by the judge LLM: F(p_{j})=\text{score}(r_{j}),\quad r_{j}=\text{AttackModel}(p_{j}) (2) The fitness F(p_{j}) is sampled from a discrete probability distribution P(F(p_{j})=k) , where k\in\{1,2,\dots,6\} , reflecting the likelihood of each response category based on the attack model’s behavior. Crossover. Before performing crossover, we preserve the top k performing candidates as elites \mathcal{E}\subset\mathcal{P} to ensure that high-quality individuals are carried over to the next generation. For the remaining candidates, we select parents based on fitness-proportional selection, where the probability of selecting a parent p_{j} is: P(p_{j})=\frac{F(p_{j})}{\sum_{i=1}^{N}F(p_{i})},\quad j=1,\dots,N. (3) Given two parents (p_{a},g_{a}) and (p_{b},g_{b}) , the offspring’s gene g_{\text{child}} is created by randomly swapping 1 or 2 transformation rules between the two parents. Let I\in\{0,1\}^{z_{j}} be a binary mask indicating which genes are swapped between the parents. The offspring’s gene is then represented as: g_{\text{child},i}=I_{i}g_{a,i}+(1-I_{i})g_{b,i},\quad I_{i}\sim\text{U}\{0,1\}. (4) Thus, each gene g_{\text{child},i} is inherited either from parent g_{a} or g_{b} , depending on the value of I_{i} . The offspring prompt p_{\text{child}} is then generated by passing the crossovered gene to the LLM similar to Equation 1 : p_{\text{child}}=\text{LLM}(g_{\text{child}}) . Mutation. Mutation introduces further diversity into the population by modifying or expanding some of the genes in the offspring. For each gene g_{\text{child},i} , mutation occurs with a probability p_{\text{mut}} . If mutation occurs, the operation is randomly chosen with equal probability: (1) Switch, where the gene is replaced by a randomly selected gene from the gene pool \mathcal{G} ; or (2) Add, where a new random gene is appended to the gene sequence: g_{\text{child},i}=\begin{cases}g_{\text{rand}}&\text{if }O<0.5\\[5.0pt] g_{\text{child},i}\cup\{g_{\text{rand}}\}&\text{if }O\geq 0.5\end{cases} I_{i}\sim\text{Bernoulli}(p_{\text{mut}}),\quad O\sim\text{Uniform}(0,1),\quad g_{\text{rand}}\sim\mathcal{G}. (5) This mutation process ensures new genetic material is introduced and maintains population diversity across generations. The switch operation directly replaces existing genes, while the add operation introduces additional genes, enriching the offspring’s potential solution space. Termination Criteria. The genetic algorithm terminates when one of the following conditions is satisfied: 1) The maximum number of iterations T has been reached. 2)

Read the complete text