{"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/diffusionfake-enhancing-generalization-in","title":"DiffusionFake: Enhancing Generalization in Deepfake Detection via Guided Stable Diffusion","arxiv_id":"2410.04372","date":"2024-10-06","proceeding":null,"authors":["Ke Sun","Shen Chen","Taiping Yao","Hong Liu","Xiaoshuai Sun","Shouhong Ding","Rongrong Ji"],"abstract":"The rapid progress of Deepfake technology has made face swapping highly realistic, raising concerns about the malicious use of fabricated facial content. Existing methods often struggle to generalize to unseen domains due to the diverse nature of facial manipulations. In this paper, we revisit the generation process and identify a universal principle: Deepfake images inherently contain information from both source and target identities, while genuine faces maintain a consistent identity. Building upon this insight, we introduce DiffusionFake, a novel plug-and-play framework that reverses the generative process of face forgeries to enhance the generalization of detection models. DiffusionFake achieves this by injecting the features extracted by the detection model into a frozen pre-trained Stable Diffusion model, compelling it to reconstruct the corresponding target and source images. This guided reconstruction process constrains the detection network to capture the source and target related features to facilitate the reconstruction, thereby learning rich and disentangled representations that are more resilient to unseen forgeries. Extensive experiments demonstrate that DiffusionFake significantly improves cross-domain generalization of various detector architectures without introducing additional parameters during inference. Our Codes are available in https://github.com/skJack/DiffusionFake.git.","url_abs":"https://arxiv.org/abs/2410.04372v1","url_pdf":"https://arxiv.org/pdf/2410.04372v1.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":"diffusionfake-enhancing-generalization-in","repo_url":"https://github.com/skjack/diffusionfake","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"deepfake-detection","task_name":"DeepFake Detection"},{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"face-swapping","task_name":"Face Swapping"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.04372","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.04372"}},"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":"deterministic:regex_extraction","url":"https://github.com/skJack/DiffusionFake","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/skjack/diffusionfake","reach":{"status":"ok"}}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":2},"by_repo_kind":{"official":{"samples":4,"ran":2,"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":4,"samples":[{"code_sha256_prefix":"11f99232927de192","entry":"compare_vectors","repo":"skJack/DiffusionFake","repo_kind":"official","path":"generate_weight.py","file_url":"https://github.com/skJack/DiffusionFake/blob/HEAD/generate_weight.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":"11f99232927de192"}},{"code_sha256_prefix":"0dbf855dab1ab575","entry":"get_node_name","repo":"skJack/DiffusionFake","repo_kind":"official","path":"tool_add_control.py","file_url":"https://github.com/skJack/DiffusionFake/blob/HEAD/tool_add_control.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":"0dbf855dab1ab575"}},{"code_sha256_prefix":"cfc17707f35e7ec4","entry":"get_state_dict","repo":"skJack/DiffusionFake","repo_kind":"official","path":"cldm/model.py","file_url":"https://github.com/skJack/DiffusionFake/blob/HEAD/cldm/model.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":"cfc17707f35e7ec4"}},{"code_sha256_prefix":"df733a879693145d","entry":"load_state_dict","repo":"skJack/DiffusionFake","repo_kind":"official","path":"cldm/model.py","file_url":"https://github.com/skJack/DiffusionFake/blob/HEAD/cldm/model.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":"df733a879693145d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}