LLM fine-tuning jailbreak under a highly restricted black-box setting: a three-pronged approachFine-Tuning Jailbreaks under Highly Constrained Black-Box Settings: A Three-Pronged Approach
The authors propose a three-pronged fine-tuning jailbreak attack that bypasses a three-stage defense under a data-only black-box setting, with ASR up to 98.5% on GPT-4o (AdvBench, Table 4).
The attacker accesses the fine-tuning interface only in a black-box manner, can only submit training data, cannot access the model architecture, parameters, or training algorithm, and cannot observe the model during training; the provider deploys a three-stage defense: data filtering before upload, defensive fine-tuning during training, and safety audit after training, and the attacker does not know the specific tools or models of each stage.
- In black-box fine-tuning services, attackers can only upload data, while providers can deploy three-stage defenses: data filtering, defensive fine-tuning, and post-training auditing; the authors believe that existing fine-tuning jailbreak research scenarios are overly simplified, ignoring these defenses or undermining model utility.
- Proposes a three-pronged data augmentation attack: add safety-style prefixes and suffixes to harmful answers, iteratively replace harmful keywords with underscores using a proxy LLM, and inject a backdoor with a trigger word, so that individual data samples appear harmless while the model learns trigger-conditioned harmful behavior.
- On three open-source models, bypassing two filters and two defensive fine-tuning methods, ASR (w/ trigger) reaches up to 99.1%; on the OpenAI platform, real fine-tuning of GPT-4o/GPT-4.1 and the mini versions achieves ASR 95.7%–99.5%, with utility essentially unchanged.
- The authors note that 580 samples are still required, that the lower limit below 10 samples was not explored, and that only two defensive fine-tuning algorithms were evaluated; the experiments cover three open-source models, four OpenAI models, two filters, and two defense settings.
- Evaluated models
- Llama-2-7B-ChatGemma-1.1-7B-ITQwen2.5-7B-InstructGPT-4oGPT-4.1GPT-4.1-miniGPT-4o-mini
- Benchmarks
- AdvBenchHEx-PHIARCGSM8K
- Metrics
- ASR (w/ trigger)ASR (w/o trigger)UtilityLeakage RateValidity
Researchers at the University of Chinese Academy of Sciences propose a jailbreak attack against LLM fine-tuning services that, under a black-box setting where the attacker can only submit training data, bypasses a three-stage defense of data filtering, defensive fine-tuning and post-training safety auditing. The attack combines three techniques: adding safety-style prefixes and suffixes to harmful question-answer pairs, replacing sensitive keywords with underscores, and implanting a backdoor so that the model outputs harmful content only when the input contains a specific trigger phrase. In a real attack on the OpenAI platform, the attack success rate for GPT-4.1 and GPT-4o exceeded 97%, the harmful rate without the trigger was no more than about 2%, general capabilities were almost unchanged, and a single attack required about 500 to 600 samples at a cost of about 6 US dollars. The authors also observed that when the same model is both responsible for reviewing uploaded data and is the fine-tuning target, the attack data can pass review, and on this basis infer that the OpenAI platform has such a self-review mechanism; the code has been open-sourced, and the authors say they will share the findings with OpenAI after publication.
Why it was selectedUnder a black-box setting where the attacker can only submit training data, about 500 samples and about 6 US dollars in cost suffice to bypass the three-stage defense; platforms operating fine-tuning services can use this to check their data review and auditing stages.
Paper analysis
What problem does this paper attempt to solve?
Under a data-only black-box fine-tuning setting, how to bypass the provider's three-stage defenses to carry out a jailbreak while maintaining model utility.
Core question: Under a highly restricted black-box fine-tuning interface, where attackers can only submit training data, how can they bypass the provider's data filtering, defensive fine-tuning and post-training audit so that the model learns trigger-conditioned harmful behavior without losing utility.
- Setting and importance: Fine-tuning is a common way to adapt LLMs to downstream tasks, and providers such as OpenAI offer fine-tuning as a black-box service; the authors cite prior research showing that as few as 10 adversarial examples can break safety alignment, and that benign data can also cause a model to lose alignment.
- Gaps in existing research: The authors argue that existing fine-tuning attack studies use overly simplified settings—some do not strictly follow the black-box setting (Huang et al., 2025), some ignore provider-side defenses (Murphy et al., 2025), and some consider defenses but use complex attack pipelines that clearly harm model utility (Halawi et al., 2024).
- Core observation: The authors argue that existing defenses mostly rely on shallow signals such as harmful keywords, and that defenses of the kind in (Qi et al., 2024) mainly constrain the first tokens of a response, with weaker constraints on subsequent tokens, which can be bypassed with disguised data.
- Paper proposes: A threat model closer to real deployment, and a three-pronged attack consisting of safety-style prefixes and suffixes, keyword underscore replacement, and harmful backdoors; validated by real fine-tuning of GPT-4o/GPT-4.1 on the OpenAI platform.
- Threat model:
- Goal: Break the model's safety alignment through fine-tuning while preserving general capabilities.
- Knowledge: black-box—the attacker only interacts with the fine-tuning interface, cannot access the model architecture, internal parameters or training algorithm, and does not know which filtering model or defense technique the provider uses at each stage.
- Capabilities: Can only control and submit the training dataset, and cannot observe the model during training.
- Victim system: A fine-tuning provider deploying a three-stage defense—pre-upload data filtering, defense-aware fine-tuning during training, and post-training safety audit, with the model released only after passing the audit (Figure 1).
What related research exists?
Related work falls into three groups: alignment methods, fine-tuning jailbreak attacks, and three-stage defenses; this paper is positioned as a low-cost attack under a more realistic black-box setting.
LLM Safety and Alignment
- SFT/RLHF and their improvements (Ouyang et al., 2022; Bai et al., 2022; Christiano et al., 2017, etc.)—inject refusal behavior through supervised fine-tuning and reinforcement learning from human feedback.
- Robust alignment methods—Stable Alignment, Circuit Breakers, SELFEE (Liu et al., 2023; Zou et al., 2024; Kim et al., 2024), as well as modular or preference-objective methods such as H3Fusion and DPO.
Fine-tuning Jailbreak Attacks (FJAttack)
- Qi et al. (2023)—found that fine-tuning breaks model safety even when the data appear entirely benign; Yang et al. (2023) and Zhan et al. (2023) further explore identity-role-shift prompts and non-toxic data triggering harmful outputs.
- Virus (Huang et al., 2025)—dual-objective optimization simultaneously evades guardrails and preserves harmful gradients; the paper notes that it requires access to model gradients and logits, which contradicts the threat model of black-box/commercial APIs.
- Covert Malicious Finetuning (Halawi et al., 2024)—encodes harmful behavior into training data using a substitution cipher, bypassing various filtering defenses; the paper notes that it requires many samples and harms general capabilities. This paper's threat model builds on this work.
- Jailbreak-Tuning (Murphy et al., 2025)—mixes benign and harmful data to evade moderation; the paper notes that its data and training costs are higher. Wallace et al. (2025) use tools and agent scaffolding to probe the worst-case misuse of open-weight models.
Defenses against Fine-tuning Attacks
- Alignment-stage defenses—Vaccine/T-Vaccine, Booster, RepNoise, CTRL, TAR, etc., which maintain safety through gradients, regularization, or adversarial exposure.
- Fine-tuning-stage defenses—SafeInstr, PTST, Constrained SFT (Qi et al., 2024), SaLoRA, BEA (Wang et al., 2024), LISA, etc.; the paper notes that these methods often require curated data or provider control over the training process and may sacrifice utility.
- Post-fine-tuning approaches—realignment or auditing methods such as LAT, SafeLoRA, IRR, SOMF, and LoRA fusion; there is also data-centric work (He et al., 2024; Hsiung et al., 2025) discussing the effect of the similarity between benign-looking data and alignment sets on safety.
Baselines and Benchmarks: the attack baseline is Direct-Harm (directly submitting 580 harmful question-answer pairs); the defense baselines are the token-level constrained objective of Qi et al. (2024) and the backdoor alignment of Wang et al. (2024); the evaluation benchmarks are AdvBench, HEx-PHI (harmful behavior) and ARC, GSM8K (utility).
The authors position this paper as: under a more realistic three-stage-defense black-box setting, achieving an efficient attack with few samples without harming utility, distinct from the white-box assumption of Virus, the large-sample requirement of CMF, and the high cost of Jailbreak-Tuning.
How does the paper address this problem?
Automated data augmentation pipeline: prefix-suffix wrapping, iterative keyword replacement by a proxy LLM, and three types of backdoor samples, transforming harmful question-answer pairs into a stealthy fine-tuning dataset.
The overall idea is an automated data augmentation pipeline: for each harmful question-answer pair, three operations are applied in sequence—prefix–suffix wrappers, harmful keyword replacement, harmful backdoor—so that individual data samples appear harmless while the fine-tuned model outputs harmful content under a specific trigger word (Figure 2). The method operates entirely black-box and requires only a small number of samples.
Prefix–Suffix Wrappers
- Design: add a safety-oriented prefix and suffix to each harmful answer; the prefix is a phrasing that apologizes and then turns to providing information, and the suffix claims the content belongs to a fictional safety evaluation scenario.
- Rationale (per the authors): these safety cues can mask harmful content to evade filtering; moreover, the defense of (Qi et al., 2024) mainly constrains the opening tokens of the response and weakly constrains subsequent tokens, so an opening that appears aligned suffices to bypass it.
Harmful Keyword Replacement
- Design: use a proxy LLM iteratively: first locate potentially harmful keywords in the question-answer pair, replace each flagged token with a fixed four underscores (regardless of the original word length), then have the same proxy model re-review it; it is admitted only if judged safe, otherwise the process repeats, up to 5 iterations.
- Implementation: in the experiments, GPT-4o-mini is used as the proxy model; Appendix D gives the full prompts.
- Rationale (per the authors): adding prefixes and suffixes alone is insufficient when the provider uses an advanced LLM as a filter; replacing keywords can further reduce apparent harmfulness.
Harmful Backdoor
- Design: construct three types of training samples (right side of Figure 2): 1) harmful prompts paired with refusal responses, preserving safe behavior without the trigger; 2) the same harmful prompts plus a synthetic trigger word t (a meaningless phrase) paired with harmful answers, installing a precise backdoor; 3) harmful prompts paired with random non-trigger tokens and refusal responses, reinforcing refusal to arbitrary rare tokens so that only the exact trigger word activates harmful content, and simulating the defender's backdoor-defense data.
- Data composition: randomly take 20 of the 580 samples and change them to refusals as type 1; type 2 embeds the trigger word in the instruction and keeps the harmful answer; 100 type-3 samples are generated based on the 20 type-1 samples and 5 random non-trigger tokens.
Attack Dataset Construction
- Process: first fine-tune Llama-2-7B-Chat on the 100 harmful question-answer pairs of (Qi et al., 2023) to obtain a safety-compromised model, use it to generate 2000 harmful instructions (covering the first ten harm categories defined by Qi et al. 2023), filter with GPT-4o-mini to retain instructions that are verifiably harmful, then have the compromised model generate answers, and the question-answer pairs are re-reviewed by GPT-4o-mini and manually audited.
- Scale: after keyword replacement iterations (GPT-4o-mini proxy, at most 5 iterations, retaining only samples judged safe), 580 samples are obtained, which are then combined into the final attack dataset according to the three types above.
Success Criteria
- ASR: GPT-4o-mini scores responses on a 1–5 harmfulness scale following the (Qi et al., 2023) procedure, and only a score of 5 counts as harmful; with the trigger word, higher ASR means a stronger attack, and without the trigger word, lower ASR means better stealthiness; each harmful query is given 5 attempts, and if a score of 5 appears in any of the five, the sample is counted as harmful.
- Utility: the proportion of correct final numerical answers on GSM8K and multiple-choice accuracy on the ARC test set.
What experiments did the paper conduct?
Three open-source models plus four OpenAI models, bypassing two filters and two defenses, ASR (w/ trigger) up to 99.5%, with utility essentially unchanged.
Experimental Setup
- Models tested: open-source models Llama-2-7B-Chat, Gemma-1.1-7B-IT, Qwen2.5-7B-Instruct; OpenAI models GPT-4o, GPT-4.1, GPT-4.1-mini, GPT-4o-mini.
- Datasets: attack data are 580 harmful question-answer pairs (construction see Q3); evaluation uses AdvBench and HEx-PHI (harmful behavior), ARC and GSM8K (utility); the paper does not state the number of items in each evaluation set.
- Baselines and defenses: the attack baseline is Direct-Harm (directly submitting the 580 original harmful question-answer pairs); defenses are Claude-sonnet-4/GPT-4.1/GPT-4.1-mini data filtering (temperature 0), Token Restriction from Qi et al. (2024) (β1=0.5, βt=2 for the 2nd–5th tokens, βt=0.1 thereafter), and Backdoor Alignment from Wang et al. (2024) (injecting 50 safe samples, about 10:1); the two defenses are implemented independently rather than combined.
- Metrics and judging: GPT-4o-mini scores on a 1–5 scale, and only a score of 5 counts as harmful; each query gets 5 attempts, and one score of 5 marks it harmful; Utility is ARC accuracy and GSM8K numerical correctness.
- Training and repetitions: AdamW, learning rate 2e-5 (5e-6 for Gemma), 4 A100s, effective batch 64, 10 epochs; OpenAI tasks use 3 epochs, batch 16; all results are the mean ± standard deviation of 5 independent training runs.
Main Results
Table 1 (filter is Claude-sonnet-4, ASR in %, mean of 5 runs):
Swipe horizontally to read the table
Model Dataset Defense Direct-Harm (w/) Ours (w/) Ours (w/o) Llama-2-7B-Chat AdvBench Token Restriction 3.8 99.1 1.2 Llama-2-7B-Chat AdvBench Backdoor Alignment 0.1 97.7 0.0 Gemma-1.1-7B-IT AdvBench Token Restriction 11.2 98.9 2.1 Gemma-1.1-7B-IT HEx-PHI Backdoor Alignment 12.3 81.3 0.0 Qwen2.5-7B-Instruct HEx-PHI Token Restriction 11.2 95.8 1.8 Qwen2.5-7B-Instruct AdvBench Backdoor Alignment 0.0 97.5 0.0 (Table 1 has 3 models × 2 datasets × 2 defenses in total; some combinations are omitted here; full ranges see below.)
- Authors' interpretation: The authors state that the method is effective under both defenses and on all three models—under Token Restriction, ASR (w/ trigger) is 95.8%–97.9% on AdvBench and 97.0%–99.1% on HEx-PHI (per Table 1 cells, the ranges in the main text differ from the values in the table; the table takes precedence: AdvBench is actually 97.5–99.1, HEx-PHI is 95.8–97.9); under Backdoor Alignment, AdvBench is 92.3%–97.7% and HEx-PHI is 81.3%–97.6% (the main text says 94.7%–97.6%, while Gemma in the table is 81.3).
- Filtering stage: Table 2 shows that under Claude-sonnet-4 the Direct-Harm leakage rate is 1.5% and this paper's method is 79.1%; under GPT-4.1, 1.2% versus 80.1%; under GPT-4.1 mini, 2.4% versus 93.2%.
- Stealthiness and utility: Without the trigger word, ASR is mostly about 1.5%, with a maximum of 6.6% (Gemma, HEx-PHI, Token Restriction); ARC/GSM8K utility is almost identical to the original checkpoints (e.g., Qwen2.5 ARC-Challenge 86.9→86.8).
Real-world Attack (OpenAI Platform)
- What was tested: On the OpenAI fine-tuning API, 500 custom samples were submitted for each of GPT-4o, GPT-4.1, and the mini version (Type-2 and Type-1 at 10:1), audited by the corresponding target model itself, and all passed.
- Results: Table 4 shows ASR (w/ trigger) is 97.9%–99.5% on AdvBench and 95.7%–97.8% on HEx-PHI; ASR (w/o trigger) is no higher than 2.3%; ARC-Challenge utility is unchanged before and after the attack (e.g., GPT-4o 95.9→95.9).
- Authors' interpretation: The authors speculate that the OpenAI platform has a "self-auditing" mechanism—the same model selected as the fine-tuning target is also responsible for screening uploaded data, so model-specific attack data is misjudged as safe; the authors state this is a hypothesis.
Component Ablation and Mechanistic Analysis
- Component contributions: Table 3 (Claude-sonnet-4 filtering, 580 samples) shows that prefix-suffix alone gives a leakage rate of 11.2%, adding keyword replacement gives 75.4%, and adding the backdoor gives 79.1%, all higher than 1.5% without augmentation; the authors consider keyword replacement to have the largest effect, indicating that the filtering model relies excessively on harmful keywords.
- Safety impact: Table 11 shows that fine-tuning with keyword-replaced data alone (no backdoor) already brings ASR (w/o trigger) on HEx-PHI to 81.8%–94.2%, and adding prefix-suffix raises it to 97.2%–98.1%; the authors state that data with harmless keywords alone can break safety alignment.
- Effect of underscores on outputs: Table 5 shows that on HEx-PHI, the valid rate of each model generating at least one 5-point response without underscores is 89.8%–97.4% (this experiment disabled the intermediate defense for open-source models); the authors state that underscores do not impair normal functionality.
Other Ablations and Analyses
- Replacement symbols (Table 7, Llama-2-7B-Chat, fixed length 4): ASR (w/ trigger) for "_", "!", "@" is 95.1%–99.1% across both defenses and both datasets, with little difference.
- Placeholder length (Table 8, symbol fixed as underscore): ASR (w/ trigger) for lengths 2/4/6 is 95.0%–99.1%; the authors state that the key lies in the replacement behavior itself.
- Different filters (Appendix B, Table 9/10): with GPT-4.1 and GPT-4.1 mini as filters, results are similar to the main experiments, with Ours (w/ trigger) up to 99.3%.
- Efficiency comparison (Table 6): the authors state that this paper uses about 500–600 samples, about $6 per run, and 5–10 minutes, compared with about 20,000 samples for CMF, about $50 and 1.5–4 hours for Jailbreak-Tuning, and about $85 for NOICE; they also state it exceeds the 57% reported by NOICE (GPT-4o).
What are some points that can be further explored?
The authors note two limitations: the lower bound on data volume and defense coverage; the experiments cover seven models, two defense algorithms, and the real OpenAI interface.
Limitations and future directions noted by the authors
- Data efficiency (Limitations): The method still requires 580 data points; whether it remains effective with 10 or fewer samples was not explored. The authors believe that determining the lower bound would make it clearer to understand the minimum resources needed to break fine-tuning defenses.
- Scope of defense algorithms (Limitations): Only two defensive fine-tuning algorithms were evaluated; newer methods such as Booster, Vaccine, and Lisa were not considered. The authors believe that a broader evaluation would more comprehensively assess the method's robustness and generalization.
- Future directions (Conclusion and Discussions): The authors plan to explore semantic risk detection beyond simple similarity checks, focusing on deep threat signals that can still be detected when no explicit harmful keywords are present, and their implications for end-to-end defenses.
Scope of experimental coverage
- Models tested: On the open-source side, 3 in total: Llama-2-7B-Chat, Gemma-1.1-7B-IT, and Qwen2.5-7B-Instruct; on the OpenAI side, 4 in total: GPT-4o, GPT-4.1, GPT-4.1-mini, and GPT-4o-mini.
- Defense evaluation: Data filtering included Claude-sonnet-4, GPT-4.1, and GPT-4.1-mini; defensive fine-tuning included two types, Token Restriction and Backdoor Alignment, implemented independently; post-training auditing used AdvBench and HEx-PHI.
- Evaluation protocol: GPT-4o-mini scored on a 1–5 scale, with only a score of 5 counted as harmful, with 5 attempts per query; all results are the mean of 5 independent training runs; the paper did not report the agreement between the evaluator and human judgment.
- Attack data scale: 580 data points in the open-source experiments, and 500 per model in the OpenAI experiments; the paper did not report the specific model version used for OpenAI filtering, and the "self-auditing" mechanism is the authors' assumption.
- Commercial platforms: The real-world experiments covered only the OpenAI fine-tuning API.
Summarize the main content of the paper
Three-pronged black-box fine-tuning jailbreak: prefix-suffix wrapping plus keyword underscore replacement plus backdoor, bypassing a three-stage defense, with ASR above 95% on OpenAI.
A fine-tuning jailbreak attack paper, targeting the real defense setting of commercial black-box fine-tuning services.
- Problem: Existing fine-tuning attack studies use simplified settings—either violating the black-box setting, ignoring provider defenses, or harming model utility; the authors propose a threat model in which the attacker can only submit data and the provider deploys a three-stage defense of data filtering, defensive fine-tuning and post-training audit.
- Method: Three data augmentations are applied to 580 harmful question-answer pairs—safety-style prefix-suffix wrapping, iterative replacement of harmful keywords with four underscores by a proxy LLM (up to 5 rounds), and injection of backdoors with rare trigger words (mixing three types of samples)—so that the data passes filtering while the model learns trigger-conditioned harmful behavior.
- Open-source results: On Llama-2-7B-Chat, Gemma-1.1-7B-IT and Qwen2.5-7B-Instruct, bypassing Claude-sonnet-4 filtering and two defensive fine-tuning methods, ASR (w/ trigger) reaches up to 99.1% (Table 1), while without the trigger it is mostly about 1.5%; ARC/GSM8K utility is almost unchanged.
- Filtering and ablation: The method's leakage rate under three filtering models is 79.1%–93.2%, versus only 1.2%–2.4% for Direct-Harm (Table 2); fine-tuning on data with keyword replacement alone can push ASR (w/o trigger) to 81.8%–94.2% (Table 11).
- Real deployment: Fine-tuning GPT-4o/GPT-4.1 and their mini versions on the OpenAI platform yields ASR (w/ trigger) of 95.7%–99.5%, and no more than 2.3% without the trigger (Table 4); the authors speculate that the platform uses the target model itself to audit data (self-auditing), and describe this as a hypothesis.
- Authors' conclusion: The authors argue that a simple technique such as underscore replacement can weaken safety alignment, indicating that current alignment is not deep enough and defenses are mostly shallow, and that providers need stronger end-to-end defenses; future work will explore semantic-level risk detection.
Related papers
Show 3 more papers
- TRACEAnalysis / interpretabilityarXiv