Papers › Defending LLMs against Jailbreaking Attacks via Backtranslation

Defending LLMs against Jailbreaking Attacks via Backtranslation

26 Feb 2024arXiv:2402.16459archive 2025-07-28

Yihan Wang, Zhouxing Shi, Andrew Bai, Cho-Jui Hsieh

Although many large language models (LLMs) have been trained to refuse harmful requests, they are still vulnerable to jailbreaking attacks which rewrite the original prompt to conceal its harmful intent. In this paper, we propose a new method for defending LLMs against jailbreaking attacks by ``backtranslation''. Specifically, given an initial response generated by the target LLM from an input prompt, our backtranslation prompts a language model to infer an input prompt that can lead to the response. The inferred prompt is called the backtranslated prompt which tends to reveal the actual intent of the original prompt, since it is generated based on the LLM's response and not directly manipulated by the attacker. We then run the target LLM again on the backtranslated prompt, and we refuse the original prompt if the model refuses the backtranslated prompt. We explain that the proposed defense provides several benefits on its effectiveness and efficiency. We empirically demonstrate that our defense significantly outperforms the baselines, in the cases that are hard for the baselines, and our defense also has little impact on the generation quality for benign input prompts. Our implementation is based on our library for LLM jailbreaking defense algorithms at https://github.com/YihanWang617/llm-jailbreaking-defense, and the code for reproducing our experiments is available at https://github.com/YihanWang617/LLM-Jailbreaking-Defense-Backtranslation.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 16 code samples harvested from 2 repositories linked to this paper: 13 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 0 honoured, 0 violated, 9 with no contract checked; 4 where Syntology's instrument failed) · 3 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 16 samples from 2 repositories, 13 ran (9 with no instrument failure; 4 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

yihanwang617/llm-jailbreaking-defense officialmentioned in papermentioned on GitHubMITSyntology: 1 sample, 1 ran (1 instrument-failed) · 0 unverified report
yihanwang617/llm-jailbreaking-defense-backtranslation officialmentioned in papermentioned on GitHubBSD-3-ClauseSyntology: 15 samples, 12 ran (3 instrument-failed) · 3 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested: 13 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 0 honoured, 0 violated, 9 with no contract checked; 4 where Syntology's instrument failed) · 3 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

2ran · our draft was wrong
2ran; the contract check could not run
9ran
3unverified

Licence: 0 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity.

yihanwang617/llm-jailbreaking-defense official repository 1 sample, 1 ran (1 instrument-failed) · 0 unverified
load_tokenizer in 66 papers llm_jailbreaking_defense/models.py ran · our draft was wrong MIT (permissive) · ee5d16865ecd5e2b · report fixture: signature model_path:str/0/str · returned Mock · level recorded 2026-09-24
yihanwang617/llm-jailbreaking-defense-backtranslation official repository 15 samples, 12 ran (3 instrument-failed) · 3 unverified
extract_json in 35 papers PAIR/common.py ran · our draft was wrong fingerprinted BSD-3-Clause (permissive) · d7a1e728e5b74d3f · report fixture: signature s:str/0/str · returned tuple · level recorded 2026-09-24
get_attacker_system_prompt PAIR/system_prompts.py ran fingerprinted BSD-3-Clause (permissive) · 41afa37a7f32ead4 · report fixture: signature goal:str/0/str, target_str:str/0/str · returned str · level recorded 2026-09-24
get_embedding_layer in 12 papers GCG/llm_attacks/base/attack_manager.py ran; the contract check could not run (RAISES) BSD-3-Clause (permissive) · 0bf2136a7171ae80 · report fixture: signature model:callable/0/? · returned Embedding · level recorded 2026-09-26
get_init_msg in 7 papers PAIR/common.py ran fingerprinted BSD-3-Clause (permissive) · e5d6b48c8179a8d3 · report fixture: signature goal:str/0/str, target:str/0/str · returned str · level recorded 2026-09-24
get_judge_system_prompt in 6 papers PAIR/system_prompts.py ran fingerprinted BSD-3-Clause (permissive) · 581e46fff7eed12a · report fixture: signature goal:str/0/str, target_str:str/0/str · returned str · level recorded 2026-09-24
get_parser in 22 papers arguments.py ran BSD-3-Clause (permissive) · 99b925af061ea18f · report fixture: signature target_model:bool/0/bool, defense:bool/0/bool, judge:bool/0/bool · returned ArgumentParser · level recorded 2026-09-24
get_recursive_key utils.py ran BSD-3-Clause (permissive) · 5de204a83268b25b · report fixture: signature obj:dict/0/?, key:str/0/str, delim:str/0/str · returned str · level recorded 2026-09-24
load_model_and_tokenizer in 61 papers attacks/autodan.py ran BSD-3-Clause (permissive) · 3bcc8e42ea5e457e · report fixture: signature model_path:str/0/str, tokenizer_path:NoneType/0/?, device:str/0/str · returned tuple · level recorded 2026-09-24
load_prompts in 41 papers utils.py ran BSD-3-Clause (permissive) · 37cddda277e8045d · report fixture: signature input_path:str/0/str, num_examples:int/0/int, offset:int/0/int · returned list · level recorded 2026-09-24
parse_args in 355 papers arguments.py ran BSD-3-Clause (permissive) · 15642ad4bb2fccb7 · report fixture: signature target_model:bool/0/bool, defense:bool/0/bool, judge:bool/0/bool · returned Namespace · level recorded 2026-09-24
process_target_response in 6 papers PAIR/common.py ran BSD-3-Clause (permissive) · 9fdfb4537f5fd761 · report fixture: signature target_response:str/0/str, score:float/0/float, goal:str/0/str, target_str:str/0/str · returned str · level recorded 2026-09-24
roulette_wheel_selection attacks/autodan.py ran; the contract check could not run (RAISES) · metamorphic tier: deterministic fingerprinted BSD-3-Clause (permissive) · 1fe7dbe6f5cc4593 · report fixture: signature data_list:list/1/str, score_list:ndarray/1/float, num_selected:int/0/int, if_softmax:bool/0/bool · returned list · level recorded 2026-09-22
autodan_sample_control attacks/autodan.py unverified BSD-3-Clause (permissive) · 6c4da698c1f967dc · report
get_embedding_matrix in 16 papers GCG/llm_attacks/base/attack_manager.py unverified BSD-3-Clause (permissive) · 688aaeba506e3329 · report
get_embeddings in 56 papers GCG/llm_attacks/base/attack_manager.py unverified BSD-3-Clause (permissive) · f556dda0785f3c77 · report

Tasks

Language Modelling

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections