{"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/x-boundary-establishing-exact-safety-boundary","title":"X-Boundary: Establishing Exact Safety Boundary to Shield LLMs from Multi-Turn Jailbreaks without Compromising Usability","arxiv_id":"2502.09990","date":"2025-02-14","proceeding":null,"authors":["Xiaoya Lu","Dongrui Liu","Yi Yu","Luxin Xu","Jing Shao"],"abstract":"Despite the rapid development of safety alignment techniques for LLMs, defending against multi-turn jailbreaks is still a challenging task. In this paper, we conduct a comprehensive comparison, revealing that some existing defense methods can improve the robustness of LLMs against multi-turn jailbreaks but compromise usability, i.e., reducing general capabilities or causing the over-refusal problem. From the perspective of mechanism interpretability of LLMs, we discover that these methods fail to establish a boundary that exactly distinguishes safe and harmful feature representations. Therefore, boundary-safe representations close to harmful representations are inevitably disrupted, leading to a decline in usability. To address this issue, we propose X-Boundary to push harmful representations away from boundary-safe representations and obtain an exact distinction boundary. In this way, harmful representations can be precisely erased without disrupting safe ones. Experimental results show that X-Boundary achieves state-of-the-art defense performance against multi-turn jailbreaks, while reducing the over-refusal rate by about 20% and maintaining nearly complete general capability. Furthermore, we theoretically prove and empirically verify that X-Boundary can accelerate the convergence process during training. Please see our code at: https://github.com/AI45Lab/X-Boundary.","url_abs":"https://arxiv.org/abs/2502.09990v2","url_pdf":"https://arxiv.org/pdf/2502.09990v2.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":"x-boundary-establishing-exact-safety-boundary","repo_url":"https://github.com/ai45lab/x-boundary","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"safety-alignment","task_name":"Safety Alignment"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2502.09990","atlas_url":"https://app.syntology.ai/?focus=2502.09990","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.09990"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/ai45lab/x-boundary","reach":{"status":"ok"}}],"summary":{"ran_honours":1,"ran_draft_wrong":4},"by_repo_kind":{"official":{"samples":5,"ran":5,"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":5,"samples":[{"code_sha256_prefix":"3b4dad61f81d233f","entry":"calculate_ppl","repo":"ai45lab/x-boundary","repo_kind":"official","path":"R1_X_Boundary_demo.py","file_url":"https://github.com/ai45lab/x-boundary/blob/HEAD/R1_X_Boundary_demo.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3b4dad61f81d233f"}},{"code_sha256_prefix":"d11d2248331f1c58","entry":"compute_loss","repo":"ai45lab/x-boundary","repo_kind":"official","path":"src/lorra_x_boundary.py","file_url":"https://github.com/ai45lab/x-boundary/blob/HEAD/src/lorra_x_boundary.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d11d2248331f1c58"}},{"code_sha256_prefix":"4f90eab861fd28a1","entry":"find_repeated_substring","repo":"ai45lab/x-boundary","repo_kind":"official","path":"R1_X_Boundary_demo.py","file_url":"https://github.com/ai45lab/x-boundary/blob/HEAD/R1_X_Boundary_demo.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4f90eab861fd28a1"}},{"code_sha256_prefix":"7706fd59e4302905","entry":"get_peft_state_maybe_zero_3","repo":"ai45lab/x-boundary","repo_kind":"official","path":"src/lorra_x_boundary.py","file_url":"https://github.com/ai45lab/x-boundary/blob/HEAD/src/lorra_x_boundary.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7706fd59e4302905"}},{"code_sha256_prefix":"16f29eca39ef4fff","entry":"maybe_zero_3","repo":"ai45lab/x-boundary","repo_kind":"official","path":"src/lorra_x_boundary.py","file_url":"https://github.com/ai45lab/x-boundary/blob/HEAD/src/lorra_x_boundary.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"16f29eca39ef4fff"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}