{"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/rewriting-a-deep-generative-model","title":"Rewriting a Deep Generative Model","arxiv_id":"2007.15646","date":"2020-07-30","proceeding":"ECCV 2020 8","authors":["David Bau","Steven Liu","Tongzhou Wang","Jun-Yan Zhu","Antonio Torralba"],"abstract":"A deep generative model such as a GAN learns to model a rich set of semantic and physical rules about the target distribution, but up to now, it has been obscure how such rules are encoded in the network, or how a rule could be changed. In this paper, we introduce a new problem setting: manipulation of specific rules encoded by a deep generative model. To address the problem, we propose a formulation in which the desired rule is changed by manipulating a layer of a deep network as a linear associative memory. We derive an algorithm for modifying one entry of the associative memory, and we demonstrate that several interesting structural rules can be located and modified within the layers of state-of-the-art generative models. We present a user interface to enable users to interactively change the rules of a generative model to achieve desired effects, and we show several proof-of-concept applications. Finally, results on multiple datasets demonstrate the advantage of our method against standard fine-tuning methods and edit transfer algorithms.","url_abs":"https://arxiv.org/abs/2007.15646v1","url_pdf":"https://arxiv.org/pdf/2007.15646v1.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":"rewriting-a-deep-generative-model","repo_url":"https://github.com/davidbau/rewriting","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"rewriting-a-deep-generative-model","repo_url":"https://github.com/PeterWang512/GANSketching","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"rewriting-a-deep-generative-model","repo_url":"https://github.com/revsic/Rewriting-A-Deep-Generative-Models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"model","task_name":"model"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2007.15646","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2007.15646"}},"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/revsic/Rewriting-A-Deep-Generative-Models","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PeterWang512/GANSketching","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/davidbau/rewriting","reach":null}],"summary":{"ran_honours":4,"ran_violates":1,"ran_draft_wrong":3,"ran_fixture":2,"unverified":13},"by_repo_kind":{"official":{"samples":4,"ran":4,"repositories":1},"listed":{"samples":19,"ran":6,"repositories":2}},"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":"e6e2771a0de59277","entry":"apply_ablation_replacement","repo":"revsic/Rewriting-A-Deep-Generative-Models","repo_kind":"listed","path":"utils/nethook.py","file_url":"https://github.com/revsic/Rewriting-A-Deep-Generative-Models/blob/HEAD/utils/nethook.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e6e2771a0de59277"}},{"code_sha256_prefix":"7ad7dc9cfae49b02","entry":"centered_location","repo":"davidbau/rewriting","repo_kind":"official","path":"rewrite/ganrewrite.py","file_url":"https://github.com/davidbau/rewriting/blob/HEAD/rewrite/ganrewrite.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7ad7dc9cfae49b02"}},{"code_sha256_prefix":"0c45399f3741921e","entry":"lerp","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"eval/ppl.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/eval/ppl.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0c45399f3741921e"}},{"code_sha256_prefix":"9ea2d5da223e8492","entry":"make_kernel","repo":"davidbau/rewriting","repo_kind":"official","path":"utils/stylegan2/models.py","file_url":"https://github.com/davidbau/rewriting/blob/HEAD/utils/stylegan2/models.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9ea2d5da223e8492"}},{"code_sha256_prefix":"0a92af765d5132e3","entry":"make_matching_tensor","repo":"revsic/Rewriting-A-Deep-Generative-Models","repo_kind":"listed","path":"utils/nethook.py","file_url":"https://github.com/revsic/Rewriting-A-Deep-Generative-Models/blob/HEAD/utils/nethook.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0a92af765d5132e3"}},{"code_sha256_prefix":"36f9b37b3b5c5296","entry":"paste_clip_at_center","repo":"davidbau/rewriting","repo_kind":"official","path":"rewrite/ganrewrite.py","file_url":"https://github.com/davidbau/rewriting/blob/HEAD/rewrite/ganrewrite.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"36f9b37b3b5c5296"}},{"code_sha256_prefix":"c3b0830b8cc3c87b","entry":"positive_bounding_box","repo":"davidbau/rewriting","repo_kind":"official","path":"rewrite/ganrewrite.py","file_url":"https://github.com/davidbau/rewriting/blob/HEAD/rewrite/ganrewrite.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c3b0830b8cc3c87b"}},{"code_sha256_prefix":"011230b2b9b8fb6f","entry":"rand_brightness","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/networks/diffaug.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/networks/diffaug.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"011230b2b9b8fb6f"}},{"code_sha256_prefix":"cf3f99cfbe8f451a","entry":"rand_contrast","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/networks/diffaug.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/networks/diffaug.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cf3f99cfbe8f451a"}},{"code_sha256_prefix":"5b0d8787e670fc63","entry":"rand_saturation","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/networks/diffaug.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/networks/diffaug.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5b0d8787e670fc63"}},{"code_sha256_prefix":"e31916f9b07f1f86","entry":"apply_shift","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"ganspace.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/ganspace.py","link_basis":"harvester_set","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":"e31916f9b07f1f86"}},{"code_sha256_prefix":"53eba98d072664b8","entry":"create_dataloader","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/dataset.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/dataset.py","link_basis":"harvester_set","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":"53eba98d072664b8"}},{"code_sha256_prefix":"d2adc53663eaf8a1","entry":"data_sampler","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/dataset.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/dataset.py","link_basis":"harvester_set","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":"d2adc53663eaf8a1"}},{"code_sha256_prefix":"d976b9fd5ba3e472","entry":"define_D","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/networks/misc.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/networks/misc.py","link_basis":"harvester_set","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":"d976b9fd5ba3e472"}},{"code_sha256_prefix":"82adc25dc5feb7de","entry":"define_G","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/networks/misc.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/networks/misc.py","link_basis":"harvester_set","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":"82adc25dc5feb7de"}},{"code_sha256_prefix":"3ff05cdbf246edc5","entry":"gen_principal_components","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"ganspace.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/ganspace.py","link_basis":"harvester_set","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":"3ff05cdbf246edc5"}},{"code_sha256_prefix":"00215dbe8680445b","entry":"get_param_by_name","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/gan_model.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/gan_model.py","link_basis":"harvester_set","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":"00215dbe8680445b"}},{"code_sha256_prefix":"0c04f59973771055","entry":"get_stats","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"run_metrics.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/run_metrics.py","link_basis":"harvester_set","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":"0c04f59973771055"}},{"code_sha256_prefix":"f7014d8c994c5c5b","entry":"get_vgg_features","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"run_metrics.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/run_metrics.py","link_basis":"harvester_set","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":"f7014d8c994c5c5b"}},{"code_sha256_prefix":"feeb5b7716528a75","entry":"mixing_noise","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"training/gan_model.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/training/gan_model.py","link_basis":"harvester_set","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":"feeb5b7716528a75"}},{"code_sha256_prefix":"bfd30ba25798287e","entry":"normalize","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"eval/ppl.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/eval/ppl.py","link_basis":"harvester_set","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":"bfd30ba25798287e"}},{"code_sha256_prefix":"904ef2c2720850a0","entry":"slerp","repo":"PeterWang512/GANSketching","repo_kind":"listed","path":"eval/ppl.py","file_url":"https://github.com/PeterWang512/GANSketching/blob/HEAD/eval/ppl.py","link_basis":"harvester_set","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":"904ef2c2720850a0"}},{"code_sha256_prefix":"4746337d187a61f7","entry":"subsequence","repo":"revsic/Rewriting-A-Deep-Generative-Models","repo_kind":"listed","path":"utils/nethook.py","file_url":"https://github.com/revsic/Rewriting-A-Deep-Generative-Models/blob/HEAD/utils/nethook.py","link_basis":"harvester_set","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":"4746337d187a61f7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}