Skip to content

Gradient-Free and Prior-Free Jailbreaking of Large Language Models: Effective and Transferable AttacksJailbreaking LLMs Without Gradients or Priors: Effective and Transferable Attacks

arXiv· arXiv:2601.03420· Zhakshylyk Nurlanov, Frank R. Schmidt, Florian Bernard·Indexed by this site · 2026-10-12· Originally publishedSelected AttacksSelectedAttention41

Quick read

Attacks

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

RAILS jailbreaks using only logits: 90.2% ASR on Llama2 on HarmBench, transferring to 82.9% on GPT-3.5.

Threat modelGray-box: the attacker can query the target LLM and observe output logits, without weights or gradients. The goal is to append an adversarial suffix to a harmful query to elicit a harmful response. For transfer, the attack optimizes over open-source model logits with cross-tokenizer ensembling, then attacks what the authors call black-box closed-source models. Success requires a classifier to determine that the full response is both harmful and relevant to the query.

Questions
Aligned LLMs can still be jailbroken, but existing automatic attacks either require white-box gradients and are tied to the tokenizer, or rely on handcrafted priors or an attacker LLM. The authors argue this causes safety evaluation to overestimate robustness.
Methods
RAILS reads only logits and iteratively modifies the suffix with random token replacements. The autoregressive loss applies a large constant penalty when greedy generation deviates from the affirmative prefix, then combines with the teacher-forcing loss. The history buffer keeps both low-loss candidates and candidates from different iterations, and can do weighted ensembling over models with disjoint vocabularies.
Experiments and results
In Table 1 of HarmBench, RAILS achieves 90.2% on Llama2, and 100.0% on the other three models. In Table 2, it transfers to GPT-3.5 at 82.9% and Gemini at 51.2%. On Llama3, PRS achieves 95.0%, higher than RAILS's 92.7%.
Limitations and future work
The Limitations state that query cost is high and that system-level filtering and moderation APIs were not evaluated; the reason for token generalization is left as future work on interpretability. Direct attacks cover five open-source models and transfer covers three closed-source models; the paper does not report the number of HarmBench items or the classifier names.
Experimental setupLlama2-7B-Chat、Llama3-8B-Instruct et al. · HarmBench、ShareGPT · ASR
Evaluated models
Llama2-7B-ChatLlama3-8B-InstructVicuna-7B-v1.5Qwen-7B-ChatBaichuan2-7B-ChatGPT-3.5 Turbo (1106)GPT-4 Turbo (1106)Google Gemini Pro 1.5
Benchmarks
HarmBenchShareGPT
Metrics
ASR
AI summaryand selection rationaleResearchers propose a jailbreak optimization framework RAILS that requires no gradients and no human priors, using only model logits for token-level iterative local search. The method enforces exact prefix matching with an autoregressive loss and uses history-based candidate selection to bridge the gap between the surrogate objective and true attack success rate. On HarmBench, RAILS achieves 100% attack success rate on Vicuna, Qwen, and Baichuan2, and 90.2% on Llama2, higher than GCG's 43.9%. After ensemble optimization with Llama2, Vicuna, and Qwen, transfer success rates to GPT-3.5 Turbo, Gemini Pro 1.5, and GPT-4 Turbo are 82.9%, 51.2%, and 22.0%, respectively. The authors state that under a perplexity threshold that would filter out 5% of real user prompts, RAILS still maintains a 38% success rate on Llama2.

Researchers propose a jailbreak optimization framework RAILS that requires no gradients and no human priors, using only model logits for token-level iterative local search. The method enforces exact prefix matching with an autoregressive loss and uses history-based candidate selection to bridge the gap between the surrogate objective and true attack success rate. On HarmBench, RAILS achieves 100% attack success rate on Vicuna, Qwen, and Baichuan2, and 90.2% on Llama2, higher than GCG's 43.9%. After ensemble optimization with Llama2, Vicuna, and Qwen, transfer success rates to GPT-3.5 Turbo, Gemini Pro 1.5, and GPT-4 Turbo are 82.9%, 51.2%, and 22.0%, respectively. The authors state that under a perplexity threshold that would filter out 5% of real user prompts, RAILS still maintains a 38% success rate on Llama2.

