{"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/meansparse-post-training-robustness","title":"MeanSparse: Post-Training Robustness Enhancement Through Mean-Centered Feature Sparsification","arxiv_id":"2406.05927","date":"2024-06-09","proceeding":null,"authors":["Sajjad Amini","Mohammadreza Teymoorianfard","Shiqing Ma","Amir Houmansadr"],"abstract":"We present a simple yet effective method to improve the robustness of both Convolutional and attention-based Neural Networks against adversarial examples by post-processing an adversarially trained model. Our technique, MeanSparse, cascades the activation functions of a trained model with novel operators that sparsify mean-centered feature vectors. This is equivalent to reducing feature variations around the mean, and we show that such reduced variations merely affect the model's utility, yet they strongly attenuate the adversarial perturbations and decrease the attacker's success rate. Our experiments show that, when applied to the top models in the RobustBench leaderboard, MeanSparse achieves a new robustness record of 75.28% (from 73.71%), 44.78% (from 42.67%) and 62.12% (from 59.56%) on CIFAR-10, CIFAR-100 and ImageNet, respectively, in terms of AutoAttack accuracy. Code is available at https://github.com/SPIN-UMass/MeanSparse","url_abs":"https://arxiv.org/abs/2406.05927v2","url_pdf":"https://arxiv.org/pdf/2406.05927v2.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":"meansparse-post-training-robustness","repo_url":"https://github.com/spin-umass/meansparse","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.05927","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.05927"}},"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/spin-umass/meansparse","reach":{"status":"ok"}}],"summary":{"ran_fixture":1,"ran":6,"unverified":2},"by_repo_kind":{"official":{"samples":9,"ran":7,"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":9,"samples":[{"code_sha256_prefix":"085a09050f4f41dc","entry":"accuracy","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR100_Linfinity/utils_sparse.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR100_Linfinity/utils_sparse.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"085a09050f4f41dc"}},{"code_sha256_prefix":"8cc714ce3f931a36","entry":"convert_to_serializable","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR100_Linfinity/utils_sparse.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR100_Linfinity/utils_sparse.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":"8cc714ce3f931a36"}},{"code_sha256_prefix":"45d4a3ecd310054b","entry":"get_relative_position_index","repo":"spin-umass/meansparse","repo_kind":"official","path":"ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.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":"45d4a3ecd310054b"}},{"code_sha256_prefix":"0e0f66ffb7a61530","entry":"normalize_fn","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR10_Linfinity/RaWRN-70-16/MeanSparse_robustarch_wide_resnet.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR10_Linfinity/RaWRN-70-16/MeanSparse_robustarch_wide_resnet.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":"0e0f66ffb7a61530"}},{"code_sha256_prefix":"132734a4ce8711e3","entry":"read_list_with_json","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR100_Linfinity/utils_sparse.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR100_Linfinity/utils_sparse.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":"132734a4ce8711e3"}},{"code_sha256_prefix":"0a394d15da3f8f82","entry":"window_partition","repo":"spin-umass/meansparse","repo_kind":"official","path":"ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.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":"0a394d15da3f8f82"}},{"code_sha256_prefix":"e301d79cca7897cf","entry":"window_reverse","repo":"spin-umass/meansparse","repo_kind":"official","path":"ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/ImageNet_Linfinity/Swin_L/MeanSparse_swin_transformer.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":"e301d79cca7897cf"}},{"code_sha256_prefix":"2ea97919e65e55d9","entry":"load_cifar10","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR100_Linfinity/data.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR100_Linfinity/data.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":"2ea97919e65e55d9"}},{"code_sha256_prefix":"2775934904810b7e","entry":"load_cifar100","repo":"spin-umass/meansparse","repo_kind":"official","path":"CIFAR100_Linfinity/data.py","file_url":"https://github.com/spin-umass/meansparse/blob/HEAD/CIFAR100_Linfinity/data.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":"2775934904810b7e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}