summaries: The authors propose an algorithm that takes several neural networks and outputs an embedding for such networks and a meta-model. This meta-model can take any embedding of a network, and emulate its hidden states and outputs. The authors suggest that these embeddings can measure models similarity, and show how to interpolate and extrapolate between and from the models in the training set. This paper proposes an approach to combine together multiple (pretrained) neural networks into a single model that can simulate each of the considered neural networks, both in terms of output and hidden states. The setup here relies on all the considered networks to operate on the same task, and in particular the same input data type (but perhaps with different sampled training sets). The combined meta-model then considers as inputs not only the input data, but also an encoding (which is learned during its training) of each model. This allows model-dependent latent features to be computed by the meta-model, which can then be decoded to hidden states of each network via specialized decoders that can be thought of as auxiliary computational pathways that operate in parallel to the one producing the main output of the meta-model. The model encoding are then used to visualize and explore the relations between different networks (or instantiations), and furthermore, to further tune the combined model towards an interpolation or extrapolation that goes beyond (and seems to outperform) each of the individual networks used to train the meta-model.  This paper introduces a new approach to studying the population of trained neural networks. Specifically, the author's design and train a meta-model which when given a vector, the meta-model emulates the model associated with the given vector. The authors present a few applications of their framework, including clustering and semi-supervised learning.  The manuscript proposes to analyze the similarity of different neural networks trained to solve the same task by developing a meta-model capable of reproducing/emulating both the output and the hidden representation of each individual network.  This meta-model is parametrized by a set of parameters which is common to all the networks, and by other parameters which are network-specific (theta). In this way, each network will correspond to a different theta, and one can analyze the global features of the set of networks by unsupervised manifold learning in the  theta-space. 
abstractText: A core challenge in the interpretation of deep neural networks is identifying commonalities between the underlying algorithms implemented by distinct networks trained for the same task. Motivated by this problem, we introduce DYNAMO, an algorithm that constructs low-dimensional manifolds where each point corresponds to a neural network model, and two points are nearby if the corresponding neural networks enact similar high-level computational processes. DYNAMO takes as input a collection of pre-trained neural networks and outputs a meta-model that emulates the dynamics of the hidden states as well as the outputs of any model in the collection. The specific model to be emulated is determined by a model embedding vector that the meta-model takes as input; these model embedding vectors constitute a manifold corresponding to the given population of models. We apply DYNAMO to both RNNs and CNNs, and find that the resulting model embedding spaces enable novel applications: clustering of neural networks on the basis of their high-level computational processes in a manner that is less sensitive to reparameterization; model averaging of several neural networks trained on the same task to arrive at a new, operable neural network with similar task performance; and semi-supervised learning via optimization on the model embedding space. Using a fixed-point analysis of meta-models trained on populations of RNNs, we gain new insights into how similarities of the topology of RNN dynamics correspond to similarities of their high-level computational processes.
references.authors: Kyle Aitken Vinay V Ramasesh Ankush Garg Yuan Cao David Sussillo Niru Maheswaranathan
references.title: The geometry of integration in text classification rnns
references.venue: arXiv preprint arXiv:2010.15114,
references.authors: Piotr Bojanowski Armand Joulin David Lopez-Pas Arthur Szlam
references.title: Optimizing the latent space of generative networks
references.venue: In International Conference on Machine Learning,
references.authors: Ekin D Cubuk Barret Zoph Jonathon Shlens Quoc V Le
references.title: Randaugment: Practical automated data augmentation with a reduced search space
references.venue: In IEEE Conference on Computer Vision and Pattern Recognition Workshops,
references.authors: Chelsea Finn Pieter Abbeel Sergey Levine
references.title: Model-agnostic meta-learning for fast adaptation of deep networks
references.venue: In International Conference on Machine Learning,
references.authors: Takashi Fukuda Masayuki Suzuki Gakuto Kurata Samuel Thomas Jia Cui Bhuvana Ramabhadran
references.title: Efficient knowledge distillation from an ensemble of teachers
references.authors: Matthew D Golub David Sussillo
references.title: Fixedpointfinder: A tensorflow toolbox for identifying and characterizing fixed points in recurrent neural networks
references.venue: Journal of Open Source Software,
references.authors: Geoffrey Hinton Oriol Vinyals Jeffrey Dean
references.title: Distilling the knowledge in a neural network
references.venue: In NIPS Deep Learning and Representation Learning Workshop,
references.authors: P Izmailov AG Wilson D Podoprikhin D Vetrov T Garipov
references.title: Averaging weights leads to wider optima and better generalization
references.venue: In Conference on Uncertainty in Artificial Intelligence,
references.authors: Anatole Katok Boris Hasselblatt
references.title: Introduction to the modern theory of dynamical systems. Number 54
references.authors: Simon Kornblith Mohammad Norouzi Honglak Lee Geoffrey Hinton
references.title: Similarity of neural network representations revisited
references.venue: In International Conference on Machine Learning,
references.authors: Karel Lenc Andrea Vedaldi
references.title: Understanding image representations by measuring their equivariance and equivalence
references.venue: In IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Yixuan Li Jason Yosinski Jeff Clune Hod Lipson John E Hopcroft
references.title: Convergent learning: Do different neural networks learn the same representations
references.venue: In International Conference on Learning Representations,
references.authors: Ilya Loshchilov Frank Hutter
references.title: Decoupled weight decay regularization
references.venue: In International Conference on Learning Representations,
references.authors: Andrew Maas Raymond E Daly Peter T Pham Dan Huang Andrew Y Ng Christopher Potts
references.title: Learning word vectors for sentiment analysis
references.venue: In Annual Meeting of the Association for Computational Linguistics,
references.authors: Niru Maheswaranathan Alex H Williams Matthew D Golub Surya Ganguli David Sussillo
references.title: Reverse engineering recurrent networks for sentiment classification reveals line attractor dynamics
references.venue: Advances in Neural Information Processing Systems,
references.authors: Niru Maheswaranathan Alex H Williams Matthew D Golub Surya Ganguli David Sussillo
references.title: Universality and individuality in neural dynamics across large populations of recurrent networks
references.venue: Advances in Neural Information Processing Systems,
references.authors: Ari Morcos Maithra Raghu Samy Bengio
references.title: Insights on representational similarity in neural networks with canonical correlation
references.venue: Advances in Neural Information Processing Systems,
references.authors: Maithra Raghu Justin Gilmer Jason Yosinski Jascha Sohl-Dickstein
references.title: SVCCA: Singular Vector Canonical Correlation Analysis for Deep Learning Dynamics and Interpretability
references.venue: In International Conference on Neural Information Processing Systems,
references.authors: Sachin Ravi Hugo Larochelle
references.title: Optimization as a model for few-shot learning
references.venue: In International Conference on Learning Representations,
references.title: bengio, université de montréal, adriana romero, nicolas ballas, samira ebrahimi kahou, antoine chassang, carlo gatta, and yoshua bengio. fitnets: Hints for thin deep nets
references.venue: In International Conference on Learning Representations,
references.authors: Andrei A Rusu Dushyant Rao Jakub Sygnowski Oriol Vinyals Razvan Pascanu Simon Osindero Raia Hadsell
references.title: Meta-Learning with Latent Embedding Optimization
references.venue: In International Conference on Learning Representations,
references.authors: Adam Santoro Sergey Bartunov Matthew Botvinick Daan Wierstra Timothy Lillicrap
references.title: Metalearning with memory-augmented neural networks
references.venue: In International Conference on Machine Learning,
references.authors: Karen Simonyan Andrea Vedaldi Andrew Zisserman
references.title: Deep inside convolutional networks: Visualising image classification models and saliency maps
references.venue: arXiv preprint arXiv:1312.6034,
references.authors: David Sussillo Omri Barak
references.title: Opening the black box: low-dimensional dynamics in highdimensional recurrent neural networks
references.venue: Neural Computation,
references.authors: David Sussillo Mark M Churchland Matthew T Kaufman Krishna V Shenoy
references.title: A neural network that finds a naturalistic solution for the production of muscle activity
references.venue: Nature Neuroscience,
references.authors: Daniel LK Yamins James J DiCarlo
references.title: Using goal-driven deep learning models to understand sensory cortex
references.venue: Nature Neuroscience,
references.authors: Matthew D Zeiler Rob Fergus
references.title: Visualizing and understanding convolutional networks
references.venue: In European Conference on Computer Vision,
references.authors: Xiang Zhang Junbo Zhao Yann LeCun
references.title: Character-level convolutional networks for text classification
references.venue: Advances in Neural Information Processing Systems,
sections.heading: 1 INTRODUCTION
sections.text: A crucial feature of neural networks with fixed network architecture is that they form a manifold by virtue of their continuously tunable weights, which underlies their capability to be trained by gradient descent. However, this conception of the space of neural networks is inadequate for understanding the computational processes they perform. For example, two neural networks trained to perform the same task may have vastly different weights, and yet implement the same high-level algorithms and computational processes (Maheswaranathan et al., 2019b).
  In this paper, we construct an algorithm which provides alternative parametrizations of the space of RNNs and CNNs with the goal of endowing a geometric structure that is more compatible with the high-level computational processes performed by neural networks. In particular, given a set of neural networks with possibly different architectures (and possibly trained on different tasks), we find a parametrization of a low-dimensional submanifold of neural networks which approximately interpolates between these chosen “base models”, as well as extrapolates beyond them. We can use such model embedding spaces to cluster neural networks and even compute model averages of neural networks. A key feature is that two points in model embedding space are nearby if they correspond to neural networks which implement similar high-level computational processes, in a manner to be described later. In this way, two neural networks may correspond to nearby points in model embedding space even if those neural networks have distinct weights or even architectures.
  The model embedding space is parametrized by a low-dimensional parameter θ ∈ Rd, and each base model is assigned a value of θ in the space. This allows us to apply traditional ideas from clustering and interpolation to the space of neural networks. Moreover, each model embedding space has an associated meta-model which, upon being given a θ, is rendered into an operable neural network. If a base model is mapped to some θ, then the meta-model, upon being given that θ, will emulate the
  corresponding base model. See Figure 1 for a diagrammatic depiction. An interesting application is that given two models assigned to parameters θ1 and θ2, we can consider the averaged model corresponding to the value (θ1 + θ2)/2. We find that this averaged model performs similarly on the task for which the base models in the average were trained. We also use the model embedding space to extrapolate outside the space of base models, and find cases in which the model embedding manifold specifies models that perform better on a task than any trained base model. Later on we will explain how this can be regarded as a form of semi-supervised learning.
  The rest of the paper is organized as follows. We first provide the mathematical setup for our algorithmic construction of model embedding spaces. After reviewing related work, we then present results of numerical experiments which implement the algorithm and explore clustering, model averaging, and semi-supervised learning on the model embedding space. We further examine how topological features of the dynamics of RNNs in model embedding spaces are reflective of classes of high-level computation processes. Finally, we conclude with a discussion.
sections.heading: 2 DYNAMICAL MODEL EMBEDDING
sections.heading: 2.1 MATHEMATICAL SETUP
sections.text: In this section, we provide the mathematical setup for construction of model embedding spaces. We treat this in the RNN setting, and relegate the CNN setting to Section A of the Appendix.
  Algorithm 1 DYNAMO algorithm Input: Base models {(Fn, Gn)}Nn=1, loss functions {(Ln,hidden,Ln,output)}Nn=1,
  datasets {Dn}Nn=1, output loss weight λ ≥ 0 Output: Meta-model (F̃ , G̃), state maps {Vn}Nn=1, model embeddings {θn}Nn=1 Initialize networks F̃ , G̃, {Vn}Nn=1 Initialize model embeddings θn = 0 for τ = 1, . . . , τmax do
  Sample base model (Fi, Gi) uniformly at random Sample input {xt} from dataset Di Compute base model hidden states {ht} and outputs {Gi(ht)} Compute meta-model hidden states {hθi,t} and outputs {G̃(hθi,t)} Compute mapped meta-model states {Vi(hθi,t)} Compute loss L̂ = Li,hidden + λLi,output Update F̃ , G̃, Vi, θi using∇L̂
  end for return (F̃ , G̃), {Vn}, {θn}
  Notation. Let an RNN be denoted by F (x, h) where x is the input and h is the hidden state. We further denote the hidden-to-output map byG(h). We consider a collection ofN RNNs {(Fn, Gn)}Nn=1 we call the base models which may each have distinct dimensions for their hidden states, but all have the same dimension for their inputs as well as the same dimension for their outputs. A sequence of inputs is notated as {xt}Tt=0 which induces a sequence of hidden states by ht+1 = F (xt, ht) where the initial hidden state h0 is given. A collection of sequences of inputs, possibly each with different maximum lengths T , is denoted by D which we call an input data set. We suppose that each base model RNN has an associated input data set.
