Dynamic Neural Network for Multi-Task Learning Searching across Diverse
  Network Topologies
In this paper, we present a new MTL framework that searches for structures
optimized for multiple tasks with diverse graph topologies and shares features
among tasks. We design a restricted DAG-based central network with
read-in/read-out layers to build topologically diverse task-adaptive structures
while limiting search space and time. We search for a single optimized network
that serves as multiple task adaptive sub-networks using our three-stage
training process. To make the network compact and discretized, we propose a
flow-based reduction algorithm and a squeeze loss used in the training process.
We evaluate our optimized network on various public MTL datasets and show ours
achieves state-of-the-art performance. An extensive ablation study
experimentally validates the effectiveness of the sub-module and schemes in our
framework.
Wonhyeok Choi, Sunghoon Im
# Dynamic Neural Network for Multi-Task Learning

###### Abstract

In this paper, we present a new MTL framework that searches for structures optimized for multiple tasks with diverse graph topologies and shares features among tasks. We design a restricted DAG-based central network with read-in/read-out layers to build topologically diverse task-adaptive structures while limiting search space and time. We search for a single optimized network that serves as multiple task adaptive sub-networks using our three-stage training process. To make the network compact and discretized, we propose a flow-based reduction algorithm and a squeeze loss used in the training process. We evaluate our optimized network on various public MTL datasets and show ours achieves state-of-the-art performance. An extensive ablation study experimentally validates the effectiveness of the sub-module and schemes in our framework.

## 1 Introduction

Multi-task learning (MTL), which learns multiple tasks simultaneously with a single model has gained increasing attention [3, 13, 14]. MTL improves the generalization performance of tasks while limiting the total number of network parameters to a lower level by sharing representations across tasks. However, as the number of tasks increases, it becomes more difficult for the model to learn the shared representations, and improper sharing between less related tasks causes negative transfers that sacrifice the performance of multiple tasks [15, 36]. To mitigate the negative transfer in MTL, some works [6, 25, 32] separate the shared and task-specific parameters on the network.

More recent works [21, 29, 38] have been proposed to dynamically control the ratio of shared parameters across tasks using a Dynamic Neural Network (DNN) to construct a task adaptive network. These works mainly apply the cell-based architecture search [19, 27, 41] for fast search times, so that the optimized sub-networks of each task consist of fixed or simple structures whose layers are simply branched, as shown in Fig. 0(a). They primarily focus on finding branching patterns in specific aspects of the architecture, and feature-sharing ratios across tasks. However, exploring optimized structures in restricted network topologies has the potential to cause performance degradation in heterogeneous MTL scenarios due to unbalanced task complexity.

We present a new MTL framework searching for sub-network structures, optimized for each task across diverse network topologies in a single network. To search the graph topologies from richer search space, we apply Directed Acyclic Graph (DAG) for the homo/heterogeneous MTL frameworks, inspired by the work in NAS [19, 27, 40]. The MTL in the DAG search space causes a scalability issue, where the number of parameters and search time increase quadratically as the number of hidden states increases.

To solve this problem, we design a restricted DAG-based central network with read-in/read-out layers that allow our MTL framework to search across diverse graph topologies while limiting the search space and search time. Our flow-restriction eliminates the low-importance long skip connection among network structures for each task, and creates the required number of parameters from \(O(N^{2})\) to \(O(N)\). The read-in layer is the layer that directly connects all the hidden states from the input state, and the read-out layer is the layer that connects all the hidden states to the last feature layer. These are key to having various network topological representations, such as polytree structures, with early-exiting and multi-embedding.

Then, we optimize the central network to have compact task-adaptive sub-networks using a three-stage training procedure. To accomplish this, we propose a squeeze loss and a flow-based reduction algorithm. The squeeze loss limits the upper bound on the number of parameters. The reduction algorithm prunes the network based on the weighted adjacency matrix measured by the amount of information flow in each layer. In the end, our MTL framework constructs a compact single network that serves as multiple task-specific networks with unique structures, such as chain, polytree, and parallel diverse topologies, as presented in Fig. 0(b). It also dynamically controls the amount of sharing representation among tasks.
The experiments demonstrate that our framework successfully searches the task-adaptive network topologies of each task and leverages the knowledge among tasks to make a generalized feature. The proposed method outperforms state-of-the-art methods on all common benchmark datasets for MTL. Our contributions can be summarized as follows:

