{"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/similarity-of-neural-networks-with-gradients","title":"Similarity of Neural Networks with Gradients","arxiv_id":"2003.11498","date":"2020-03-25","proceeding":null,"authors":["Shuai Tang","Wesley J. Maddox","Charlie Dickens","Tom Diethe","Andreas Damianou"],"abstract":"A suitable similarity index for comparing learnt neural networks plays an important role in understanding the behaviour of the highly-nonlinear functions, and can provide insights on further theoretical analysis and empirical studies. We define two key steps when comparing models: firstly, the representation abstracted from the learnt model, where we propose to leverage both feature vectors and gradient ones (which are largely ignored in prior work) into designing the representation of a neural network. Secondly, we define the employed similarity index which gives desired invariance properties, and we facilitate the chosen ones with sketching techniques for comparing various datasets efficiently. Empirically, we show that the proposed approach provides a state-of-the-art method for computing similarity of neural networks that are trained independently on different datasets and the tasks defined by the datasets.","url_abs":"https://arxiv.org/abs/2003.11498v1","url_pdf":"https://arxiv.org/pdf/2003.11498v1.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":"similarity-of-neural-networks-with-gradients","repo_url":"https://github.com/amzn/xfer/tree/master/nn_similarity_index","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"similarity-of-neural-networks-with-gradients","repo_url":"https://github.com/amzn/xfer","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"mxnet","reach":{"status":"unanswered"}},{"paper_slug":"similarity-of-neural-networks-with-gradients","repo_url":"https://github.com/marcozullich/pruned_layer_similarity","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"similarity-of-neural-networks-with-gradients","repo_url":"https://github.com/MindCode-4/code-9/tree/main/similarity-of-neural-network","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"network-pruning","task_name":"Network Pruning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2003.11498","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2003.11498"}},"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/amzn/xfer","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MindCode-4/code-9/tree/main/similarity-of-neural-network","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/amzn/xfer/tree/master/nn_similarity_index","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/marcozullich/pruned_layer_similarity","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":11},"by_repo_kind":{"listed":{"samples":11,"ran":0,"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":"c4a027ab6113a900","entry":"CIFAR10","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/datasets.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/datasets.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":"c4a027ab6113a900"}},{"code_sha256_prefix":"15d4f21d63e777a0","entry":"MNIST","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/datasets.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/datasets.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":"15d4f21d63e777a0"}},{"code_sha256_prefix":"8db20ee6e093bb90","entry":"SVHN","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/datasets.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/datasets.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":"8db20ee6e093bb90"}},{"code_sha256_prefix":"09d4486f337cf7b2","entry":"cka","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/nn_comparison.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/nn_comparison.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":"09d4486f337cf7b2"}},{"code_sha256_prefix":"8ccbf4af2c43854c","entry":"lf_mask_global","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/pruning/LF_mask.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/pruning/LF_mask.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":"8ccbf4af2c43854c"}},{"code_sha256_prefix":"58df0d7122e9d2e5","entry":"mask_prop_params","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/pruning/LF_mask.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/pruning/LF_mask.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":"58df0d7122e9d2e5"}},{"code_sha256_prefix":"84cff1784c0e138b","entry":"n_dataloader","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/utils.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/utils.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":"84cff1784c0e138b"}},{"code_sha256_prefix":"68f669694231d8d9","entry":"nbs","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/nn_comparison.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/nn_comparison.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":"68f669694231d8d9"}},{"code_sha256_prefix":"f248fd8826172f1e","entry":"reshape_4d_tensor","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/preprocessing.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/preprocessing.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":"f248fd8826172f1e"}},{"code_sha256_prefix":"a607b8da0ad72744","entry":"svd_decomposition","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/preprocessing.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/preprocessing.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":"a607b8da0ad72744"}},{"code_sha256_prefix":"784c23f1bf771b6f","entry":"svd_reduction","repo":"marcozullich/pruned_layer_similarity","repo_kind":"listed","path":"layer_sim/preprocessing.py","file_url":"https://github.com/marcozullich/pruned_layer_similarity/blob/HEAD/layer_sim/preprocessing.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":"784c23f1bf771b6f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}