sections.heading: 2.2 META-MODELS FOR RNNS
sections.text: Given a collection base model RNNs, we would like to construct a meta-model which emulates the behavior of each of the base models. In this case, the meta-model is itself an RNN with one additional input θ ∈ Rd and a corresponding map F̃ (θ, x, h) whose output is the next hidden state. Given a sequence of input states {xt}Tt=0, we have a corresponding sequence of output states hθ,t+1 = F̃ (θ, xt, hθ,t) starting from an initial hidden state h0 (which we suppose does not depend on θ). The meta-model also includes a hidden-to-output map G̃(h) that is independent of θ.
  For the meta-model (F̃ , G̃) to emulate a particular base model (Fn, Gn) with respect to its corresponding data set Dn, we consider the following criteria: there is some θn for which
  1. G̃(hθn,t) ≈ Gn(ht) for all t > 0 and all input sequences in the data set
  2. Vn(hθ,t) ≈ ht for all t > 0 and all input sequences in the data set,
  where Vn is a transformation of a meta-model’s hidden activity. We emphasize that θn and Vn depend on the particular base model under consideration. The first criterion means that at some particular θn, the outputs of the meta-model RNN dynamics are close to the outputs of the base model RNN dynamics. The second criterion means that at the same θn, there is a time-independent transformation Vn (i.e., Vn does not depend on t) such the transformed hidden state dynamics of the meta-model are close to the hidden state dynamics of the base model. See Figure 2 for a visualization. As depicted in the figure, it is convenient to regard the meta-model RNN as having input states (θn, x). As such, a sequence of inputs {xt}Tt=1 is appended by θn to become {(θn, xt)}Tt=1.
  The desired properties of the meta-model are enforced in the loss function. Defining the functions
  Loutput[F̃ , G̃, θn] := 1
  T T∑ t=1 d(G̃(hθn,t), Gn(ht)) (1)
  Lhidden[F̃ , θn, Vn] := 1
  T T∑ t=1 ‖Vn(hθn,t)− ht‖ 2 2 (2)
  where d is some suitable distance or divergence, we can construct the loss function E{xt}∼Dn [ Lhidden[F̃ , θn, Vn] + λLoutput[F̃ , G̃, θn] ] (3)
  where we average over the choice of sequence {xt} coming from the input data set Dn. Above, λ is a hyperparameter. Our aim is to minimize the above over a suitable class of F̃ , G̃, Vn, as well as θn; this can be implemented computationally via the DYNAMO algorithm (see Algorithm 1). As a side remark, it appears that a suitable alternative choice to equation 2 would be 1 T ∑T t=1 ‖hθn,t −Wn(ht)‖ 2 2 where here Wn is a map from the hidden states of the base model to the hidden states of the meta-model. However, this would be problematic since minimization may pressure Wn to be the the zero map (or otherwise have outputs which are small in norm) and accordingly pressure the dynamics of the meta-model to be the trivial (or have small norm). As such, we opt to formulate Lhidden as it is written in equation 2. Suppose we want the meta-model to be able to emulate an entire collection of base models {(Fn, Gn)}Nn=1. In particular, the meta-model will attempt to assign to the nth base model a θn and Vn so that the two criteria listed above are satisfies for that base model. These desiderata can be implemented by minimizing the loss function
  L[F̃ , G̃, {θn}Nn=1, {Vn}Nn=1] := 1
  N N∑ n=1 E{xt}∼Dn [ Ln,hidden[F̃ , θn, Vn] + λLn,output[F̃ , G̃, θn] ] .
  (4)
  In some circumstances, we may want to consider base models with distinct dimensions for their output states. For instance, suppose half of the base models perform a task with outputs in Rd1 and the other half perform a task without outputs in Rd2 . To accommodate for this, we can have two hidden-to-output maps G̃1, G̃2 for the meta-model, where the maps have outputs in Rd1 and Rd2 respectively. The loss function is slightly modified so that we use G̃1 where compare the metamodel to the first kind of base model, and G̃2 when we compare the meta-model to the second kind of base model. This construction generalizes to the setting where the base models can be divided up into k groups with distinct output dimensions; this would necessitate k hidden-to-output functions G̃1, ..., G̃k for the meta-model.