* We present for the first time an MTL framework that searches both task-adaptive structures and sharing patterns among tasks. It achieves state-of-the-art performance on all public MTL datasets.
* We propose a new DAG-based central network composed of a flow restriction scheme and read-in/out layers, that has diverse graph topologies in a reasonably restricted search space.
* We introduce a new training procedure that optimizes the MTL framework for compactly constructing various task-specific sub-networks in a single network.

## 2 Related Works

**Neural Architecture Search (NAS)** Neural Architecture Search is a method that automates neural architecture engineering [8]. Early works [40, 2, 41] use reinforcement learning based on rewarding the model accuracy of the generated architecture. Alternative approaches [30, 24, 37] employ evolutionary algorithms to optimize both the neural architecture and its weights. These methods search for an adequate neural architecture in a large discrete space. Gradient-based NAS methods [4, 19, 39] of formulating operations in a differentiable search space are proposed to alleviate the scalability issues. They generally use the convex combination from a set of operations instead of determining a single operation. Most NAS approaches [19, 27, 40] adopt the complete DAG as a search space, to find the architecture in the various network topologies. However, DAG-based MTL frameworks have not been proposed, because of their considerably high computational demands.

**Multi-Task Learning (MTL)** Multi-task learning in deep neural networks can be categorized into hard and soft parameter sharing types [31]. Hard parameter sharing [13, 3, 14], also known as shared-bottom, is the most commonly used approach to MTL. This scheme improves generalization performance while reducing the computational cost of the network, by using shared hidden layers between all tasks. However, it typically struggles with the negative transfer problem [15, 36] which degrades performance due to improper sharing between less relevant tasks.

On the other hand, soft-parameter sharing [25, 32] alleviate the negative transfer problem by changing the shared parameter ratio. These approaches mitigate the negative transfer by flexibly modifying shared information, but they cannot maintain the computational advantage on the classic shared-bottom model. Recently, advanced approaches have been proposed to adjust shared parameters using a dynamic neural network [21, 22, 38, 29] and NAS [10].

**NAS-style MTL** MTL frameworks using a dynamic neural network (DNN) can be divided into two categories. One employs the Mixture-of-Experts (MoE) [33], which is designed for conditional computation of per-sample, to MTL by determining the experts of each task [21, 9, 22]. They have a fixed depth finalized task-specific sub-network, because they choose experts from a fixed number of modular layers. This causes a critical issue with task-balancing in the heterogeneous MTL. The other adopts the skip-or-select policy to select task-specific blocks from the set of residual blocks [38] or a shared block per layer [12, 29]. These methods only create a simple serial path in the finalized sub-network of each task, and a parallel link cannot be reproduced. Moreover, they heuristically address the unbalanced

Figure 1: **Graph representation of various neural networks. (a) Graph representation of existing dynamic neural network for multitask learning and ours. (b) Topologies of a completed Directed Acyclic Graph (DAG) and the output sub-graph of DAG structure.**
task-wise complexity issues in the heterogenous MTL (_e.g_. manually changing the balancing parameters based on the task complexity [29, 38]). Thus, none of the aforementioned works focus on finding the optimal task-specific structure in the MTL scenario.

## 3 Method

We describe our MTL framework, which searches for optimized network structures tailored to each task across diverse graph topologies, while limiting search time. Sec. 3.1 describes the composition of the searchable space of our central network and our flow-restriction method for efficiently balancing the topological diversity of task-specific sub-networks and searching space. Sec. 3.2 introduces our mechanism to determine the task-adaptive sub-network in the central network and describes the overall training process and loss function. The overall pipeline of our method is illustrated in Fig. 2.

### The Central Network with Diverse Topologies

Our central network composes a graph \(G=(V,E)\) with layers \(E\) in which the \(N\) hidden states \(V=\{v_{1},...,v_{N}\}\) are topologically sorted:

\[E=\{e_{ij}\}_{i,j\in\{1,...,N\}},\text{ where }i<j, \tag{1}\] \[e_{ij}(\,\cdot\,;\theta_{ij}):\mathbb{R}^{N^{v_{i}}}\to \mathbb{R}^{N^{v_{j}}}, \tag{2}\]

