{"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/direct-inversion-boosting-diffusion-based","title":"Direct Inversion: Boosting Diffusion-based Editing with 3 Lines of Code","arxiv_id":"2310.01506","date":"2023-10-02","proceeding":null,"authors":["Xuan Ju","Ailing Zeng","Yuxuan Bian","Shaoteng Liu","Qiang Xu"],"abstract":"Text-guided diffusion models have revolutionized image generation and editing, offering exceptional realism and diversity. Specifically, in the context of diffusion-based editing, where a source image is edited according to a target prompt, the process commences by acquiring a noisy latent vector corresponding to the source image via the diffusion model. This vector is subsequently fed into separate source and target diffusion branches for editing. The accuracy of this inversion process significantly impacts the final editing outcome, influencing both essential content preservation of the source image and edit fidelity according to the target prompt. Prior inversion techniques aimed at finding a unified solution in both the source and target diffusion branches. However, our theoretical and empirical analyses reveal that disentangling these branches leads to a distinct separation of responsibilities for preserving essential content and ensuring edit fidelity. Building on this insight, we introduce \"Direct Inversion,\" a novel technique achieving optimal performance of both branches with just three lines of code. To assess image editing performance, we present PIE-Bench, an editing benchmark with 700 images showcasing diverse scenes and editing types, accompanied by versatile annotations and comprehensive evaluation metrics. Compared to state-of-the-art optimization-based inversion techniques, our solution not only yields superior performance across 8 editing methods but also achieves nearly an order of speed-up.","url_abs":"https://arxiv.org/abs/2310.01506v2","url_pdf":"https://arxiv.org/pdf/2310.01506v2.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":"direct-inversion-boosting-diffusion-based","repo_url":"https://github.com/cure-lab/directinversion","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"direct-inversion-boosting-diffusion-based","repo_url":"https://github.com/cure-lab/pnpinversion","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"direct-inversion-boosting-diffusion-based","repo_url":"https://github.com/thu-cvml/texturediffusion","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"text-based-image-editing","task_name":"Text-based Image Editing"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[{"slug":"pie-bench","name":"PIE-Bench","full_name":"Prompt-based Image Editing Benchmark"}],"methods_introduced":[],"results":[{"leaderboard":"/sota/text-based-image-editing-on-pie-bench","task":"Text-based Image Editing","dataset":"PIE-Bench","model":"Direct Inversion+Prompt-to-Prompt","rank_in_archive_order":5,"of":18,"metrics":{"Background LPIPS":"54.55","Background PSNR":"27.22","CLIPSIM":"25.02","Structure Distance":"11.65"},"uses_additional_data":false},{"leaderboard":"/sota/text-based-image-editing-on-pie-bench","task":"Text-based Image Editing","dataset":"PIE-Bench","model":"Direct Inversion+MasaCtrl","rank_in_archive_order":11,"of":18,"metrics":{"Background LPIPS":"87.94","Background PSNR":"22.64","CLIPSIM":"24.38","Structure Distance":"24.70"},"uses_additional_data":false},{"leaderboard":"/sota/text-based-image-editing-on-pie-bench","task":"Text-based Image Editing","dataset":"PIE-Bench","model":"Direct Inversion+Plug-and-Play","rank_in_archive_order":12,"of":18,"metrics":{"Background LPIPS":"106.06","Background PSNR":"22.46","CLIPSIM":"25.41","Structure Distance":"24.29"},"uses_additional_data":false},{"leaderboard":"/sota/text-based-image-editing-on-pie-bench","task":"Text-based Image Editing","dataset":"PIE-Bench","model":"Direct Inversion+Pix2Pix-Zero","rank_in_archive_order":15,"of":18,"metrics":{"Background LPIPS":"138.98","Background PSNR":"21.53","CLIPSIM":"23.31","Structure Distance":"49.22"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2310.01506","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.01506"}},"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/cure-lab/pnpinversion","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cure-lab/directinversion","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thu-cvml/texturediffusion","reach":null}],"summary":{"ran_draft_wrong":2,"ran":2,"unverified":2},"by_repo_kind":{"official":{"samples":5,"ran":3,"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":6,"samples":[{"code_sha256_prefix":"0063341ea11f0fa7","entry":"get_timesteps","repo":"cure-lab/directinversion","repo_kind":"official","path":"run_editing_pnp.py","file_url":"https://github.com/cure-lab/directinversion/blob/HEAD/run_editing_pnp.py","link_basis":"plan_row","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":"0063341ea11f0fa7"}},{"code_sha256_prefix":"c69cb26ca34bb66d","entry":"load_sentence_embeddings","repo":"cure-lab/directinversion","repo_kind":"official","path":"run_editing_pix2pix_zero.py","file_url":"https://github.com/cure-lab/directinversion/blob/HEAD/run_editing_pix2pix_zero.py","link_basis":"first_harvest_node","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":"c69cb26ca34bb66d"}},{"code_sha256_prefix":"4a99ee9df51b6405","entry":"mask_decode","repo":"cure-lab/directinversion","repo_kind":"official","path":"run_editing_blended_latent_diffusion.py","file_url":"https://github.com/cure-lab/directinversion/blob/HEAD/run_editing_blended_latent_diffusion.py","link_basis":"first_harvest_node","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":"4a99ee9df51b6405"}},{"code_sha256_prefix":"681ba13122660baf","entry":"read_content","repo":"cure-lab/pnpinversion","repo_kind":"listed","path":"models/InstructDiffusion/edit_app.py","file_url":"https://github.com/cure-lab/pnpinversion/blob/HEAD/models/InstructDiffusion/edit_app.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":"681ba13122660baf"}},{"code_sha256_prefix":"79d9960693d3111d","entry":"load_image","repo":"cure-lab/directinversion","repo_kind":"official","path":"run_editing_masactrl.py","file_url":"https://github.com/cure-lab/directinversion/blob/HEAD/run_editing_masactrl.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":"79d9960693d3111d"}},{"code_sha256_prefix":"b062f0374b634db9","entry":"mask_decode","repo":"cure-lab/directinversion","repo_kind":"official","path":"run_editing_edict.py","file_url":"https://github.com/cure-lab/directinversion/blob/HEAD/run_editing_edict.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":"b062f0374b634db9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}