sections.heading: 3 RELATED WORK
sections.text: There is a substantial body of work on interpreting the computational processes implemented neural networks by studying their intermediate representations. Such analyses can be performed either on individual models (Simonyan et al., 2013; Zeiler & Fergus, 2014; Lenc & Vedaldi, 2015) or on collections of models (Li et al., 2016; Raghu et al., 2017; Morcos et al., 2018; Kornblith et al., 2019). Prior work in this latter category has focused on pairwise comparisons between models. For example, SVCCA (Raghu et al., 2017) uses canonical correlation analysis to measure the representational similarity between pairs of models. While these methods can also be used to derive model representations by embedding the pairwise distance matrix, our approach does not require the Θ(N2) computational cost of comparing all pairs of base models. Moreover, DYNAMO yields an executable meta-model that can be called with model embedding vectors other than those corresponding to the base models.
  There is a related body of work in the field of computational neuroscience. CCA based techniques and representational geometry are standard for comparing neural networks to the neural activations of animals performing vision tasks (Yamins & DiCarlo, 2016) as well as motor tasks. In an example
  of the latter, the authors of (Sussillo et al., 2015) used CCA techniques to compare brain recordings to those of neural networks trained to reproduce the reaching behaviors of animals, while the authors of (Maheswaranathan et al., 2019b) used fixed point analyses of RNNs to consider network similarity from a topological point of view.
  DYNAMO can be viewed as a form of knowledge distillation (Hinton et al., 2015), since the outputs of the base models serve as targets in the optimization of the meta-model. However, unlike typical instances of knowledge distillation involving an ensemble of teacher networks (Hinton et al., 2015; Fukuda et al., 2017) where individual model predictions are averaged to provide more accurate target labels for the student, our approach instead aims to preserve the dynamics and outputs of each individual base model. FitNets (Romero, 2015) employ a form a knowledge distillation using maps between hidden representations to guide learning; this is similar to our use of hidden state maps in training the meta-model.
  Our treatment of the model embedding vectors {θn} as learnable parameters is similar to the approach used in Generative Latent Optimization (Bojanowski et al., 2018), which jointly optimizes the image generator network and the latent vectors corresponding to each image in the training set. Bojanowski et al. (2018) find that the principal components of the image representation space found by GLO are semantically meaningful. We likewise find that the principal components of the model embeddings found by DYNAMO are discriminative between subsets of models.
  Unlike methods such as hypernetworks (Ha et al., 2017) and LEO (Rusu et al., 2019) that use a model to generate parameters for a separate network, our approach does not attempt to reproduce the parameters of the base models in the collection. Instead, the meta-model aims to reproduce only the hidden states and outputs of a base model when conditioned on the corresponding embedding vector.
  The core focus of this work also differs from that of the meta-learning literature (Santoro et al., 2016; Ravi & Larochelle, 2017; Finn et al., 2017; Munkhdalai & Yu, 2017), which primarily concerns the problem of few-shot adaptation when presented with data from a new task. Our empirical study centers on the post-hoc analysis of a given collection of models, which may or may not have been trained on different tasks. However, we remark that our exploration of optimization in lowdimensional model embedding space is related to LEO (Rusu et al., 2019), where a compressed model representation is leveraged for efficient meta-learning.