Why it was selectedThe paper provides a jailbreak optimization method that requires no gradients and no human priors, and reports attack success rates and transfer data on open-source and closed-source models, which can serve as a reference for red teaming methods.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors propose RAILS, a gradient-free, prior-free framework that reads only logits, using cross-tokenizer ensembling for transferable jailbreaks.

    With only logits, no gradients, and no hand-crafted priors, can token-level iterative optimization jailbreak aligned LLMs and transfer to closed-source models with different vocabularies.

    • Scenario: The authors argue that LLMs are already used in critical domains such as healthcare and software engineering; RLHF-aligned models can still be jailbroken, with risks including misinformation and assisting in the design of biological weapons. The authors argue that existing safety evaluations often overestimate robustness because automated attacks are constrained by white-box gradients or hand-crafted priors.
    • Existing shortcomings: The authors note that methods like GCG require white-box weights, and gradients are tied to the tokenizer, making ensembling difficult for models with disjoint vocabularies. Gradient-free methods often rely on hand-crafted templates or attacker LLMs, which the authors argue limits the discovery of structural vulnerabilities beyond predefined templates.
    • Hypothesis: The authors argue that naive random search fails in the discrete prompt space. The autoregressive loss enforces exact prefix matching, and historical candidates balance low loss with diversity, used to close the gap between affirmative prefix probability and truly harmful responses.
    • Method: They propose RAILS (RAndom Iterative Local Search). It reads only logits, performs gradient-free, prior-free suffix optimization, and can ensemble over models with disjoint vocabularies.
    • Threat model:
      • Knowledge: Direct attacks are gray-box: the attacker can query the target LLM and observe output logits, without access to weights or gradients.
      • Goal: Find an adversarial suffix of length L after a harmful query to make the model produce a harmful response.
      • Capability: Local search via random token replacement. For transfer, optimization is joint over the logits of multiple open-source models; the authors call closed-source targets black-box.
      • Evaluation: The proxy objective is to increase the probability of a specified affirmative prefix. True success is determined by a classifier C(·) judging the full response harmful; the HarmBench evaluation also requires relevance to the query.
  2. What related research exists?

    Related work is grouped by gradient, handcrafted priors, gradient-free search, and transfer; the authors distinguish themselves with prior-free logits local search.

    Gradient Methods

    • GCG and similar: GCG (Zou et al., 2023) uses coordinate ascent to optimize adversarial suffixes; the authors call it the standard baseline of this class. AutoPrompt (Shin et al., 2020), GGI (Zhou et al., 2025), and Faster-GCG (Li et al., 2024) also use gradients to select tokens.
    • Limitations noted by the authors: The authors argue these methods are unusable in a logits-only gray-box setting and are tied to the source model's tokenizer, making cross-architecture ensembling difficult.

    Hand-Crafted Priors and Attacker LLMs

    • Templates and seeds: PRS (Andriushchenko et al., 2024) optimizes suffixes within verbose, model-specific templates. AutoDAN (Liu et al., 2024) uses an evolutionary algorithm, which the authors note relies on curated human prompts as seeds. The authors state RAILS questions whether these hand-crafted priors are necessary.
    • LLM rewriting: PAIR (Chao et al., 2023), TAP (Mehrotra et al., 2023), and SFS (Perez et al., 2022) use meta-prompts to drive an attacker LLM to iteratively rewrite inputs. The authors argue they are limited by the attacker model's capability and context window, making it hard to perform the precise token manipulation needed to break strongly aligned models.

    Output-Only Gradient-Free Optimization

    • BEAST: BEAST (Sadasivan et al., 2024) uses an auxiliary model to propose token replacements and searches with beam search. The authors state that in their experiments it struggles to jailbreak strongly aligned models like Llama2.
    • Authors' classification: The authors place RAILS in the class of general gradient-free optimization using only model outputs (logits), and state that random iterative local search with the autoregressive loss and history selection is more effective.

    Transfer

    • GCG-T: GCG-T (Zou et al., 2023) optimizes on an ensemble of models and then transfers. The authors argue that gradient-based ensembling usually requires a shared tokenizer, limiting ensemble diversity.
    • TAP-T: The authors state TAP-T (Mehrotra et al., 2023) improves transferability but often relies on strong models like GPT-4 as the source.

    Baselines and Benchmark

    • Baseline methods: Direct attacks compare against AutoDAN, PAIR, TAP, GCG, BEAST, PRS; transfer compares against GCG-T and TAP-T. The authors state the baseline numbers in Table 1 come from the literature, and baselines use the standard settings from the literature.
    • Benchmark: The main evaluation is HarmBench. Closed-source transfer targets are GPT-3.5 Turbo, GPT-4 Turbo, and Gemini Pro.

    The authors distinguish this work as: token-level search that needs no gradients or hand-crafted priors, and can ensemble over models with disjoint vocabularies to discover shared, tokenizer-agnostic patterns; this differs from gradient ensembling tied to a single tokenizer and from TAP-T, which relies on a strong source model.

  3. How does the paper address this problem?

    RAILS uses random token replacement, autoregressive loss, and historical candidates, optimizes the suffix on logits, and can be integrated across tokenizers.

    RAILS frames jailbreaking as discrete suffix search: it reads only logits, approximates the proxy objective with random local perturbations, and selects diverse candidates from history for few-shot attacks.

    Problem Setup and Objective Gap

    • Gray-box: The attacker queries model M and observes logits, without weights or gradients. The input is a harmful query followed by a suffix of length L.
    • Two objectives: During optimization, maximize the probability that the model generates a specified affirmative prefix y; during evaluation, the full response must be judged harmful by classifier C(·). The authors note that the model may generate y and then refuse, so high prefix probability does not guarantee jailbreak success.
    • Objective function: The proxy objective is x∗i:j=argmaxxi:j∈ VL Pℳ(y∣ x1:i−1⊕ xi:j), i.e., maximizing this conditional probability over a suffix of length L.

    Two-Stage Search

    • Iteration: Starting from an initial string, each round generates N random token replacements, greedily updates the current string by loss within the batch, and writes candidates, losses, and iteration numbers into history H (Algorithm 1, Figure 2). In the qualitative analysis, the authors state the search starts from random noise, not hand-crafted templates.
    • Budget: Single-model iterations T are 400–600, multi-model 600–1000; samples per round N is 1024 (Table S1).
    • Few-shot: After the budget is exhausted, candidates are selected from H, filtered on the source model, then queried on the target model (Figure 2).

    Loss Functions

    • Teacher forcing: Average negative log-likelihood over all target tokens. The authors argue that generation must predict earlier tokens first, so they add a stricter loss.
    • Autoregressive loss: If greedy generation deviates from y before position k, this term is a large constant C; otherwise it is only the negative log-probability of the current target token. The authors state this forces optimization to first complete exact prefix matching.
    • Combination: The search uses the convex combination L(x,y)=α LAR(x,y)+(1−α)LTF(x,y). Table S1 sets α to 0.9 and C to 100.0.

    Historical Candidate Selection

    • Reason: The authors argue that the lowest-loss string may overfit the proxy objective, and slightly worse points along the trajectory sometimes more easily trigger true harmful behavior.
    • Two criteria: The exploitation term takes the candidate with the lowest loss across the whole trajectory; the exploration term samples from different iterations to preserve temporal diversity.
    • Scale: 100 validation candidates and 20 test candidates (Table S1). The hybrid implementation in the main text is the 50 lowest-loss candidates plus 50 per-round best suffixes drawn from random, distinct iterations.

    Cross-Tokenizer Ensembling

    • Approach: Because gradients are not backpropagated, perturbation generation and loss computation are separated. Each model computes the loss with its own tokenizer, and the ensemble loss is a weighted sum.
    • Weights: Dynamically adjusted by whether each model has currently been successfully attacked, prioritizing models not yet broken. The paper does not give the weight update formula.
    • Authors' purpose: To force the search to find strings that hold under different tokenization schemes, improving transfer to black-box systems.
  4. What experiments did the paper conduct?

    In Table 1, RAILS achieves 90.2% ASR on Llama2 and 100.0% on Vicuna, Qwen, and Baichuan2.

    Experimental Setup

    • Open-source targets: Llama2-7B-Chat, Llama3-8B-Instruct, Vicuna-7B-v1.5, Qwen-7B-Chat, Baichuan2-7B-Chat. Direct attacks optimize on the logits of these models, and evaluation is on the same models.
    • Closed-source targets: GPT-3.5 Turbo (1106), GPT-4 Turbo (1106), Google Gemini Pro 1.5. In the tables these are abbreviated as GPT-3.5 Turbo, GPT-4 Turbo, Gemini Pro. Optimization uses logits from the open-source ensemble, not the closed-source models' logits.
    • Data and baselines: The benchmark is HarmBench; the paper states it covers behaviors such as cybercrime, chemical weapons, and harassment, without specifying the number of items. Direct attack baselines are AutoDAN, PAIR, TAP, GCG, BEAST, PRS, with numbers taken from the literature. Transfer baselines are GCG-T and TAP-T, the latter using GPT-4 Turbo as the source.
    • Evaluation: ASR. Ctest evaluates full responses of up to 512 tokens, which must be harmful and relevant to the query, following the HarmBench protocol. Optimization only maximizes the probability of an affirmative prefix; candidates are then filtered with Cval on the source model from K=100 items, and Ktest=20 are used to evaluate the target.
    • Comparison protocol: The authors state that PAIR, TAP, and PRS use full responses and classifiers within their optimization loops. RAILS is split into proxy optimization and few-shot selection. In the ablation, RAILS Core uses only a single prompt for the proxy objective, to compare with GCG's single attack.
    • Unspecified items: The paper does not specify the model names or thresholds for Ctest and Cval, does not report agreement with humans, and does not report the number of repetitions for Table 1. The ± in Tables 3 and 5 is not explained statistically.

    Main Results

    The table below lists only RAILS, the highest baseline in that row, and GCG; other baselines such as PAIR and TAP appear in Table 1. In these rows, the optimization target is the evaluated model.

    Swipe horizontally to read the table

    ModelRAILSHighest baseline in tableThat baseline's ASRGCGSource
    Llama2-7B-Chat90.2%PRS82.0%43.9%Table 1
    Llama3-8B-Instruct92.7%PRS95.0%9.0%Table 1
    Vicuna-7B-v1.5100.0%AutoDAN, GCG90.2%90.2%Table 1
    Qwen-7B-Chat100.0%BEAST92.6%80.5%Table 1
    Baichuan2-7B-Chat100.0%PRS87.8%78.0%Table 1
    • The authors claim RAILS achieves state-of-the-art on these open-source models and that on Llama2 it is more than double GCG. The Llama3 row in Table 1 contradicts the table note "consistently outperforms": in that row PRS is higher than RAILS.
    • The abstract says near 100%; in the table, the Vicuna, Qwen, and Baichuan2 rows are 100.0%, while the Llama2 and Llama3 rows fall short of this claim.
    • Table 1's title is "Best achieved", without specifying suffix length or compute budget, so it is not the same setting as the equal-budget ablation later.

    Transfer Attacks

    • What was tested: RAILS-T is optimized on the open-source ensemble, then tested on unseen closed-source models. The main text links the GPT-3.5 and Gemini results in Table 2 to Llama2+Vicuna+Qwen, and states that after swapping in Llama3 with a different tokenizer, the ASR on GPT-4 rises from 12.2% to 22.0%.
    • Results: In Table 2, RAILS-T achieves 82.9% on GPT-3.5 Turbo, versus GCG-T at 53.5% and TAP-T at 60.0%; on Gemini Pro, 51.2%, 12.5%, and 40.0%; on GPT-4 Turbo, 22.0%, GCG-T at 19.5%, and TAP-T not reported. TAP-T's source is GPT-4 Turbo. In Table S2, 12.2% corresponds to Llama2+Vicuna+Qwen and 22.0% to Llama3+Vicuna+Qwen.
    • Authors' interpretation and exceptions in the table: The authors claim transferability increases with source ensemble diversity and that cross-tokenizer optimization is key. Figure 3's legend lists GPT-3.5, Gemini Pro, GPT-4, with the x-axis as source model diversity; bar heights are not readable in the text. Table S2 is not monotonic everywhere: Llama3+Vicuna+Qwen achieves 61.0% on GPT-3.5, lower than Qwen alone at 70.7%; Llama2+Vicuna achieves 12.2% on GPT-4, lower than Llama2 alone at 14.6%.

    Component Ablation

    • What was tested: Llama2 7B, 20-token suffix, compute budget equal to GCG at 25×10^4 evaluations (Table 3).
    • Results: RAILS Full is 80±2%; removing few-shot (ASR@1) is 78±3%; removing the autoregressive loss is 77±1%; RAILS Core is 42±4%; GCG is 45±5%.
    • Authors' interpretation: The authors state that on the proxy objective, simple local search performs comparably to gradient methods; they also state that history selection plus few-shot raises ASR to 80%, and that bridging the proxy objective and true harmfulness is more critical than white-box gradients. In Table 3, ASR@1 with history selection is 78±3, Full is 80±2, and Core is 42±4.

    Perplexity Filtering and Tokenizer Consistency

    • Perplexity: Figure 5's x-axis is Perplexity Threshold (log scale), with thresholds set using real ShareGPT prompts. The authors state that at the threshold filtering out 5% of real prompts, RAILS achieves 38% ASR on Llama2, GCG 14%, and BEAST 0%. The legend includes RAILS (L=20), RAILS (L=10), and Llama2+Qwen (L=20); the paper does not specify which curve the 38% corresponds to.
    • Vocabulary and suffix: Directional vocabulary overlap is defined as the proportion of one model's vocabulary that also appears in another model's vocabulary. Across all directional pairs of Llama2, Qwen, Llama3, Baichuan2, GPT-4, and Gemini Pro, the average overlap is 49.0% (Table 4). Suffix token consistency for multi-model attacks is 84.0%, and for single-model attacks 81.1%. The authors claim ensemble optimization therefore finds shared patterns that map to valid tokens even across disjoint vocabularies. In Table S3, Llama2's vocabulary is 32,000 and Qwen's is 151,643.
    • Semantic categories: The authors state that GPT-4 defends better against General Harm and Harassment, while Cybercrime and Intrusion are more susceptible to transfer attacks (Figure S2). The main text gives no per-category ASR, and the values in the figure cannot be read column by column from the text conversion.

    Other Ablations and Analyses

    • Suffix length (Figure 4a): The authors state that 40–60 tokens give higher ASR on Llama2, which they call a white-box source, while 5–20 tokens transfer better to GPT-3.5 and Gemini; the main text gives no ASR per length.
    • Selection strategy (Figure 4b): The candidate pool is 600 iterations × a batch size of 1024. The authors state the hybrid strategy raises validation success from about 78% to 86%.
    • First successful iteration (Table 5): Vicuna is 12±8 (ASR 100.0), Qwen is 22±19 (100.0), Llama3 is 61±46 (92.7), Llama2 is 173±145 (90.2). Baichuan2 is not listed in this table.
    • Low baselines in Table 1: BEAST achieves 0.0% on Llama2 and 4.9% on Llama3; the authors state it struggles to jailbreak Llama2.
    • Qualitative categories: The authors state that starting from random noise re-emerges six categories of techniques: Role-Playing, Instruction Manipulation, Code Injection, Technical Jargon, Formatting, Linguistic Obfuscation. In Figure S1, the authors state formatting and instruction/context manipulation are most common. In Appendix E, Llama2 refuses in case 1 and Llama3 refuses in case 2.
    • Single-source transfer (Table S2): On GPT-4, the highest single-source result is Llama2 and Llama3 at 14.6%; on Gemini Pro, Vicuna alone is 4.9% and Qwen alone is 22.0%.
  5. What are some points that can be further explored?

    The authors note the high query cost, the lack of evaluation of system-level defenses, and that the reason for token generalization remains to be explained.

    Limitations and future directions noted by the authors

    • Query overhead: The Limitations state that, although more efficient than training-based methods, RAILS is still computationally expensive, requiring a large number of model queries per attack.
    • Defense layers: The same section states that the study only targets model-level defenses and does not evaluate system-level defenses such as auxiliary input/output filtering or moderation APIs.
    • Interpretability: The same section states that why certain token perturbations generalize better than others remains an open question for future interpretability research.

    Experimental coverage

    • Direct attacks report ASR on HarmBench for five open-source conversational models (Table 1); transfer reports three closed-source models, with source ensemble configurations in Table S2.
    • Direct attack baselines are AutoDAN, PAIR, TAP, GCG, BEAST, PRS; transfer baselines are GCG-T and TAP-T. The authors state that the baseline numbers in Table 1 come from the literature.
    • Component ablations were done on Llama2 7B, with a 20-token suffix and 25×10^4 evaluations (Table 3); suffix length and selection strategy are in Figure 4, perplexity filtering in Figure 5.
    • Success is determined using Ctest and Cval, with replies up to 512 tokens, 100 validation candidates, and 20 test candidates. The paper does not report the names of these two classifiers, the decision thresholds, or agreement with human annotation.
    • The paper does not report the number of HarmBench behaviors, nor the number of repetitions for Table 1; the ± in Table 3 and Table 5 is not explained, and no repetition counts are given.
  6. Summarize the main content of the paper

    RAILS optimizes jailbreak suffixes using only logits; the authors say it transfers to GPT and Gemini, with an ASR of 90.2% on Llama2.

    RAILS is a logits-only jailbreak optimization framework for testing aligned LLMs without gradients or hand-crafted priors.

    • Problem: The authors argue that automated red-teaming either requires white-box gradients and is tokenizer-constrained, or relies on templates or attacker LLMs, so existing safety evaluations may overestimate robustness.
    • Method: In a gray-box setting, random token replacements are applied to the suffix; the autoregressive loss records a constant penalty when greedy generation deviates from the affirmative prefix, combined with the teacher-forcing loss at α=0.9. History keeps both low-loss candidates and candidates from different iterations, with 20 used at test time. Across models, weighted losses are computed with each model's own tokenizer.
    • Open-source results: In Table 1 of HarmBench, RAILS achieves 90.2% ASR on Llama2-7B-Chat, 92.7% on Llama3-8B-Instruct, and 100.0% on Vicuna-7B-v1.5, Qwen-7B-Chat, and Baichuan2-7B-Chat. On Llama3, PRS achieves 95.0%, higher than RAILS.
    • Transfer and ablation: Llama2+Vicuna+Qwen transfers to GPT-3.5 Turbo at 82.9% and Gemini Pro at 51.2%; in Table S2, Llama3+Vicuna+Qwen transfers to GPT-4 at 22.0%. Under equal budget with a 20-token suffix, RAILS Core achieves 42±4% on Llama2 and GCG 45±5% (Table 3).
    • Authors' conclusions: The authors argue cross-tokenizer optimization is key to transferring to GPT and Gemini, and call for stronger, tokenizer-agnostic defenses. The Limitations also state high query cost and that system-level filtering was not evaluated.

Related papers

Show 3 more papers
Read originalarxiv.org