where \(e_{ij}\) is the operation that transfer the state \(v_{i}\) to \(v_{j}\) with the weight parameters \(\theta_{ij}\in\Theta\), and \(N^{v_{k}}\) is the number of the elements of hidden state \(v_{k}\), respectively. We adopt the DAG structure [19, 27, 40] for the network. However, the optimized structure from DAG is searched from \(2^{N(N-1)/2}\) network topologies, which are too large to be optimized in time. To address the issue while maintaining diversity, we propose a flow-restriction and read-in/read-out layers.

**Flow-restriction** The flow-restriction eliminates the low-importance long skip connection among network structures for each task by restricting \(j-i\leq M\) where \(M\) is the flow constant. Regulating the searchable edges in the graph reduces the required number of parameters and searching time from \(O(N^{2})\) to \(O(N)\), but it sacrifices the diversity and capacity of the network topologies.

To explain the topological diversity and task capacity of sub-networks, we define the three components of network topology, as follows:

1. \(\mathcal{D}(G)=\max(\{\text{Distance}(v_{i},v_{j})\}_{v_{i},v_{j}\in V}),\)
2. \(\mathcal{W}(G)=\max(\{\text{Out}_{v_{i}}\}_{v_{i}\in V}),\)
3. \(\mathcal{S}(G_{s},G)=|E_{s}|/|E|,\)

where \(\text{Out}_{v_{i}}\) is the out-degree of the vertex \(v_{i}\) and \(\text{Distance}(\cdot)\) is the operation that counts the number of layers (or edges) between two connected vertices. The network depth \(\mathcal{D}(G)\) is equal to the longest distance between two vertices in the graph \(G\). The network width \(\mathcal{W}(G)\) is equal to the maximum value of the out-degrees of hidden states in the graph \(G\). The sparsity \(\mathcal{S}(G_{s},G)\) of the sub-graph \(G_{s}\) is the ratio of finalized edges \(|E_{s}|\) over entire edges \(|E|\). The first two components are measurements of the topological diversity of the finalized sub-network, while the last one is for the sub-network capacity. While a complete DAG has the full range of depth and width components, the flow-restricted DAG has the properties of depth and width components as follows:

1. \(\min(\{\mathcal{D}(G_{s})\}_{G_{s}\subseteq G})=\lceil(|V|/M)\rceil,\)
2. \(\max(\{\mathcal{W}(G_{s})\}_{G_{s}\subseteq G})=M,\)

where \(\{G_{s}\}\) is the entire sub-graph of \(G\). The min-depth property (Prop. 1) can cause the over-parameterized problem when the capacity of the task is extremely low. The max-width property (Prop. 2) directly sacrifices the diversity of network topologies in the search space.

**Read-in/Read-out layers** We design read-in/read-out layers to mitigate these problems. The read-in layer embeds the input state \(v_{0}\) into all hidden states \(v_{i}\in V\) with task-specific weights \(\alpha_{i}^{k}\in\mathcal{A}\) for all \(K\) tasks \(\mathcal{T}=\{T_{k}\}_{k\in\{1,...,K\}}\) as follows:

\[v_{i}^{k}=\sigma(\alpha_{i}^{k})\cdot v_{0}, \tag{3}\]

where \(\sigma(\cdot)\) is the sigmoid function. Then, the central network sequentially updates the hidden state \(v_{1}^{k}\) to \(v_{N}^{k}\) with the task-specific weights \(\gamma_{ij}^{k}\in\Gamma\) that correspond to \(e_{ij}^{k}\):

\[v_{j}^{k}=\frac{1}{\text{In}_{v_{j}^{k}}}\sum_{e_{ij}\in E}(\sigma(\gamma_{ij} ^{k})\cdot e_{ij}(v_{i}^{k};\theta_{ij})), \tag{4}\]

where \(\text{In}_{v_{j}^{k}}\) is the in-degree of \(v_{j}^{k}\). Note that \(\Gamma\) is the adjacency matrix of graph \(G\). Finally, the read-out layer aggregates all hidden state features \(\{v_{i}^{k}\}_{i\in\{1,...,N\}}\) with the task-specific weights \(\beta_{i}^{k}\in\mathcal{B}\) and produces the last layer feature \(v_{L}^{k}\) for each task \(k\) as follows:

\[v_{L}^{k}=\sum_{i\in\{1,...,N\}}(\sigma(\beta_{i}^{k})\cdot v_{i}^{k}). \tag{5}\]