sections.heading: 4 EMPIRICAL RESULTS
sections.text: In this section, we describe the results of our empirical study of meta-models trained using DYNAMO on collections of RNNs trained on NLP tasks, and collections of CNNs trained for image classification. For RNN base models, we parameterize the meta-model as a GRU where the model embedding vector θ is presented as an additional input in each time step. For CNN base models, we use a ResNet meta-model where θ is an additional input for each ResNet block. In all our experiments, we hold out half the available training data for use as unlabeled data for training the meta-model; the base models were trained on the remaining training data (or a fraction thereof).1 By default, we set the output loss hyperparameter λ to 1. We defer further details on model architectures and training to the Appendix.
sections.heading: 4.1 VISUALIZING MODEL SIMILARITY IN EMBEDDING SPACE
sections.text: The base model embeddings {θn}Nn=1 can be used for cluster analysis to evaluate the similarity structure of a collection of models. We illustrate this use case of DYNAMO via a series of example applications on NLP and vision tasks. Figure 3 shows model embeddings learned by DYNAMO on collections of RNNs. In these plots, we observe a clear separation of these networks according to the size of the available training data, the RNN model architecture used, and the specific NLP task used for training. By computing the eigenvalues of the covariance matrix corresponding to the N model embeddings, we obtain a measure of the intrinsic dimensionality of the corresponding collections of
  1For example, our IMDB sentiment base models trained on 100% of the available training data were trained on 12,500 examples, with the remaining 12,500 examples used as unlabeled data for training the meta-model.
  models. In Figure 3, we find that 2 to 6 components are sufficient to explain 95% of the variance in the model embeddings.
  By tuning the output loss hyperparameter λ in equation 4, we can adjust the degree of emphasis placed on reproducing the hidden dynamics of the base networks versus their outputs. We demonstrate this effect in Figure 4: with λ = 1, we observe clear separation of ResNet-34 models trained on CIFAR-100 with different data augmentation policies (“weak”, with shifts and horizontal flips vs. “strong”, with RandAugment (Cubuk et al., 2020)), and with different training set sizes. In contrast, with λ = 0, we observe a weak clustering effect with differing data augmentation, and no detectable separation with different training set sizes. We infer that the change in data augmentation policy re-
  sults in a larger difference in the learned feature representations than the change in training set size. In Appendix B, we illustrate the effect of setting λ = 0 for RNN models.
  We additionally compare the embeddings obtained using DYNAMO to those derived from SVCCA (Raghu et al., 2017), a pairwise comparison technique that aligns the representations produced by a pair of networks using canonical correlation analysis (CCA). In Figure 5, we plot the 2D embeddings obtained using multidimensional scaling (MDS) on the pairwise distance matrix computed using SVCCA (modified to output L2 distances instead of correlations). Unlike the principal components of the DYNAMO model embeddings plotted in Figure 3, the MDS coordinates are not semantically interpretable. Additionally, the cluster structure of the collection of GRUs trained with varying training set sizes is less apparent in this representation.
  Lastly, we note that DYNAMO allows for flexibility in defining the metric used to compare the hidden states and outputs of the base models with those of the meta-model. In Appendix B.3, we demonstrate the benefit of using the L1 distance for clustering CNN representations.
