Emergent Modularity in Pre-trained Transformers

Zhengyan Zhang, Zhiyuan Zeng, Yankai Lin, Chaojun Xiao, Xiaozhi Wang +5 more
5/28/2023
cs.CLcs.LG

Official code: thunlp/Modularity-Analysis (26 stars, MIT, last commit 2023-06-07).

Abstract

This work examines the presence of modularity in pre-trained Transformers, a feature commonly found in human brains and thought to be vital for general intelligence. In analogy to human brains, we consider two main characteristics of modularity: (1) functional specialization of neurons: we evaluate whether each neuron is mainly specialized in a certain function, and find that the answer is yes. (2) function-based neuron grouping: we explore finding a structure that groups neurons into modules by function, and each module works for its corresponding function. Given the enormous amount of possible structures, we focus on Mixture-of-Experts as a promising candidate, which partitions neurons into experts and usually activates different experts for different inputs. Experimental results show that there are functional experts, where clustered are the neurons specialized in a certain function. Moreover, perturbing the activations of functional experts significantly affects the corresponding function. Finally, we study how modularity emerges during pre-training, and find that the modular structure is stabilized at the early stage, which is faster than neuron stabilization. It suggests that Transformers first construct the modular structure and then learn fine-grained neuron functions. Our code and data are available at https://github.com/THUNLP/modularity-analysis.

View on arXivView PDF

Code Implementations(1)

MIT

[ACL 2023 Findings] Emergent Modularity in Pre-trained Transformers

262Shell, PythonMay 23, 20233 years agoMIT

Similar Papers

Cite this paper

@article{zhang2023emergent,
  title  = {Emergent Modularity in Pre-trained Transformers},
  author = {Zhengyan Zhang and Zhiyuan Zeng and Yankai Lin and Chaojun Xiao and Xiaozhi Wang and Xu Han and Zhiyuan Liu and Ruobing Xie and Maosong Sun and Jie Zhou},
  year   = {2023},
  eprint = {2305.18390},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.18390v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.18390.svg)](https://codeofpaper.com/paper/2305.18390)

Discussion