{"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/chain-of-attack-a-semantic-driven-contextual","title":"Chain of Attack: a Semantic-Driven Contextual Multi-Turn attacker for LLM","arxiv_id":"2405.05610","date":"2024-05-09","proceeding":null,"authors":["Xikang Yang","Xuehai Tang","Songlin Hu","Jizhong Han"],"abstract":"Large language models (LLMs) have achieved remarkable performance in various natural language processing tasks, especially in dialogue systems. However, LLM may also pose security and moral threats, especially in multi round conversations where large models are more easily guided by contextual content, resulting in harmful or biased responses. In this paper, we present a novel method to attack LLMs in multi-turn dialogues, called CoA (Chain of Attack). CoA is a semantic-driven contextual multi-turn attack method that adaptively adjusts the attack policy through contextual feedback and semantic relevance during multi-turn of dialogue with a large model, resulting in the model producing unreasonable or harmful content. We evaluate CoA on different LLMs and datasets, and show that it can effectively expose the vulnerabilities of LLMs, and outperform existing attack methods. Our work provides a new perspective and tool for attacking and defending LLMs, and contributes to the security and ethical assessment of dialogue systems.","url_abs":"https://arxiv.org/abs/2405.05610v1","url_pdf":"https://arxiv.org/pdf/2405.05610v1.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":"chain-of-attack-a-semantic-driven-contextual","repo_url":"https://github.com/yancykahn/coa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.05610","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.05610"}},"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/yancykahn/coa","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"unverified":1},"by_repo_kind":{"official":{"samples":5,"ran":4,"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":"9f289a28c6cc9b87","entry":"extract_json","repo":"yancykahn/coa","repo_kind":"official","path":"common.py","file_url":"https://github.com/yancykahn/coa/blob/HEAD/common.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9f289a28c6cc9b87"}},{"code_sha256_prefix":"1eae2b743598796a","entry":"extract_json_for_mr_init_chain","repo":"yancykahn/coa","repo_kind":"official","path":"common.py","file_url":"https://github.com/yancykahn/coa/blob/HEAD/common.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1eae2b743598796a"}},{"code_sha256_prefix":"d24468b73abe808d","entry":"get_init_msg_for_mr_init_chain","repo":"yancykahn/coa","repo_kind":"official","path":"common.py","file_url":"https://github.com/yancykahn/coa/blob/HEAD/common.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d24468b73abe808d"}},{"code_sha256_prefix":"69fa03ca0e979f37","entry":"get_model_path_and_template","repo":"yancykahn/coa","repo_kind":"official","path":"conversers.py","file_url":"https://github.com/yancykahn/coa/blob/HEAD/conversers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"69fa03ca0e979f37"}},{"code_sha256_prefix":"a3de8d698da5eedb","entry":"get_data","repo":"yancykahn/coa","repo_kind":"official","path":"experiment.py","file_url":"https://github.com/yancykahn/coa/blob/HEAD/experiment.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":"a3de8d698da5eedb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}