The final prediction \(\hat{\mathbf{y}}_{k}\) for each task \(T_{k}\) is computed by passing the aggregated features \(v_{L}^{k}\) through the task-specific head \(H^{k}(\cdot)\) as follows:

\[\hat{\mathbf{y}}^{k}=H^{k}(v_{L}^{k}). \tag{6}\]

All upper-level parameters \(\mathcal{A},\mathcal{B}\), and \(\Gamma\) are learnable parameters, and their learning process is described in Sec. 3.2. The read-in/read-out layers enable the optimized network to have a multi-input/output sub-network. The read-out layer
aggregates all hidden states of the central network during the search stage, allowing a specific task to use the early hidden states to output predictions while ignoring the last few layers. These early-exit structures help alleviate the over-parameterized problem in simple tasks.

### Network Optimization and Training Procedure

We describe the entire training process for our MTL framework, which consists of three stages, including warm-up, search, and fine-tuning stages.

**Warm-up stage** As with other gradient-based NAS, our framework has upper-level parameters that determine the network structure and parameters. This bilevel optimization with a complex objective function in an MTL setup makes the training process unstable. For better convergence, we initially train all network parameters across tasks for a few iterations. We train the weight parameters of the central network \(\Theta\) that shares all operations \(E\) across tasks. We fix all values of the upper-level parameters \(\mathcal{A},\mathcal{B}\), and \(\Gamma\) as \(0\), which becomes \(0.5\) after the sigmoid function \(\sigma(\cdot)\), and freeze them. We train the network parameters \(\Theta\) in Eq. 4 with a task loss as follows:

\[\mathcal{L}_{task}=\sum_{k=0}^{K}\mathcal{L}_{T_{k}}(\mathbf{\hat{y}}_{T_{k}},\mathbf{y}_{T_{k}}), \tag{7}\]

where \(\mathcal{L}_{T_{k}}\) is the task-specific loss, which is the unique loss function for each task.

**Search stage** After the warm-up stage, we unfreeze the upper-level parameters \(\mathcal{A},\mathcal{B}\), and \(\Gamma\) and search the network topologies appropriate to each task. We train all these parameters and network parameters \(\Theta\) simultaneously by minimizing the task loss and the proposed squeeze loss \(\mathcal{L}_{sq}\) as follows:

\[\mathcal{L}_{train}=\mathcal{L}_{task}+\lambda_{sq}\mathcal{L}_{sq}, \tag{8}\]

\[\mathcal{L}_{sq}=\sum_{k=0}^{K}(\max((\sum_{\gamma_{ij}\in\Gamma}(\sigma( \gamma_{ij}))-\kappa),0)), \tag{9}\]

where \(\lambda_{sq}\) is the balancing hyperparameter, and \(\kappa\) is a constant number called the budget, that directly reduces the sparsity of the central network. This auxiliary loss is designed to encourage the model to save computational resources.

**Fine-tuning stage** Lastly, we perform a fine-tuning stage to construct a compact and discretized network structure using the trained upper-level parameters \(\mathcal{A},\mathcal{B}\), and \(\Gamma\). To do so, we design a flow-based reduction algorithm that allows the network to obtain high computational speed by omitting low-importance operations, as described in Alg. 1. It measures the amount of information flow of each layer \(e_{ij}\) in the central network by calculating the ratio of edge weight with respect to other related edges weight. Then, it sequentially removes the edge which has the lowest information flow. Alg. 1 stops when the edge selected to be deleted is

Figure 2: **Overall pipeline. Our central network follows a DAG-based structure with read-in/out layers, and task-specific heads. The long skip connection is cut by our flow-restriction. Our framework with a 3-task MTL learning scenario consists of three stages including warm-up, search, and fine-tuning stages. The warm-up stage only learns the parameters of the main network \(\Theta\) and task-specific weights. The search stage learns the upper-level parameters \(\mathcal{A},\mathcal{B},\Gamma\), and task-specific weights. Then, flow-based reduction eliminates the low-importance edges from the network. The fine-tuning stage re-trains the network with the remaining important parameters.**
the only edge that can reach the graph. We use the simple Depth-first search algorithm to check the reachability of \(\hat{\Gamma}\) between hidden state \(v_{N_{\alpha}}\) to \(v_{N_{\beta}}\). All the output \(\hat{\mathcal{A}},\hat{\mathcal{B}},\hat{\Gamma}\) in Alg. 1, which is the discretized binary adjacency matrix, represent the truncated task-adaptive sub-network. After the reduction, we fix the upper-level parameters and only re-train the network parameters \(\Theta\), and we do not use the sigmoid function in Eq. 3-5

