{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/advprompter-fast-adaptive-adversarial","title":"AdvPrompter: Fast Adaptive Adversarial Prompting for LLMs","arxiv_id":"2404.16873","date":"2024-04-21","proceeding":null,"authors":["Anselm Paulus","Arman Zharmagambetov","Chuan Guo","Brandon Amos","Yuandong Tian"],"abstract":"Large Language Models (LLMs) are vulnerable to jailbreaking attacks that lead to generation of inappropriate or harmful content. Manual red-teaming requires a time-consuming search for adversarial prompts, whereas automatic adversarial prompt generation often leads to semantically meaningless attacks that do not scale well. In this paper, we present a novel method that uses another LLM, called AdvPrompter, to generate human-readable adversarial prompts in seconds. AdvPrompter, which is trained using an alternating optimization algorithm, generates suffixes that veil the input instruction without changing its meaning, such that the TargetLLM is lured to give a harmful response. Experimental results on popular open source TargetLLMs show highly competitive results on the AdvBench and HarmBench datasets, that also transfer to closed-source black-box LLMs. We also show that training on adversarial suffixes generated by AdvPrompter is a promising strategy for improving the robustness of LLMs to jailbreaking attacks.","url_abs":"https://arxiv.org/abs/2404.16873v2","url_pdf":"https://arxiv.org/pdf/2404.16873v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"advprompter-fast-adaptive-adversarial","repo_url":"https://github.com/facebookresearch/advprompter","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"mmlu","task_name":"MMLU"},{"task_slug":"red-teaming","task_name":"Red Teaming"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.16873","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.16873"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/advprompter","reach":null}],"summary":{"ran":1,"unverified":6},"by_repo_kind":{"official":{"samples":7,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":7,"samples":[{"code_sha256_prefix":"045bc6abe29139a1","entry":"Seq","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"045bc6abe29139a1"}},{"code_sha256_prefix":"6a4069f197dae45b","entry":"MergedSeq","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"6a4069f197dae45b"}},{"code_sha256_prefix":"b56a5931afe451cc","entry":"advPrompterOpt","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"b56a5931afe451cc"}},{"code_sha256_prefix":"49565deb011f1948","entry":"evaluate_next_token_candidates","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"49565deb011f1948"}},{"code_sha256_prefix":"6754ba23d3f0932a","entry":"get_next_token_probabilities","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"6754ba23d3f0932a"}},{"code_sha256_prefix":"e25102f1e515dac5","entry":"select_and_evaluate_next_token_candidates","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"e25102f1e515dac5"}},{"code_sha256_prefix":"2e6637097fc82df7","entry":"select_next_beams","repo":"facebookresearch/advprompter","repo_kind":"official","path":"advprompteropt.py","file_url":"https://github.com/facebookresearch/advprompter/blob/HEAD/advprompteropt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"2e6637097fc82df7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}