{"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/finding-skill-neurons-in-pre-trained","title":"Finding Skill Neurons in Pre-trained Transformer-based Language Models","arxiv_id":"2211.07349","date":"2022-11-14","proceeding":null,"authors":["Xiaozhi Wang","Kaiyue Wen","Zhengyan Zhang","Lei Hou","Zhiyuan Liu","Juanzi Li"],"abstract":"Transformer-based pre-trained language models have demonstrated superior performance on various natural language processing tasks. However, it remains unclear how the skills required to handle these tasks distribute among model parameters. In this paper, we find that after prompt tuning for specific tasks, the activations of some neurons within pre-trained Transformers are highly predictive of the task labels. We dub these neurons skill neurons and confirm they encode task-specific skills by finding that: (1) Skill neurons are crucial for handling tasks. Performances of pre-trained Transformers on a task significantly drop when corresponding skill neurons are perturbed. (2) Skill neurons are task-specific. Similar tasks tend to have similar distributions of skill neurons. Furthermore, we demonstrate the skill neurons are most likely generated in pre-training rather than fine-tuning by showing that the skill neurons found with prompt tuning are also crucial for other fine-tuning methods freezing neuron weights, such as the adapter-based tuning and BitFit. We also explore the applications of skill neurons, including accelerating Transformers with network pruning and building better transferability indicators. These findings may promote further research on understanding Transformers. The source code can be obtained from https://github.com/THU-KEG/Skill-Neuron.","url_abs":"https://arxiv.org/abs/2211.07349v1","url_pdf":"https://arxiv.org/pdf/2211.07349v1.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":"finding-skill-neurons-in-pre-trained","repo_url":"https://github.com/thu-keg/skill-neuron","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"network-pruning","task_name":"Network Pruning"}],"methods":[{"method_slug":"pruning","method_name":"Pruning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2211.07349","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2211.07349"}},"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/thu-keg/skill-neuron","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/THU-KEG/Skill-Neuron","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":7},"by_repo_kind":{"official":{"samples":7,"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":"2f2b3f9b9b9bf7c0","entry":"balance","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/helper/binarize.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/helper/binarize.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":"2f2b3f9b9b9bf7c0"}},{"code_sha256_prefix":"3ac2d952980db18f","entry":"cut","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/mask.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/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":"3ac2d952980db18f"}},{"code_sha256_prefix":"21b0ff446cbe51ea","entry":"cut","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/prune.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/prune.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":"21b0ff446cbe51ea"}},{"code_sha256_prefix":"51fb53c251b46836","entry":"finfo","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/skillneuron.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/skillneuron.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":"51fb53c251b46836"}},{"code_sha256_prefix":"4e7df67a92029962","entry":"getDataset","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/dataset.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/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":"4e7df67a92029962"}},{"code_sha256_prefix":"5a8f0ac4c2e69022","entry":"get_agg_accs","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/skillneuron.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/skillneuron.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":"5a8f0ac4c2e69022"}},{"code_sha256_prefix":"e9d1721da5040dcc","entry":"get_logger","repo":"THU-KEG/Skill-Neuron","repo_kind":"official","path":"src/log.py","file_url":"https://github.com/THU-KEG/Skill-Neuron/blob/HEAD/src/log.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":"e9d1721da5040dcc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}