```
Input:\(\Gamma\in\mathbb{R}^{N\times N}\), \(\mathcal{A}\in\mathbb{R}^{N}\), \(\mathcal{B}\in\mathbb{R}^{N}\) Output:\(\hat{\Gamma},\hat{\mathcal{A}},\hat{\mathcal{B}}\)// Discretized params.
1 initialize zero matrix \(\Psi,\hat{\Psi}\in\mathbb{R}^{(N+2)\times(N+2)}\)
2\(N_{\alpha}=\operatorname*{argmax}(\mathcal{A})\)
3\(N_{\beta}=\max(N_{\alpha}+1,\operatorname*{argmax}(\mathcal{B}))\)
4\(\Gamma[:N_{\alpha},:]\gets 0\)//removeedges\(<\)\(N_{\alpha}\)
5\(\Gamma[:,N_{\beta}:]\gets 0\)//removeedges\(>\)\(N_{\beta}\)
6\(\Psi[1:N,1:N]\leftarrow\Gamma\)//merge\(\Gamma,\mathcal{A},\mathcal{B}\)into\(\Psi\)
7\(\Psi[0,N_{\alpha}+1:N_{\beta}+1]\leftarrow\mathcal{A}[N_{\alpha}:N_{\beta}]\)
8\(\Psi[N_{\alpha}+1:N_{\beta}+1,N+1]\leftarrow\mathcal{B}[N_{\alpha}:N_{\beta}]\)
9whileTruedo
10 initialize zero matrix \(S\in\mathbb{R}^{(N+2)\times(N+2)}\)
11for\(i\gets 0\)to\(\{N+1\}\)do
12for\(j\gets 0\)to\(\{N+1\}\)do
13\(S[i,j]\gets\psi_{ij}\big{(}\frac{1}{\operatorname*{ln}_{v_{i}}}\sum_{ \psi_{ki}\in\Psi}(\psi_{ki})/\sum_{\psi_{ki}\in\Psi}(\psi_{ik})+\frac{1}{ \operatorname*{Out}_{j_{j}}}\sum_{\psi_{jk}\in\Psi}(\psi_{jk})/\sum_{\psi_{kj} \in\Psi}(\psi_{kj})\big{)}\)
14\(\psi_{ij}\gets 0\), where \(S[i,j]\) is nonzero min value
15ifgraph builded from \(\Psi\) is reachablethen
16\(\hat{\Psi}\leftarrow\Psi\)
17
18else
19\(\hat{\Psi}[\hat{\Psi}>0]\gets 1\)//discretization
20\(\hat{\Gamma}\leftarrow\hat{\Psi}[1:N,1:N]\)//splitinto\(\Gamma,\mathcal{A},\mathcal{B}\)
21\(\hat{\mathcal{A}}\leftarrow\hat{\Psi}[0,1:N]\)
22\(\hat{\mathcal{B}}\leftarrow\hat{\Psi}[1:N,N+1]\)
23return\(\hat{\Gamma},\hat{\mathcal{A}},\hat{\mathcal{B}}\)
```

**Algorithm 1**Flow-based Reduction

## 4 Experiments

We first describe the experimental setup in Sec. 4.1. We compare our method to state-of-the-art MTL frameworks on various benchmark datasets for MTL in Sec. 4.2. We also conduct extensive experiments and ablation studies to validate our proposed method in Sec. 4.3-4.5.

### Experimental Settings

**Dataset** We use four public datasets for multi-task scenarios including Omniglot [17], NYU-v2 [34], Cityscapes [7], and PASCAL-Context [26]. We use these datasets, configured by previous MTL works [29, 38], not their original sources.

* **Omniglot** Omniglot is a classification dataset consisting of 50 different alphabets, and each of them consists of a number of characters with 20 handwritten images per character.
* **NYU-v2** NYU-v2 comprises images of indoor scenes, fully labeled for joint semantic segmentation, depth estimation, and surface normal estimation.
* **Cityscapes** Cityscapes dataset collected from urban driving scenes in European cities consists of two tasks: joint semantic segmentation and depth estimation.
* **PASCAL-Context** PASCAL-Context datasets contain PASCAL VOC 2010 [34] with semantic segmentation, human parts segmentation, and saliency maps, as well as additional annotations for surface normals and edge maps.

