arXiv:2610.32153cs.LGOct 2026

Manuscript Offprint

arXiv:2610.32153

Sparsity-driven emergence of functional modularity in multitask neural networks

Bowen Shi, Qi Ouyang, Long Qian

ABSTRACT

Neural networks can learn multiple tasks, but how learning organizes shared computation into specialized and reusable components remains poorly understood. In this work, we show that sparsity-inducing regularization promotes functional modularity in multitask networks without predefined module boundaries. Using functional profiling in multilayer perceptrons and a lightweight transformer, we identified compact, task-selective subnetworks, termed functional tokens. Across rule-based task families, selectively retaining these tokens preserves their associated functions while reducing performance on other tasks. Such specialization develops preferentially in deeper layers during training, while earlier layers retain shared computation. Regularization strength and form shape module compactness and specialization, while task weighting alters functional allocation. Moreover, extracted functional tokens can be recombined through alternative pathways to reconstruct a learned composite computation without retraining, preserving their connectivity and learned weights. Our results suggest that sparsity-constrained optimization shapes not only parameter use but also the organization and reuse of learned computation.

1 Introduction

Deep neural networks have achieved wide success across perception, language, reasoning, and scientific discovery Bengio and LeCun [2007], Hinton et al. [2006], Goodfellow et al. [2016]. Despite substantial advances in architectural design He et al. [2015], Huang et al. [2018] and optimization Ruder [2017], the organizational principles that emerge during learning remain poorly understood. In particular, it is unclear how networks with distributed parameters and representations develop specialized functions while sharing and reusing computation across tasks. Biological intelligence provides a compelling example of such organization: functional modularity, characterized by partially independent yet interacting computational components, enables neural systems to support specialized processing, robustness, and compositional reuse across tasks Damicelli et al. [2019], Margalit et al. [2024].

Motivated by the computational advantages of modularity, previous machine-learning approaches have attempted to incorporate modular organization through explicit design. Neural module architectures introduce predefined functional components that can be selectively combined for different tasks Andreas et al. [2017], Braylan et al. [2015], while adaptive structural learning methods seek to optimize network architectures by modifying connectivity patterns Cortes et al. [2017], Liu et al. [2018]. Other approaches have explored structure-preserving constraints to incorporate prior organization into neural networks Celledoni et al. [2021]. More recently, sparse expert architectures have enabled large-scale neural networks to achieve conditional computation by routing inputs to specialized subnetworks Shazeer et al. [2017], Fedus et al. [2022]. Although these approaches demonstrate the utility of modular computation, they typically rely on architectural constraints, predefined components, or explicit routing strategies Sun and Guyon [2023].

Modular organization, however, need not be specified in advance. Evolutionary studies have shown that modularly varying goals or selection to reduce connection costs can promote the emergence of modular networks Kashtan and Alon [2005], Clune et al. [2013]. More recently, work on multitask recurrent networks has linked emergent modularity to task demands, representational capacity, and connection-growth dynamics Wu et al. [2026]. Learned modular connection masks can also improve subsequent learning after weight reinitialization, particularly under capacity constraints Wu et al. [2026], demonstrating the utility of learned connectivity as a structural prior.

Sparsity provides an optimization-level route to investigate how constraints on connectivity shape computation. Sparsity-inducing regularization encourages a network to use fewer connections without prescribing internal module boundaries. Sparse and structured regularization have been extensively studied for model compression, parameter selection, and pruning Wen et al. [2016], Scardapane et al. [2017], Ma et al. [2019], while analyses of learned features, task-selective representations and shared dynamical motifs have revealed structure in trained networks Agrawal et al. [2022], Li et al. [2024], Michaud et al. [2024], Yang et al. [2019], Driscoll et al. [2024]. The question here goes beyond network size: can sparsity help organize computation into task-selective components that preserve their associated functions and can be recombined with their learned parameters intact, without retraining?

In this work, we show that sparsity-inducing optimization can drive the emergence of functional modularity in multitask neural networks without explicitly designed modular architectures. Across multilayer perceptrons and a light-weight transformer, we identify compact, task-selective subnetworks, which we denote functional tokens, that coexist with shared computation. Across task families, these tokens preserve their associated functions under selective retention. By systematically varying sparsity strength and regularizer form, tracking functional specialization during training, and analyzing endpoint representation geometry, we characterize how sparsity shapes depth-dependent functional reorganization. Furthermore, extracted functional tokens can be connected through different pathways to reconstruct a learned composite computation without retraining or changing their learned parameter values. These findings connect sparse optimization to the organization and reuse of learned computation, highlighting machine-learning systems as models for uncovering general principles of computational organization Levine and Tu [2024].

References (31)