sections.heading: 4.2 EXTRAPOLATION BEYOND BASE MODEL EMBEDDINGS
sections.text: We study the model embedding space corresponding to a trained meta-model by conditioning it on model embedding vectors θ other than those assigned to the set of base models. Figure 6 visualizes the landscape of test accuracies for two meta-models: (i) a meta-model for 10 GRUs trained with
  50% of the IMDB training data, and 10 GRUs trained with 25% of the data, and (ii) a meta-model for 10 IMDB sentiment GRUs and 10 AG News classification GRUs.
  We note two particularly salient properties of these plots. First, the test accuracy varies smoothly when interpolating θ between pairs of base model embeddings—we would in general not observe this property when interpolating the parameters of the base GRUs directly, since they were trained with different random initializations and orderings of the training examples. Second, we observe that the embedding vector that realizes the highest test accuracy lies outside the convex hull of the base model embeddings. This is perhaps surprising since typical training and inference protocols involve the use of convex combinations of various objects: for instance, averaging of predictions in model ensembles, and averaging of model parameters during training (e.g., using exponential moving averages, or with Stochastic Weight Averaging (Izmailov et al., 2018)). This extrapolatory phenomenon suggests that DYNAMO is able to derive a low-dimensional manifold of models that generalizes beyond the behavior of the base models used for training the meta-model.
sections.heading: 4.3 SEMI-SUPERVISED LEARNING IN MODEL EMBEDDING SPACE
sections.text: The existence of model embeddings that improve on the accuracy of the base models suggests a natural semi-supervised learning (SSL) procedure involving a trained meta-model. In particular, we minimize the loss incurred by the meta-model on a small set of additional labeled examples by optimizing the value of θ. This is done by backpropagating gradients through the meta-model, with the meta-model parameters held fixed. Figure 7 shows the result of this procedure on an IMDB sentiment meta-model (previously depicted in Figure 6) with a set of additional labeled examples (disjoint from the test set) of size equal to 1% of the full training set. This procedure successfully finds a θ that improves on the test accuracy of the best base model by 6% (86.4% vs. 80.3%).
  We observe that this SSL procedure achieves lower accuracy when we train the meta-model using fewer base models. In particular, a metamodel only on the 10 GRUs trained with 50% of the training data yields a test accuracy of
  85.4%, and a meta-model on only a single GRU out of these 10 yields 81.6%. This result suggests that a diversity of base models helps improve the accuracy achievable by the meta-model.
sections.heading: 5 DYNAMICS OF META-MODELS FOR RNNS
sections.text: In this section we perform an analysis of the dynamical features of the dynamics generated by the meta-models trained on base models that perform the sentiment classification task. The sentiment classification task has a well-understood dynamical structure (Sussillo & Barak, 2013; Maheswaranathan et al., 2019a;b; Aitken et al., 2020) that we can use as a basis for understanding the behavior of a corresponding meta-model. To a first approximation, the sentiment analysis task can be solved by a simple integrator that accumulates sentiment corresponding to each word (positive words such as ‘good’ or ‘fantastic’ adding positive sentiment, and negative words such as ‘bad’ or ‘terrible’ adding negative sentiment). It has been shown that simple sentiment analysis models approximate this integrator by constructing a line attractor in the space of hidden states. For instance, for the zero input x∗ = ~0, it has been observed that the dynamical system generated by the map Fx∗(h) = F (x
  ∗, h) has a tubular region with very little movement, in the sense that ‖Fx∗(h)− h‖2 is very small for hidden states h in this region.
  To investigate the dynamical behavior of the meta-model space, we trained a meta-model on a set of 20 base models which were themselves trained on the IMDB sentiment analysis task. Of these 20 base models, 10 were trained with 50% of the available training data and the remaining 10 were trained on 100% of the training data. The θ points corresponding to these base models clustered in the model embedding space according to the amount of training data. In Figure 8 we perform a fixed-point analysis of several models corresponding to points of interest in the model embedding space.
  The fixed-point analysis was run according to the procedure described in (Golub & Sussillo, 2018). First we selected a set of candidate hidden states hj by running the model on a typical batch of inputs. For each hidden state hj obtained in this way, we used gradient descent on the loss ‖F (x∗, h)−h‖22 to find the nearest approximate fixed point.
  An interesting finding is that the meta-model found line attractor structures that were very geometrically similar for models within a cluster. An interpretation of this result pertaining to topological conjugacy in dynamical systems theory is discussed in Section C of the Supplementary Materials. Moreover, we find that the meta-model finds a continuous interpolation between line attractors that are relatively fat and thin (corresponding to models trained on 50% of the data), and models that are elongated (corresponding to models trained on 100% of the data).
sections.heading: 6 DISCUSSION
sections.text: We have introduced the algorithm DYNAMO, which maps a set of neural network base models to a low dimensional feature space. Our results show that the model embeddings provided by DYNAMO capture relevant computational features of the base models. Moreover, the model embedding spaces produced by DYNAMO are a sufficiently smooth that model averaging can be performed, and even model extrapolation to reach new models with better performance than any base model. Indeed, in our experiments where the base models were trained on the sentiment analysis task, the model embedding space describes a space of line attractors which vary smoothly in the parameter θ.
  We have demonstrated that DYNAMO can be applied broadly to neural networks that have a dynamical structure; for example, we used the demarcation of layers of convolutional neural networks as a proxy for a dynamical time variable. This also suggests possible scientific applications of DYNAMO to dynamical systems arising in nature. A present limitation of DYNAMO is the need for all base models to have the same input structure. For example, one cannot presently utilize DYNAMO
  to compare language models trained with different encodings (character-based vs. word-based, for example).