**Competitive methods** We compare the proposed framework with state-of-the-art methods [1, 11, 12, 18, 20, 22, 23, 25, 28, 29, 32, 38] and various baselines including a single task and a shared-bottom. The single-task baseline trains each task independently using a task-specific encoder and task-specific head for each task. The shared-bottom baseline trains multiple tasks simultaneously with a shared encoder and separated task-specific heads.

We compare our method with MoE-based approaches, including Soft Ordering [23], Routing [28], and Gumbel-Matrix [22], as well as a NAS approach [18] on Omniglot datasets. CMTR [18] can modify parameter count, similar to our method. We compare our method with other soft-parameter sharing methods including Cross-Stitch [25], Sluice network [32], and NDDR-CNN [11] and the dynamic neural network (DNN)-based methods including MTAN [20], DEN [1], and Adashare [38] for the other three datasets. We provide the evaluation results of two recent works, LTB [12] and PHN [29] for PASCAL-Context datasets because only the results are reported in their papers, but no source codes are provided.

**Multi-task scenarios** We set up multi-task scenarios with the combination of several tasks out of a total of seven tasks, including classification \(\mathcal{T}_{cls}\), semantic segmentation \(\mathcal{T}_{sem}\), depth estimation \(\mathcal{T}_{dep}\), surface normal prediction \(\mathcal{T}_{norm}\), human-part segmentation \(\mathcal{T}_{part}\), saliency detection \(\mathcal{T}_{sal}\), and edge detection \(\mathcal{T}_{edge}\). We follow the MTL setup in [38] for three datasets including Omniglot, NYU-v2, and cityscapes, and [29] for PASCAL-Context. We simulate a homogeneous MTL scenario of a 20-way classification task in a multi-task setup using Omniglot datasets by following [23]. Each task predicts a class of characters in a single alphabet set. We use the other three datasets for heterogeneous MTL. We set three tasks including segmentation, depth estimation, and normal estimation for NYU-v2 and two with segmentation, depth estimation for Cityscapes.
We set five tasks \(\mathcal{T}_{sem}\), \(\mathcal{T}_{part}\), \(\mathcal{T}_{norm}\), \(\mathcal{T}_{sal}\), and \(\mathcal{T}_{edge}\) as used in [29] for PASCAL-Context datasets.

**Evaluation metrics** We follow the common evaluation metrics utilized in the competitive methods. We use an accuracy metric for the classification task. The semantic segmentation task is measured by mean Intersection over Union (mIoU) and pixel accuracy. We use the mean absolute and mean relative errors, and relative difference as the percentage of \(\delta=\max(\hat{\mathbf{d}}/\mathbf{d},\mathbf{d}/\hat{\mathbf{d}})\) within thresholds \(1.25^{\{1,2,3\}}\) for the depth estimation task. For the evaluation of the PASCAL-Context datasets, we follow the same metrics used in [29] for all tasks. As reported in [38], we report a single relative performance \(\Delta_{\mathcal{T}_{i}}\) in Tab. 1-4 for each task \(\mathcal{T}_{i}\) with respect to the single-task baseline, which defined as:

\[\Delta_{\mathcal{T}_{i}}=\frac{100}{|\mathcal{M}|}\sum_{j=0}^{|\mathcal{M}|}( -1)^{l_{j}}\frac{(\mathcal{M}_{\mathcal{T}_{i},j}-\mathcal{M}_{\mathcal{T}_{i},j}^{single})}{\mathcal{M}_{\mathcal{T}_{i},j}^{single}}, \tag{10}\]

where \(\mathcal{M}_{\mathcal{T}_{i},j}\) and \(\mathcal{M}_{\mathcal{T}_{i},j}^{single}\) are the \(j\)-th metric of \(i\)-th task \(\mathcal{T}_{i}\) from each method and the single task baseline, respectively. The constant \(l_{j}\) is 1 if a lower value represents better for the metric \(\mathcal{M}_{\mathcal{T}_{i},j}\) and 0 otherwise. The averaged relative performance for all tasks \(\mathcal{T}\) is defined as:

\[\Delta_{\mathcal{T}}=\frac{1}{|\mathcal{T}|}\sum_{i=1}^{|\mathcal{T}|}\Delta_ {\mathcal{T}_{i}}. \tag{11}\]

