{"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/accelerating-greedy-coordinate-gradient-via","title":"Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe Sampling","arxiv_id":"2403.01251","date":"2024-03-02","proceeding":null,"authors":["Yiran Zhao","Wenyue Zheng","Tianle Cai","Xuan Long Do","Kenji Kawaguchi","Anirudh Goyal","Michael Shieh"],"abstract":"Safety of Large Language Models (LLMs) has become a critical issue given their rapid progresses. Greedy Coordinate Gradient (GCG) is shown to be effective in constructing adversarial prompts to break the aligned LLMs, but optimization of GCG is time-consuming. To reduce the time cost of GCG and enable more comprehensive studies of LLM safety, in this work, we study a new algorithm called $\\texttt{Probe sampling}$. At the core of the algorithm is a mechanism that dynamically determines how similar a smaller draft model's predictions are to the target model's predictions for prompt candidates. When the target model is similar to the draft model, we rely heavily on the draft model to filter out a large number of potential prompt candidates. Probe sampling achieves up to $5.6$ times speedup using Llama2-7b-chat and leads to equal or improved attack success rate (ASR) on the AdvBench. Furthermore, probe sampling is also able to accelerate other prompt optimization techniques and adversarial methods, leading to acceleration of $1.8\\times$ for AutoPrompt, $2.4\\times$ for APE and $2.4\\times$ for AutoDAN.","url_abs":"https://arxiv.org/abs/2403.01251v3","url_pdf":"https://arxiv.org/pdf/2403.01251v3.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":"accelerating-greedy-coordinate-gradient-via","repo_url":"https://github.com/zhaoyiran924/probe-sampling","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"accelerating-greedy-coordinate-gradient-via","repo_url":"https://github.com/grayswanai/nanogcg","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.01251","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.01251"}},"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/grayswanai/nanogcg","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhaoyiran924/probe-sampling","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":5,"ran":0,"repositories":1},"listed":{"samples":1,"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":0,"samples":[{"code_sha256_prefix":"56640da5aa960a42","entry":"sample_ids_from_grad","repo":"grayswanai/nanogcg","repo_kind":"listed","path":"nanogcg/gcg.py","file_url":"https://github.com/grayswanai/nanogcg/blob/HEAD/nanogcg/gcg.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"56640da5aa960a42"}},{"code_sha256_prefix":"16d7b655a5002ab4","entry":"get_embedding_layer","repo":"zhaoyiran924/probe-sampling","repo_kind":"official","path":"llm_attacks/base/attack_manager.py","file_url":"https://github.com/zhaoyiran924/probe-sampling/blob/HEAD/llm_attacks/base/attack_manager.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"16d7b655a5002ab4"}},{"code_sha256_prefix":"4c1661dc05e88ceb","entry":"get_embedding_matrix","repo":"zhaoyiran924/probe-sampling","repo_kind":"official","path":"llm_attacks/base/attack_manager.py","file_url":"https://github.com/zhaoyiran924/probe-sampling/blob/HEAD/llm_attacks/base/attack_manager.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4c1661dc05e88ceb"}},{"code_sha256_prefix":"db2b1708ea3c49ed","entry":"get_embeddings","repo":"zhaoyiran924/probe-sampling","repo_kind":"official","path":"llm_attacks/base/attack_manager.py","file_url":"https://github.com/zhaoyiran924/probe-sampling/blob/HEAD/llm_attacks/base/attack_manager.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"db2b1708ea3c49ed"}},{"code_sha256_prefix":"25ae440509f39ec5","entry":"get_filtered_cands","repo":"zhaoyiran924/probe-sampling","repo_kind":"official","path":"llm_attacks/minimal_gcg/opt_utils.py","file_url":"https://github.com/zhaoyiran924/probe-sampling/blob/HEAD/llm_attacks/minimal_gcg/opt_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"25ae440509f39ec5"}},{"code_sha256_prefix":"94d7ddaf0169dbf1","entry":"sample_control","repo":"zhaoyiran924/probe-sampling","repo_kind":"official","path":"llm_attacks/minimal_gcg/opt_utils.py","file_url":"https://github.com/zhaoyiran924/probe-sampling/blob/HEAD/llm_attacks/minimal_gcg/opt_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"94d7ddaf0169dbf1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}