sections.heading: A META-MODELS FOR CNNS
sections.text: Our setup in Section 2.2 above can be readily adapted to CNNs, or feedforward neural networks more broadly. For instance, in the case of ResNets, there is a single input x0 followed by a sequence of blocks which operate on different numbers of channels. We let the meta-model likewise be a ResNet with the same block structure. Moreover, we consider the output bt of the tth block in place of theGn(ht)’s in equation 1, and take the hidden states between the t and t+1 blocks to be the ht’s in equation 2. Since each block of a ResNet is distinct, we consider a family of maps Vn,t which depend on the base model n and the block layer t. Suppose B is the total number of blocks. Then we can more explicitly write
  LCNNoutput[F̃ , θ] := 1
  B B∑ t=1 d(bθn,t, bt) (5)
  LCNNhidden[F̃ , θn, {Vn,t}Bt=1] := 1
  B B∑ t=1 ‖Vn,t(hθn,t)− ht‖ 2 2 . (6)
  Then the total loss function accounting for all N of the ResNet base models is
  LCNN[F̃ , {θn}Nn=1, {{Vn,t}Bt=1}Nn=1]
  := 1
  N N∑ n=1 Ex0∼Dn [ LCNNn,hidden[F̃ , θn, {Vn,t}Bt=1] + λLCNNn,output[F̃ , θn] ] (7)
  where we note that in the expectation value we are only sampling over x0’s in Dn since x0’s are the only form of input data.
sections.heading: B ADDITIONAL EXPERIMENTAL DETAILS
sections.text: In this section, we provide further details on our experiments as well as additional empirical results.
  B.1 META-MODEL ARCHITECTURES
  RNN architecture. We parameterize the meta-model for RNNs as a GRU that takes the model embedding vector as an additional input at each time step. Specifically, the meta-model GRU takes as input the vector [xt ; θ] at each time step, where xt is an input token embedding and [ · ; · ] denotes concatenation. The model embedding vector θ therefore serves as a time-independent bias for the meta-model.
  CNN architecture. We parameterize the meta-model for CNNs with a modified ResNet architecture. In each residual block, we use a linear transformation W to map the model embedding vector θ to the corresponding channel dimension of convolutional layer. We then add the vector Wθ to the channels at each spatial location of the feature map. This design emulates the approach used in our parametrization of the RNN meta-model, with the model embedding θ serving as a bias term in each residual block. We reuse the weight matrix W for all residual blocks with the same channel dimension.
  Algorithm 2 Meta-Model Residual Block Input: features x, model embedding vector θ z = BatchNorm(Conv(x)) z = ReLU(z+Wθ) z = BatchNorm(Conv(x)) z = ReLU(x+ z) return z
  The standard ResNet architecture consists of a sequence of four layers, with each layer consisting of a sequence of residual blocks. To compute the hidden state loss Lhidden in DYNAMO, we compute distances between the output representations of each of these four layers, averaging over the number of channels and spatial locations in each set of features.
  B.2 TRAINING DETAILS
  Table 1 lists the hyperparameters used for training our RNN base models and meta-models, and Table 2 lists the hyperparameters used for our CNN base models and meta-models. By default, we use a model embedding dimension of 16. In the case of visualizing the training trajectories of IMDB sentiment GRUs (Figure 3, second column), we use a model embedding dimension of 32 due to the relatively larger number of base models.
  B.3 SUPPLEMENTARY EMPIRICAL RESULTS
  Effect of output loss weight. Figure 9 shows the effect of setting the output loss weight λ = 0 for meta-models on RNNs. These plots illustrate that model clustering can be performed on the basis of comparing hidden state dynamics alone. We note that the change in the λ hyperparameter results in qualitative changes in the resulting clustering. In particular, the model embeddings for GRUs trained on AG News classification (rightmost column of Figure 9) are much more tightly coupled relative to the GRUs trained on the IMDB dataset when λ = 0. This indicates that the dynamics implemented by the AG News GRUs are much more similar than those implemented by the IMDB sentiment GRUs.
  Clustering with other loss functions. As noted in Sec. 4.1, the loss functions used to compare hidden states and outputs can be easily changed to better match the characteristics of the base models under consideration. We demonstrate the benefit of this additional flexibility by replacing the L2 distance in Lhidden (equation 6) with the L1 distance for comparing the intermediate representations of ResNets. This choice is motivated by the observation that the use of the ReLU nonlinearity results in sparse representations, which suggests the use of the L1 metric. Figure 10 shows a comparison between these two distance functions in the case of ResNet-34 models trained on CIFAR-100 with “weak” data augmentation (random shifts and horizontal flips) and with “strong” data augmentation (RandAugment). Here, we parameterized the meta-model with a ResNet-50 architecture. The use of the L1 distance results in a clearer separation between the two sets of models. This is reflected qualitatively in the distribution of the base model embeddings in model embedding space, and quantitatively in the relative scale of the variance captured by the first principal component.
  B.4 FURTHER INVESTIGATION OF THE DYNAMICS OF SENTIMENT ANALYSIS
  Recall that our trained RNN’s implemented sentiment analysis via line attractor dynamics, in which inputted words kicked the hidden state in the ‘positive’ or ‘negative’ direction along the line attractor according to the valence of the word (i.e. how positive or negative the word is). Figure 11 investigates how valences assigned to words change as we scan across model embedding space. Given an RNN corresponding to a value θ, we first find a fixed point h∗ with neutral readout G(h∗) ≈ 0. For this fixed point, we compute G(F (x, h∗)) for a variety of word inputs x. To produce a “score” for the model, we compute
  Score(h∗) = ∑
  x∈Wpositive
  G(F (x, h∗))− ∑
  x∈Wnegative
  G(F (x, h∗))− ∑
  x∈Wneutral
  |G(F (x, h∗))|, (8)
  where the set of positive words Wpositive, negative words Wnegative, and neutral words Wneutral are listed in Table 3. Note that here we are not analyzing context effects, for instance how the string ‘not terrible’ would be rendered into a net-positive valence.