The absolute task performance for all metrics is reported in the supplementary material.

**Network and training details** For our central network, we set 8 hidden states, the same as the existing MoE-based works [22, 28] and use the same classification head for Omniglot datasets. We set 12 hidden states, the same as the VGG-16 [35], except for the max-pooled state, and use the Deeplab-v2 [5] decoder structure as all task heads for all the other datasets, respectively. We use the Adam [16] optimizer to update both upper-level parameters and network parameters. We use cross-entropy loss for semantic segmentation and L2 loss for the other tasks. For a fair comparison, we train our central network from scratch without pre-training for all experiments. We describe more details on the network structure and hyperparameter settings in the supplementary material.
model outperforms AdaShare [38] for both the NYU-v2 and Cityscapes datasets, while keeping almost the same number of parameters (NYU-v2: 1.00 vs. 1.04 and Cityscapes 1.00 vs. 0.96). With the flow constant \(M=7,9\), our method outperforms all the baselines by a large margin. The results from the PASCAL-Context datasets in Tab. 4 show that all baselines suffer from negative transfer in several tasks, as the number of tasks increases. Only Adashare and Cross Stitch slightly outperform the single-task baseline (see the performance \(\Delta_{\mathcal{T}}\)). On the other hand, ours with \(M=9\) achieves the best performance without any negative transfers for all tasks.

Interestingly, the required parameters of the search space increase almost in proportion to the increase of the flow constant, but there is no significant difference in the number of parameters of the finalized networks. For example, the required number of parameters for the network with the flow constant \(M=3,5,7\) is 2.77, 4.23, and 5.38, respectively. This demonstrates that the proposed flow-based reduction algorithm is effective in removing low-relative parameters while maintaining performance. Specifically, we observe that the total performance of our framework with \(M=7\) is slightly better than the \(M=9\) setup in Tab. 2 despite its smaller architecture search space. To investigate this, we further analyze the tendency in performance and computational complexity with respect to the flow constant in Sec. 4.4.

### Analysis of Topologies and Task Correlation

To demonstrate the effectiveness of the proposed learning mechanism, we visualize our finalized sub-network topologies in Fig. 3-(a-c) and the adjacency matrix for NYU-v2 3-task learning in Fig. 3-(d). We also analyze the diversity and capacity of task-adaptive network topologies in Tab. 5 with network depth \(\mathcal{D}\), width \(\mathcal{W}\), and sparsity \(\mathcal{S}\) described in Sec. 3.1. These analyses provide three key observations on our task-adaptive network and the correlation among tasks.

First, _the tasks of segmentation and surface normal hardly share network parameters_. Various task-sharing patterns are configured at the edge, but there is only one sharing layer between the two tasks. This experiment shows a low relationship between tasks, as it is widely known that the proportion of shared parameters between tasks indicates task correlation [22, 29, 38].

Second, _long skip connections are mostly lost_. The length of the longest skip connection in the finalized network is 5, and the number of these connections is 2 out of 18 layers, even with the flow constant of 7. This phenomenon is observed not only in NYU-v2 datasets but also in the other MTL datasets. This can be evidence that the proposed flow-restriction reduces search time while maintaining high performance even by eliminating the long skip connection in the DAG-based central network.

Lastly, _Depth estimation task requires more network resources than segmentation and surface normal estimation tasks_. We analyze the network topologies of the finalized sub-network of each task in NYU-v2 datasets using three components defined in Sec. 3. The depth \(\mathcal{D}\) and width \(\mathcal{W}\) of the sub-network increase in the order of semantic segmentation, surface normal prediction, and depth estimation tasks. Likewise, the sparsity \(\mathcal{S}\) of the depth network is the highest. This experiment shows that the depth network is the task that requires the most network resources.

### Performance w.r.t. Flow-restriction

We analyze performance and computational complexity with respect to the flow constant \(M\) for the NYU-v2 and Cityscapes datasets. We report the rate of performance degradation with respect to the complete DAG search space in Fig. 4. We observe that the reduction rate of the final performance does not exceed 3% even with considerably lower flow constants. The performance is saturated at a flow constant of about 7 or more. This means that the proposed method optimizes the task adaptive sub-network regardless of the size of the network search space, if it satisfies the minimum required size.

