{"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/arxiv-2602-02600","title":"Step-Wise Refusal Dynamics in Autoregressive and Diffusion Language Models","arxiv_id":"2602.02600","date":"2026-02-01","proceeding":null,"authors":["Eliron Rahimi","Elad Hirshel","Rom Himelstein","Amit LeVi","Avi Mendelson","Chaim Baskin"],"abstract":"Diffusion language models (DLMs) have recently emerged as a competitive alternative to autoregressive (AR) models, offering parallel decoding, competitive generation quality, and initial evidence of improved jailbreak robustness. Despite this progress, the role of sampling mechanisms in shaping refusal behavior remains poorly understood. To address this gap, we present a comprehensive study of step-wise refusal dynamics. We show that diffusion remasking can promote recovery from harmful intermediate generations, provide evidence that this behavior is tied to the sampling mechanism, and demonstrate that switching from AR to diffusion sampling improves jailbreak robustness, including under fixed model weights. To capture generation dynamics not observable at the text level, we propose the Step-Wise Refusal Internal Dynamics (SRI) signal. Consistent with our text-level findings, SRI shows that recovery fails primarily under AR sampling, with these failures often appearing anomalous relative to harmless generations in the SRI space. Based on this observation, we show that SRI enables a simple jailbreak detector that does not modify inference and generalizes to unseen attacks by training only on benign SRI signals. Our evaluation shows that this detector matches or outperforms existing jailbreak detection baselines while adding negligible overhead.","url_abs":"https://arxiv.org/abs/2602.02600","url_pdf":"https://arxiv.org/pdf/2602.02600","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2602.02600","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2602.02600"}},"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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/ZichenWen1/DIJA","reach":{"status":"ok","spdx":"Apache-2.0"}},{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/shuita2333/PAD-codes","reach":null},{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/niez233/DiffuGuard","reach":null}],"summary":{"ran_draft_wrong":7,"ran":8,"ran_fixture":1,"unverified":10},"by_repo_kind":{"found_in_text":{"samples":25,"ran":15,"repositories":3}},"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":24,"samples":[{"code_sha256_prefix":"b5472673332de78e","entry":"log","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"b5472673332de78e"}},{"code_sha256_prefix":"c3a6b977022957cb","entry":"Normalize","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/common_modules.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/common_modules.py","link_basis":"harvester_set","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":"c3a6b977022957cb"}},{"code_sha256_prefix":"1495eea6ced11dfa","entry":"add_gumbel_noise","repo":"niez233/DiffuGuard","repo_kind":"found_in_text","path":"utility/generate_function.py","file_url":"https://github.com/niez233/DiffuGuard/blob/HEAD/utility/generate_function.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1495eea6ced11dfa"}},{"code_sha256_prefix":"1f6ae43d06c76ba5","entry":"broadcast","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/misc.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/misc.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1f6ae43d06c76ba5"}},{"code_sha256_prefix":"f9abf6d74699cc1c","entry":"causal_attention_bias","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/modeling_llada.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/modeling_llada.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f9abf6d74699cc1c"}},{"code_sha256_prefix":"988a5f5b97b3ed17","entry":"forward_process","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/get_log_likelihood.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/get_log_likelihood.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"988a5f5b97b3ed17"}},{"code_sha256_prefix":"195f48aece3499e6","entry":"generate","repo":"niez233/DiffuGuard","repo_kind":"found_in_text","path":"utility/generate_function.py","file_url":"https://github.com/niez233/DiffuGuard/blob/HEAD/utility/generate_function.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"195f48aece3499e6"}},{"code_sha256_prefix":"a8366f238618edad","entry":"get_constant_schedule","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/lr_schedulers.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/lr_schedulers.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a8366f238618edad"}},{"code_sha256_prefix":"11f07821d1b2286b","entry":"get_constant_schedule_with_warmup","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/lr_schedulers.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/lr_schedulers.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11f07821d1b2286b"}},{"code_sha256_prefix":"1975e0c51e6f5753","entry":"get_linear_schedule_with_warmup","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/lr_schedulers.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/lr_schedulers.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1975e0c51e6f5753"}},{"code_sha256_prefix":"39c9954d6f0c856e","entry":"get_log_likelihood","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/get_log_likelihood.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/get_log_likelihood.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"39c9954d6f0c856e"}},{"code_sha256_prefix":"53202c68f703b2ab","entry":"gumbel_noise","repo":"ZichenWen1/DIJA","repo_kind":"found_in_text","path":"MMaDA/models/sampling.py","file_url":"https://github.com/ZichenWen1/DIJA/blob/HEAD/MMaDA/models/sampling.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"53202c68f703b2ab"}},{"code_sha256_prefix":"54486de625187d2a","entry":"gumbel_sample","repo":"ZichenWen1/DIJA","repo_kind":"found_in_text","path":"MMaDA/models/sampling.py","file_url":"https://github.com/ZichenWen1/DIJA/blob/HEAD/MMaDA/models/sampling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"54486de625187d2a"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/common_modules.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/common_modules.py","link_basis":"harvester_set","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":"3137073275f8c21a"}},{"code_sha256_prefix":"0e7f77d6003e2412","entry":"parse_structured","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/misc.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/misc.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0e7f77d6003e2412"}},{"code_sha256_prefix":"2d82abbef2c4addb","entry":"unpack_time","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/common_modules.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/common_modules.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2d82abbef2c4addb"}},{"code_sha256_prefix":"72a32148829c38b2","entry":"add_gumbel_noise","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/generate-PAD.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/generate-PAD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"72a32148829c38b2"}},{"code_sha256_prefix":"615ec9b280bef7c6","entry":"add_gumbel_noise","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/modeling_mmada.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/modeling_mmada.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"615ec9b280bef7c6"}},{"code_sha256_prefix":"3e3a6bc56d604874","entry":"generate","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/generate-PAD.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/generate-PAD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3e3a6bc56d604874"}},{"code_sha256_prefix":"afd61e748d6c23ce","entry":"generate","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/generate-PAD.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/generate-PAD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"afd61e748d6c23ce"}},{"code_sha256_prefix":"376bf22d5737fc2a","entry":"get_logger","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/logging.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/logging.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"376bf22d5737fc2a"}},{"code_sha256_prefix":"bc58c88b365ae743","entry":"get_logits","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/get_log_likelihood.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/get_log_likelihood.py","link_basis":"plan_row","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bc58c88b365ae743"}},{"code_sha256_prefix":"b7cee2ce433da95c","entry":"get_num_transfer_tokens","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"LLaDA-PAD/generate-PAD.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/LLaDA-PAD/generate-PAD.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b7cee2ce433da95c"}},{"code_sha256_prefix":"65934529afeabeff","entry":"get_num_transfer_tokens","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/modeling_mmada.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/modeling_mmada.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"65934529afeabeff"}},{"code_sha256_prefix":"3e268fcaaf4273fe","entry":"get_parameter_device","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/modeling_utils.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/modeling_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3e268fcaaf4273fe"}},{"code_sha256_prefix":"33338f20f5619c59","entry":"get_parameter_dtype","repo":"shuita2333/PAD-codes","repo_kind":"found_in_text","path":"MMaDA-PAD/models/modeling_utils.py","file_url":"https://github.com/shuita2333/PAD-codes/blob/HEAD/MMaDA-PAD/models/modeling_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"33338f20f5619c59"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":{"kind":"leaderboard_placements","source":"Syntology's leaderboard-shaped extractor over the paper's own arXiv-HTML tables: a model pointed at a cell, the number was read from that cell and checked against the board's metric, dataset, split and scale, and an independent check accepted the entry; not reviewed by the paper's authors or the archive's editors","extractor_model":"global.anthropic.claude-sonnet-4-5-20250929-v1:0","verifier_model":null,"prompt_sha":"fa63d4bb9d755694","coverage":{"sentence":"Syntology has checked 6,264 of the 9,581 papers on this site that are newer than the archive; results from the others appear after they are checked.","papers_newer_than_archive":9581,"papers_checked":6264},"entries":[],"not_placed":{"boards":0,"rejected_by_independent_check":0,"refused_by_a_rule":0,"check_did_not_answer":0,"proposed_without_a_cell":0,"declined_by_site":0}}}