sections.heading: C META-MODELS AND TOPOLOGICAL CONJUGACY
sections.text: In this section we describe the notion of topological conjugacy, its relationship to the loss function Lhidden , and provide speculation as to the interpretation of the results from Section 5. A topological conjugacy (Katok & Hasselblatt, 1997) between two dynamical systems defined by maps F : X → X and E : Y → Y is a homeomorphism Φ : X → Y satisfying
  F (x) = (Φ−1 ◦ E ◦ Φ)(x). (9) Note that the dynamical systems F and E can have distinct domains. The significance of the relationship in equation 9 is that dynamics obtained from iterated applications of the map F and E are
  related to each other by the formula
  Fn(x) = (Φ−1 ◦ En ◦ Φ)(x).
  Thus, if F and E are topologically conjugate, then their iterates are also topologically conjugate and this means that the dynamics are related by a change of variables. Notice that topological conjugacy is an equivalence relation; as such the transitive property tells us that if F ∼ E and E ∼ D then F ∼ D. The notion of topological conjugacy is an important motivation for defining the loss functionLhidden , which we recall is given by
  Lhidden[F , θ, V ] := 1
  T T∑ t=1 ‖V (hθ,t)− ht‖22,
  where the hidden states ht are dynamics obtained from a base model F , the hidden states hθt are dynamics obtained from the meta-model F̃ with parameter θ, and V is the map from the meta-model hidden states to the base model hidden states. One way of obtaining zero loss is to find a topological conjugacy with map V between the meta-model F̃ (at fixed θ) and the base model F , meaning a relationship of the form
  F (x, h) = (V ◦ F̃ )(θ, x, V −1h).
  It is convenient to define the notation Fx(h) := F (x, h) and F̃θ,x(h) := F̃ (θ, x, h). Then we have
  ht = (Fxt ◦ Fxt−1 ◦ · · · ◦ Fx1)(h0) = (V ◦ F̃θ,xt ◦ F̃θ,xt−1 ◦ · · · ◦ F̃θ,x1)(V −1h0) = V hθ,t
  with hθ,0 = V −1h0 , so that Lhidden[F , θ, V ] = 0 would hold. As depicted in Figure 2, to obtain zero loss it would actually suffice to find a weaker relationship of the form
  F (x, V h) = (V ◦ F̃ )(θ, x, h).
  The difference here is that V need not be invertible.
  Using the language of topological conjugacy, we can describe a speculative but plausible interpretation of the results of Section 5. In that section we observed that models from the same cluster had very similar dynamical features and performed similarly to the model average of the cluster. This suggests that for each model Fn in the same cluster, we have
  Fn(x, Vnh) ≈ (Vn ◦ F )(θ, x, h)
  where θ is the centroid of the cluster to which Fn belongs. Note that here we replaced θn with θ, thus assuming both that Lhidden is small and that θn is sufficiently close to θ. Second, making the hypothesis that there exists an inverse V −1n to the map Vn, the map Vn may provide a topological conjugacy between the base model Fn and the meta-model F̃θ evaluated at θ. Assuming further that our assumptions hold for all models in the cluster, using the transitivity of topological conjugacy we would conclude that base models belonging to the same cluster are topologically conjugate to one another. This would justify the intuition suggested by Figure 8 that DYNAMO clusters models according to commonalities of topological structures of dynamics.