Figure 3: **Graph Representation of Task-adaptive Sub-network** The finalized sub-network topologies (\(M=7\)) trained with NYU-v2 datasets is illustrated as graph. (a-c) The task-adaptive sub-network of semantic segmentation, depth estimation, and surface normal, respectively. (d) The adjacency matrix where color represents the discretized value for the activated edge of each task.

\begin{table}
\begin{tabular}{c|c c c} \hline \hline Task & \(\mathcal{D}\) & \(\mathcal{W}\) & \(\mathcal{S}\) \\ \hline Semantic Seg. & 5 & 3 & 0.103 \\ Depth & 7 & 3 & 0.192 \\ Surface normal & 7 & 2 & 0.128 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Topologies analysis on **NYU-v2 datasets**.
To demonstrate the effectiveness of our flow-based reduction (FBR) algorithm, we compare it to two other reduction algorithms (random and threshold) for Cityscapes datasets in Fig. 5. The random reduction literally removes the edges randomly, and the thresholding method sequentially removes the edge which has the lowest value in the adjacency matrix \(\Gamma\). We measure the rate of performance degradation of the pruned network of each reduction algorithm with respect to the non-reduced network while changing the sparsity \(\mathcal{S}\). Note that our method automatically determines the sparsity, so for this experiment only, we add a termination condition that stops the network search when a certain sparsity is met. The results show that the proposed flow-reduction method retains performance even with a low sparsity rate. This means that our method efficiently prunes the low-related edge of the network compared to the other methods.

### Ablation Study on Proposed Modules

We conduct ablation studies on the four key components of our framework; the flow-restriction, read-in/out layers, flow-based reduction, and squeeze loss. We report the relative task performance and the number of parameters of the finalized network with/without the components in Tab. 6. The results show that our framework, including all components, achieves the lowest number of parameters and the second-best performance. Our method without flow-based reduction achieves the best performance. However, the finalized network from this setup has about a five-times larger number of parameters than ours because the network has never been pruned in a training process. This demonstrates that our restricted DAG-based central network is optimized to build compact task-adaptive sub-networks with performance close to the optimized sub-network from a complete DAG-based network.

## 5 Conclusions

In this paper, we present a new MTL framework to search for task-adaptive network structures across diverse network topologies in a single network. We propose flow restriction to solve the scalability issue in a complete DAG search space while maintaining the diverse network topological representation of the DAG search space by adopting read-in/out layers. We also introduce a flow-based reduction algorithm that prunes the network efficiently while maintaining overall task performance and squeeze loss, limiting the upper bound on the number of network parameters. The extensive experiments demonstrate that the sub-module and schemes of our framework efficiently improve both the performance and compactness of the network. Our method compactly constructs various task-specific sub-networks in a single network and achieves the best performance among all the competitive methods on four MTL benchmark datasets.

## Acknowledgement

This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. RS-2023-00210908).

\begin{table}
\begin{tabular}{c|c c c|c|c} \hline \hline Method & \(\Delta\tau_{rms}\uparrow\) & \(\Delta\tau_{rms}\uparrow\) & \(\Delta\tau_{rms}\uparrow\) & \(\Delta\tau\) & \# of Param \(\downarrow\) \\ \hline Ours (M=7) & +13.4 & **+9.2** & +10.7 & +11.1 & **1.31** \\ \hline w/o flow-restriction & +13.2 & **+9.2** & +10.4 & +11.0 & 1.80 \\ w/o read-in/out & +11.7 & +8.3 & +10.4 & +10.1 & 1.43 \\ w/o flow-based reduction & **+14.2** & **+9.2** & **+11.1** & **+11.5** & 6.50 \\ w/o \(\mathcal{L}_{\text{avg}}\) & +13.2 & +8.8 & +10.7 & +10.9 & 1.38 \\ \hline \hline \end{tabular}
\end{table}
Table 6: **Ablation study on the proposed modules (NYU-v2).**

Figure 4: **Model performance with respect to the proposed flow-restriction.** We plot the degradation ratio of the performance (left y-axis) and parameter (right y-axis) by changing the flow constant \(M\). We measure the final averaged task performance with NYU-v2 and Cityscapes datasets marked by purple and pink circle markers, respectively. We also measure the number of parameters marked by gray square markers.

Figure 5: **Model Performance with respect to the network sparsity.** We plot the performance degradation rate by changing network sparsity. We compare our flow-based reduction algorithm to two other schemes; random selection and thresholding.