{"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/d4explainer-in-distribution-gnn-explanations","title":"D4Explainer: In-Distribution GNN Explanations via Discrete Denoising Diffusion","arxiv_id":"2310.19321","date":"2023-10-30","proceeding":null,"authors":["Jialin Chen","Shirley Wu","Abhijit Gupta","Rex Ying"],"abstract":"The widespread deployment of Graph Neural Networks (GNNs) sparks significant interest in their explainability, which plays a vital role in model auditing and ensuring trustworthy graph learning. The objective of GNN explainability is to discern the underlying graph structures that have the most significant impact on model predictions. Ensuring that explanations generated are reliable necessitates consideration of the in-distribution property, particularly due to the vulnerability of GNNs to out-of-distribution data. Unfortunately, prevailing explainability methods tend to constrain the generated explanations to the structure of the original graph, thereby downplaying the significance of the in-distribution property and resulting in explanations that lack reliability. To address these challenges, we propose D4Explainer, a novel approach that provides in-distribution GNN explanations for both counterfactual and model-level explanation scenarios. The proposed D4Explainer incorporates generative graph distribution learning into the optimization objective, which accomplishes two goals: 1) generate a collection of diverse counterfactual graphs that conform to the in-distribution property for a given instance, and 2) identify the most discriminative graph patterns that contribute to a specific class prediction, thus serving as model-level explanations. It is worth mentioning that D4Explainer is the first unified framework that combines both counterfactual and model-level explanations. Empirical evaluations conducted on synthetic and real-world datasets provide compelling evidence of the state-of-the-art performance achieved by D4Explainer in terms of explanation accuracy, faithfulness, diversity, and robustness.","url_abs":"https://arxiv.org/abs/2310.19321v1","url_pdf":"https://arxiv.org/pdf/2310.19321v1.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":"d4explainer-in-distribution-gnn-explanations","repo_url":"https://github.com/graph-and-geometric-learning/d4explainer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"d4explainer-in-distribution-gnn-explanations","repo_url":"https://github.com/realmoana/proxyexplainer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"graph-learning","task_name":"Graph Learning"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2310.19321","atlas_url":"https://app.syntology.ai/?focus=2310.19321","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.19321"}},"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/graph-and-geometric-learning/d4explainer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/realmoana/proxyexplainer","reach":null}],"summary":{"ran":3,"ran_draft_wrong":7,"ran_fixture":3,"ran_honours":2,"unverified":6},"by_repo_kind":{"official":{"samples":21,"ran":15,"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":0,"samples":[{"code_sha256_prefix":"876af85f8e3ffb2b","entry":"FeatureExtractor","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"876af85f8e3ffb2b"}},{"code_sha256_prefix":"224789a60fc208a5","entry":"Powerful","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"224789a60fc208a5"}},{"code_sha256_prefix":"55f7243fa5953c0d","entry":"PowerfulLayer","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"55f7243fa5953c0d"}},{"code_sha256_prefix":"6dfdb2f6de8a0f00","entry":"discretenoise_single","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6dfdb2f6de8a0f00"}},{"code_sha256_prefix":"a4424d0337fb23aa","entry":"gen_full","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a4424d0337fb23aa"}},{"code_sha256_prefix":"2c0b5b94f76fedb0","entry":"gen_list_of_data_single","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2c0b5b94f76fedb0"}},{"code_sha256_prefix":"d59e27b5fae8a2be","entry":"generate_mask","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"d59e27b5fae8a2be"}},{"code_sha256_prefix":"c450ff9a010d27ad","entry":"gnn_pred","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c450ff9a010d27ad"}},{"code_sha256_prefix":"bad5406d867eff25","entry":"graph2tensor","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bad5406d867eff25"}},{"code_sha256_prefix":"6a78eeb85c913ca8","entry":"loss_cf_exp","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a78eeb85c913ca8"}},{"code_sha256_prefix":"63fed087bd0312f9","entry":"loss_func_bce","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"63fed087bd0312f9"}},{"code_sha256_prefix":"fdd19f4eeaaf2335","entry":"mask_adjs","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"fdd19f4eeaaf2335"}},{"code_sha256_prefix":"e0e84c89f30caaad","entry":"masked_instance_norm2D","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e0e84c89f30caaad"}},{"code_sha256_prefix":"270d02a1f79ddaf1","entry":"sparsity","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"270d02a1f79ddaf1"}},{"code_sha256_prefix":"c88f152103fd6b98","entry":"tensor2graph","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c88f152103fd6b98"}},{"code_sha256_prefix":"c14f6a99b3a0f100","entry":"DiffExplainer","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"c14f6a99b3a0f100"}},{"code_sha256_prefix":"4e59a98458bb3be0","entry":"Explainer","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"4e59a98458bb3be0"}},{"code_sha256_prefix":"910c9cb3a669f5b0","entry":"e_map_mutag","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"910c9cb3a669f5b0"}},{"code_sha256_prefix":"ffae4597c717f872","entry":"graph_to_mol","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"ffae4597c717f872"}},{"code_sha256_prefix":"52dde03888435cc5","entry":"model_save","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"52dde03888435cc5"}},{"code_sha256_prefix":"8e3e1e254a4e2c8a","entry":"x_map_mutag","repo":"graph-and-geometric-learning/d4explainer","repo_kind":"official","path":"explainers/diff_explainer.py","file_url":"https://github.com/graph-and-geometric-learning/d4explainer/blob/HEAD/explainers/diff_explainer.py","link_basis":"first_harvest_node","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":"8e3e1e254a4e2c8a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}