\section{Algorithm} \label{app:algorithm}

\begin{algorithm}[H]
    \caption{GENNI: Calculate approximate equivalence class using SGD}
    \label{alg:approximate-equivalence-class}
    \begin{algorithmic}[1]
        \Procedure{Calculate-Approximate-Equivalence}{$\theta, C$}
            \State $[\theta]_{\text{Approx}} \gets \emptyset$
            \State Form auxiliary problem $J(\tilde{\theta}) = \frac{1}{\abs{C}}\sum_{x \in C}(\phi(x, \tilde{\theta}) - \phi(x, \theta))^2$
            \State{Generate $m$ starting points $(\theta_i)_{i=1}^m$}
            \For{$j = 1, \dots, m$}
                \State{$\tilde{\theta}_{i} \gets \text{SGD}(J, \theta_{i})$} \Comment{Run SGD on $J(\tilde{\theta})$ starting from $\theta_i$}
                \State $[\theta]_{\text{Approx}} \gets [\theta]_{\text{Approx}} \cup \{\tilde{\theta}_i\}$
            \EndFor
            \State \textbf{return} $[\theta]_{\text{Approx}}$
        \EndProcedure
    \end{algorithmic}
\end{algorithm}

\section{Hyperparameters} \label{app:hyperparameters}

\subsection{LeNet}
The architecture of the network used is as in \cite{lecun1998gradient}.
\begin{table}[H]
\caption{Hyperparameters for the LeNet experiments seen in Section \ref{app:cnn}}
\centering
\begin{tabular}{|l|l|}
\hline
\textbf{Hyperparameter} & \textbf{Value} \\ \hline
Batch size              & 256            \\ \hline
No. of data points       & 8192           \\ \hline
Learning rate           & 0.001          \\ \hline
Seed                    & 0              \\ \hline
Network input dim.      & $28 \times 28$        \\ \hline
Network output dim.     & $1 \times 1$          \\ \hline
Optimizer               & SGD            \\ \hline

\end{tabular}
\end{table}

\subsection{Fully Connected Network}
The fully connected network architecture has four trainable parameters $a, b, c, d \in \R$ and the form:
\begin{align*}
    \phi(x, (a, b, c, d)) &= c \mathrm{ReLU}(a x) + d \mathrm{ReLU}(b x).
\end{align*}
\begin{table}[H]
\caption{Hyperparameters for the simple experiments seen in Section \ref{sec:experiments}}
\centering
\begin{tabular}{|l|l|}
\hline
\textbf{Hyperparameter} & \textbf{Value} \\ \hline
Batch size              & 256            \\ \hline
No. of data points       & 16384           \\ \hline
Learning rate           & 0.015          \\ \hline
Seed                    & 10              \\ \hline
Network input dim.      & $1 \times 1$   \\ \hline
Network output dim.     & $1 \times 1$   \\ \hline
Optimizer               & SGD            \\ \hline
\end{tabular}
\end{table}
\section{Further Visualizations} \label{app:umap_fcn}

In Figure \ref{fig:UMAP_3D}, we use UMAP to visualize the 3D space, and see that the shape of Figure \ref{fig:3d_test} is roughly maintained. 
Importantly, the region remains connected.
We also plot the equivalence class for a 4D subset in Figure \ref{fig:UMAP_4D}.
Here, the shape is generally less interpretable, but the region remains connected.
We do note that visualizations become much less explainable when using UMAP to move to higher dimensions, but that some topological properties, such as connectedness, may still be deduced. 



\begin{figure}[!htbp]

\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.7\textwidth]{figures/Experiments/TestCase/comp-UMAP_3d.jpeg}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.7\textwidth]{figures/Experiments/TestCase/comp-UMAP_4d.jpeg}
\end{subfigure}%

\begin{subfigure}{0.5 \textwidth}
    \centering
    \subcaption{UMAP of a 3D subset.}
    \label{fig:UMAP_3D}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \subcaption{UMAP of a 4D subset.}
    \label{fig:UMAP_4D}
\end{subfigure}%

\caption{In Figure \ref{fig:UMAP_3D} we use the same grid as in Figure \ref{fig:3d_test} but use UMAP to visualise $[\theta]_{\epsilon; \mathcal{I}}$. We also extend the same to 4D (we find an additional $\theta_4$ vector equivalent to $\theta$ via our gradient descent method). The color bars indicate the auxiliary loss for the parameter vectors and also demonstrate our chosen value of $\epsilon = 0.005$ for Figure \ref{fig:UMAP_3D} and $\epsilon = 0.1$ for Figure \ref{fig:UMAP_4D}.
We visualise $\theta_0$, $\theta_1, \theta_2, \theta_3$ and $\theta_4$ on the plot by denoting them by the blue, red, purple, yellow and brown dots. 
For the 3D figure we let the grid bound be $[-2, 2]$ with $50$ points. For the 4D case we let the bound be $[-1, 1]$ with $20$ points.} \label{fig:UMAP_test}
\end{figure}

\section{Convolutional Neural Network Visualization} \label{app:cnn}


By considering a high-dimensional neural network, we can get a more complete picture of the benefits of our method. 
For that we consider the LeNet-5 \cite{lecun1998gradient} convolutional neural network architecture which has $60,000$ parameters. 
Due to the curse of dimensionality, it becomes even more difficult to simply grid the entire space to find equivalent parameters.
Hence, a more principled method for the selection of such subsets is necessary. This makes GENNI a good candidate. 

We replicate the experiments in Section \ref{sec:results}. 
In Figure \ref{fig:2d_lenet} we can see that in contrast to the results for the feedforward network in Section \ref{sec:results}, the hyperplane has a large and wider connected region of low loss. 
We can see similar results in Figures \ref{fig:3d_lenet} and \ref{fig:UMAP_lenet}. 
The width of the equivalence class seems to be due to different symmetry groups acting on convolutional layers and due to the higher dimensionality of the parameter space.
However, we leave further investigations of symmetries to future work. 



\begin{figure}[H]

\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.7\textwidth]{figures/Experiments/LeNet/comp-2d.jpeg}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[scale=0.27]{figures/Experiments/LeNet/2d_contour.pdf}
\end{subfigure}%

\begin{subfigure}{0.5 \textwidth}
    \centering
    \label{fig:2d_surface_lenet}
    \subcaption{Surface Plot (linear scale)}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \label{fig:2d_contour_lenet}
    \subcaption{Contour Plot (log scale)}
\end{subfigure}%


\caption{We fix a parameter vector $\theta$ and use our gradient descent method to find equivalent vectors $\theta_0, \theta_1$ and $\theta_2$. We grid the the hyperplane centered at $\theta_0$ as described in Section \ref{sec:method}. Then $c1$ and $c2$ represent the coordinates of the orthonormal basis vectors. We visualize the space via the auxiliary loss which allows us to visually infer the $\epsilon$-equivalent coefficient sets. We visualize $\theta_0, \theta_1$ and $\theta_2$ as the red, purple and yellow dots.
The grid bound was $[-13, 13]$ with $100$ points. }
\label{fig:2d_lenet}
\end{figure}


\begin{figure}[H]
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.75\textwidth]{figures/Experiments/LeNet/comp-3d_angle_1.jpeg}
    \label{fig:3d_angle1_lenet}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.75\textwidth]{figures/Experiments/LeNet/comp-3d_angle_2.jpeg}
    \label{fig:3d_angle2_lenet}
\end{subfigure}%



\caption{Similar to Figure \ref{fig:2d_lenet}, extended to the 3D case by using our gradient-descent method to find a $\theta_3$ which is equivalent to $\theta$.
$c1, c2$ and $c3$ represent the coordinates of the orthonormal basis vectors. 
The colorbar indicates the auxiliary loss for the parameter vector represented by $c1, c2, c3$ and also demonstrates our chosen value of $\epsilon = 0.0025$.
We plot the 3D plot from different angles to better visualize the shape of the $\epsilon$-equivalent coefficient sets. 
The grid bound was $[-13, 13]$ with $35$ points. 
}
\label{fig:3d_lenet}
\end{figure}





\begin{figure}[H]

\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.75\textwidth]{figures/Experiments/LeNet/comp-UMAP_3d.jpeg}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width=0.75\textwidth]{figures/Experiments/LeNet/comp-UMAP_4d.jpeg}
\end{subfigure}%


\begin{subfigure}{0.5 \textwidth}
    \centering
    \subcaption{UMAP of a 3D subset.}
    \label{fig:UMAP_3D_lenet}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \subcaption{UMAP of a 4D subset.}
    \label{fig:UMAP_4D_lenet}
\end{subfigure}%

\caption{In Figure \ref{fig:UMAP_3D_lenet} we use the same grid as in Figure \ref{fig:3d_lenet} but instead use UMAP to visualize the set of parameters $[\theta]_{\epsilon; \mathcal{I}}$, rather than the coefficients, in 2D. We also extend the same to 4D (we find an additional $\theta_4$ vector equivalent to $\theta$ via our gradient descent method) and again use UMAP to represent it in 2D. The colorbar indicates the auxiliary loss for the parameter vectors and also demonstrates our chosen value of $\epsilon = 0.0025$ for Figure \ref{fig:UMAP_3D_lenet} and $\epsilon = 10^{-5}$ for Figure \ref{fig:UMAP_4D_lenet}.
We visualize $\theta_0$, $\theta_1, \theta_2, \theta_3$ and $\theta_4$ as the blue, red, purple, yellow and brown dots. 
For the 3D figure, the grid bound was $[-13, 13]$ with $35$ points. For the 4D case, the grid bound was $[-1, 1]$ with $20$ points.} \label{fig:UMAP_lenet}
\end{figure}
\section{Extended Applications} \label{app:extended}
In order to visualise the functionally equivalent spaces we turn our attention by investigating equivalent functions for different functions as a way to explore the applicability of our methods to transfer learning and meta-learning.

The first setting we investigate is: given a fixed number of discrete model weights sampled from $\Theta$ and a set of functions sampled from function space $\mc{F}$, we identify the subset of weight vectors that is equivalent to each of the sampled functions.  In order to investigate this, we sample five different functions, where our space of functions, $\mc{M}$, are straight lines and can be seen in figure \ref{fig:distribution}. Our model weight space $\Theta$ is 92 378 different weight vectors of one-layer feedforward neural network of 5 hidden units.

We plot a UMAP in order to visualize the underlying manifold of the equivalent weights of each function and explore the inter-relations between different functions in figure \ref{fig:multiple_functions}. It can be seen that the equivalent weights of each function lie on an underlying manifold since they follow specific patterns, i.e the equivalent weights of $y_1$ and $y_2$ lie on sub-manifolds looking like strips. Another interesting aspect is that some equivalent weight vectors of different functions lie much closer in the manifold than the rest of the equivalent weight vectors of their respective functions. This insight gave us the motivation to explore the possibility of visualizing how our framework can be used to visualize meta-learning geometrically.

In order to visualize meta-learning geometrically, we use the same 5 functions and learn a weight vector for each through gradient descent using the same one-layer neural network architecture as before. We identify other equivalent weight-vectors of each function by searching the $\epsilon$-neighbourhood of each learnt weight vector and keep only the equivalent weight-vectors for every function. Also we train the most widely used neural network meta-learning algorithm MAML \cite{MAML} on the distribution of all the straight lines. We plot a UMAP to visualize the relationship between the MAML initialization and the equivalent weight-vectors of the five functions in figure \ref{fig:umap_metal}.

From the figure it can be seen that some equivalent weight vectors from different functions lie very close to each other forming submanifolds, especially functions $y_1$ and $y_2$. Also it can be seen that the MAML initialization lies at a place where it is very close to 4 out of five equivalent weight vectors of the sampled functions. We can make a tentative assumption that MAML initialization lies at a point that is close to equivalent weight-vectors of multiple different functions.
\begin{figure}[H]
	\centering
	\begin{subfigure}{.48\textwidth}
		\centering
		\includegraphics[width=1\linewidth, height=0.2\textheight]{figures/distribution_functions.png}
		\caption{Distribution of functions}
		\label{fig:distribution}
	\end{subfigure}
		\begin{subfigure}{.48\textwidth}
		\centering
		\includegraphics[width=1\linewidth, height=0.2\textheight]{figures/5_sampled_functions.png}
		\caption{Sampled functions exploring their manifold}
	\end{subfigure}
	\begin{subfigure}{.48\textwidth}
		\centering
		\includegraphics[width=1\linewidth, height=0.2\textheight]{figures/multiple_functions_nice.png}
		\caption{UMAP of losses of the combinations of weights.}
		\label{fig:multiple_functions}
	\end{subfigure}	\begin{subfigure}{.48\textwidth}
		\centering
		\includegraphics[width=1\linewidth, height=0.2\textheight]{figures/MAML4.png}
		\caption{Equivalent functions of each of the 5 functions, along with MAML initialization bias after being trained on the whole distribution of lines}
		\label{fig:umap_metal}
	\end{subfigure}
	\caption{Exploration of equivalent functions and their relationship to meta-learning}
	\label{fig:mich_plots}
\end{figure}

\section{Introduction}

\section{Preliminaries}
The meta learning problem can be described as follows.

\section{Notation}
We let $T$ denote a set of \emph{tasks} where a task is denoted by $t$, where the nature of $t$ will depend on the setting but should describe the task completely. We denote by $?$

\section{Theoretical justification for current methods}

\subsection{Relatedness, Foliations and Transfer Learning}
We begin by stating some definitions. 

\begin{definition}[Relatedness]
Given a set of tasks $T$ and a transformation group $\Pi$, whose elements can act on $T$, two tasks, $x, y \in T$ are said to be \emph{related} to each other iff $\exists \pi_{xy} \in \Pi$, where $\pi_{xy}(x) = y$ and $\pi_{xy}^{-1}(y) = x$.
\end{definition}

This is distinct from similarity. Similarity is a geometric notion, while relatedness is a transformative notion.  

\begin{definition}[$\epsilon$-Similarity]
Give a set of tasks $T$, a metric $\rho$ on $T$, and some number $\epsilon \in \R^+$, two tasks $x, y \in T$ are $\epsilon$-\emph{similar} with respect to $\rho$ if $\rho(x, y) < \epsilon$. 
\end{definition}

The distinction between relatedness and similarity can be seen in Figure \ref{fig:related_vs_similar}.

\begin{figure}[ht]
    \centering
    \includegraphics[width=0.32\textwidth]{figures/related_vs_similar}
    \caption{The distinction between similarity and relatedness. Similarity is defined in terms of an $\epsilon$-ball around a particular element. Here, points $t_2$ and $t_3$ are similar to $t_1$. On the other hand, relatedness is defined in terms of a transformation set; this relationship is shown as a line joining them. Thus, tasks $t_1, t_2$ and $t_3$ are related to each other. However, $t_4$ is not related to $t_2$ and $t_1$ though they are similar; $t_3$ is not similar to $t_2$ and $t_1$, though they are related.}
    \label{fig:related_vs_similar}
\end{figure}

The notion of relatedness depends on the transformation group that is chosen. The transformation group defines are partitioning of the space of tasks $T$. The orbits of the transformation group will be called \emph{set of related tasks}. 
\begin{definition}[Set of related tasks]
Given a set of tasks $T$ and a transformation group $\Pi$ w.r.t which a notion of relatedness is defined on $T$, the orbit. defined by $\orbit_x := \{\pi(x) | \forall \pi \in \Pi\}$ is called the \emph{set of related tasks}.
\end{definition}

Each set of related tasks contains all tasks that are related w.r.t to $\Pi$. These sets define equivalence classes w.r.t the relation given by the chosen notion of relatedness. These equivalence classes are then a partitioning of $T$ into parallel spaces. This is shown in Figure \ref{fig:tessellation}. Such a structure can be described mathematically using foliations. 

\begin{figure} 
    \centering
    \includegraphics[width=0.7\textwidth]{figures/tessellation}

    \caption{The difference between a tessellation and parallel spaces. The shaded regions denote the subsets we are considering in each case. A tessellation creates disjoint, smaller subsets that are of the same dimension as the original set. Parallel spaces on the other hand creates disjoint subsets that are of a lower dimension than the original set.}
    \label{fig:tessellation}
\end{figure}

\subsection{Relation to existing work}
\section{Experiments with statistically justified results}

\end{document}

\section{Experiments} \label{sec:experiments

We consider a simple neural network architecture to compare our visualisations to theoretical expectations. 
Specifically, this is a feedforward network consisting of ReLU non-linearities with the model architecture given by $\phi(x, \theta) = \theta_2^T \relu(\theta_1 x)$ where $\theta_1, \theta_2 \in \mathbb{R}^2$ and $x \in \mathbb{R}$. We consider a more complex architecture in Appendix \ref{app:cnn}, where we replicate our results for the high dimensional LeNet \cite{lecun1998gradient}. 
We compare our visualisations to two theoretically well-understood symmetries for the feedward network: the permutation \cite{Sussman1992,pourzanjani2017improving} and the scaling symmetries \cite{Dinh2017}. 
The latter is due to the non-negative homogeneity property, where for $\alpha \in \R^+$, $\relu(\alpha x) = \alpha\relu(x)$. Therefore, we can scale the input weight to a node by a valid $\alpha$ and its output weight by $\alpha^{-1}$ without changing the function. This symmetry defines a topologically connected equivalence class.




\begin{figure}[!htbp]

\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width= 0.8\textwidth]{figures/Experiments/TestCase/comp-2d.jpeg}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[scale=0.27]{figures/Experiments/TestCase/2d_contour.pdf}
\end{subfigure}%

\begin{subfigure}{0.5 \textwidth}
    \centering
    \label{fig:2d_surface_test}
    \subcaption{Surface Plot (linear scale)}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \label{fig:2d_contour_test}
    \subcaption{Contour Plot (log scale)}
\end{subfigure}%


\caption{We fix a parameter vector $\theta$ and used our method as in Section \ref{sec:method}.
Then $c1$ and $c2$ represent the coordinates of the orthonormal basis vectors. We visualize the space via the auxiliary loss which allows us to visually infer the $\epsilon$-equivalent coefficient sets. We visualize $\theta_0, \theta_1$ and $\theta_2$ on the plot by denoting them by the red, purple and yellow dots.
We let the grid bound be $[-2, 2]$ with $100$ points.}
\label{fig:2d_test}
\end{figure}


In Figure \ref{fig:2d_test}, we consider a 2D subspace of our parameter space and plot the auxiliary loss for each parameter vector. 
We can see that there is a connected region with low loss and the expected shape of $\alpha^{-1}$.
There also seem to be two distinct, yet similar regions of such shapes, which may be attributed to the permutation symmetries. 
However, in Figure \ref{fig:2d_test}, we do not observe the full shape with equally low loss.
This leads us to consider a three dimensional subspace in which we may have access to a more complete view of the equivalence class. 
In Figure \ref{fig:3d_test}, we clearly see two different intersecting surfaces in the shape of $\alpha^{-1}$.
Due to the permutation symmetries, such intersecting surfaces should be expected.
An interesting feature, which is not obviously explained by scaling and permutation symmetries is the hole in Figure \ref{fig:3d_test}(b); may be explained by other groups of symmetries, as discussed in \cite{petzka2020notes}. 

Lastly, we visualise higher-dimensional spaces via UMAP, as can be seen in Appendix \ref{app:umap_fcn}. Such visualisations do seem to be less interpretable however. 
For LeNet \cite{lecun1998gradient} we also observe connectedness albeit with a different geometry and the additional property of a non-empty interior, as can be seen in Appendix \ref{app:cnn}.


\begin{figure}[!htbp]
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width= 0.8\textwidth]{figures/Experiments/TestCase/comp-3d_angle_1.jpeg}
    \label{fig:3d_angle1}
\end{subfigure}%
\begin{subfigure}{0.5 \textwidth}
    \centering
    \includegraphics[width= 1\textwidth]{figures/Experiments/TestCase/comp-3d_angle_2.jpeg}
    \label{fig:3d_angle2}
\end{subfigure}%


\caption{Similar to Figure \ref{fig:2d_test} but extended to the 3D case.
$c1, c2$ and $c3$ represent the coordinates of the orthonormal basis vectors. 
The color bar indicates the auxiliary loss for the parameter vector represented by $c1, c2, c3$ and also demonstrates our chosen value of $\epsilon = 0.0025$.
We plot the 3D plot from different angles to better visualize the shape of the $\epsilon$-equivalent coefficient set on the chosen subset. 
We let the grid bound be $[-2, 2]$ with $50$ points. 
}
\label{fig:3d_test}
\end{figure}







\section{Introduction}

Confusion around identifiability\footnote{
This is not exactly the same as statistical identifiability, which traditionally refers to problems of inference \cite{casella2002statistical}. We are extending this term to discuss model equivalences in deep networks.
} and its consequences in machine learning, especially in deep learning, continues to critically impact aspects of model development. 
Intuitively, identifiability describes the situation where two models defined with distinct parameters in the model parameter space are functionally equivalent. Thus, when learning on the parameter space, one cannot uniquely identify a suitable solution for their problem\footnote{
We note that functionally distinct networks can be unidentifiable due to weaknesses in the loss function. In the present work, only the impact of the network architecture on identifiability is considered.
}.
Such cases can mislead design choices in inference \cite{pourzanjani2017improving} or optimisation \cite{amari1998natural}, and our understanding of generalisability of machine learning models \cite{Dinh2017, sagun2017empirical}. 

For deep learning in particular, the lack of identifiability in the parameter space can lead to multiple global minima \cite{Albertini1993Form, Albertini1993}. For example, this can arise from permutation symmetries, where swapping the incoming and outgoing weights across different pairs of neurons results in the same input-output map. Work in the literature handle these symmetries by a choice of a reparameterisation \cite{pourzanjani2017improving}, regularisation \cite{Draxler2018}, or natural gradients \cite{amari1998natural} to produce an optimisation scheme that is invariant under such symmetries.
However, this is only possible with an understanding of the transformation groups which generate such symmetries.
Often, identifying such symmetries is a tedious undertaking that involves trial and error, and an unreasonable analytical understanding of modern neural network architectures. 
While generally visualisations would be the first method by which to explore poorly understood structures, such intuition aiding tools have not been available. 

Through our tool, GENNI\footnote{The code is available on Github at \url{https://github.com/Do-Not-Circulate/GENNI}.}, we propose to visually and empirically find and explore symmetries of neural networks to guide analytical studies.
GENNI uses an optimisation-based search algorithm to both efficiently and systematically find subsets of high-dimensional parameter spaces that produce equivalent neural networks.
Plots of these parameters then immediately give insight into topological and geometric properties of these equivalent sets. 
We demonstrate how one could reason about identifiability using our visualisations by considering a simple fully connected network for which the symmetries are well understand. 
We believe that using GENNI, such analysis can then be applied to more complex models. 
Our work is in contrast to other methods which visualize the loss landscape \cite{li2018visualizing, Draxler2018}; GENNI is independent of the loss function chosen and finds only the symmetries inherent to the network architecture. 



\input{Theory} 

\input{experiments} \label{sec:results}

\section{Conclusions and Future Work} \label{sec:conclusions}
We propose a scaleable (in the size of the network) method for identifying and visualising equivalent classes of a given parameter vector; which can be used for studying the identifiability problem. We showcased its use on a simple network, where we observed some non-trivial properties of the equivalence class, in addition to the expected symmetries. 
In addition, GENNI can be used to proactively probe regions of interest to, among other applications, inform initialization techniques for deep learning tasks.
Instead of restricting the visualisations to only a hyperplane, GENNI could also be used as a Monte Carlo estimator to generate elements of an equivalence class.
However, this would require further and more principled dimensionality reduction techniques for visualisations.

Immediate future work is to develop an in-depth guide on how to use our visualisations to deduce the symmetries of a specific neural network architecture. We hope to extend such a guide to complicated neural networks, such as the one visualised and depicted in Appendix \ref{app:cnn}. Following this, we will explore how the quotient space, under the defined equivalence relation, looks like using GENNI. Further, we would like to explore extended applications, such as in understanding meta-learning \cite{Hospedales2020} and transfer learning \cite{pan2009survey}. Truly understanding meta-learning requires us to explore additional structure on a set of related models in the model space \cite{petangoda2020foliated}. With GENNI, the behaviour of meta-learning techniques can be better understood.





    


\clearpage


\begin{ack}
We would like to thank Berfin Simsek for presenting her work on weight space symmetries of neural networks \cite{brea2019weight} to us during the initial stages of this project.
\end{ack}

\section{Background}
\todo{Kate and Janith: DO THIS ASAP, you nonces}
\begin{enumerate}
    \item description of the identifiability problem; what have people looked at, how have they approached it?
    \item why is this a problem during optimisation?
    \item quotient spaces; what they do intuitively. How have they been visualised?
    \item mention motivation in transfer learning (reference Janith's work)

\end{enumerate}


\section{Preliminaries}
\subsection{Meta Learning}
The meta learning problem can be thought of as learning to learn. In conventional supervised machine learning, given a dataset of $n$ data points $\D := \{(x_1, y_1) ..., (x_n, y_n )\}$, we want to find a model $f_{\theta^*}$ such that 

\begin{equation} \label{eq:optimal_model}
    \theta^* = \argmin_{\Theta}{\L(\D, \theta; \phi)}.
\end{equation}
Here, $\Theta$ represents the parameter space of the models that we consider. That is, each model $f_\theta$ can be fully described by its parameter $\theta \in \Theta$. $\phi$  denotes the parameters of the learning method. These could include the choice of optimiser, the initialisation of the model parameters, and other hyperparameters. If the problem above is considered the learning problem for a particular task, then learning to learn would be the problem of finding suitable hyperparameters that are ideal for a class of \emph{related} tasks \cite{Hospedales2020}. 

Meta learning attempts to learn \emph{some structure} that is common amongst a set of related tasks such that learning a new task from that set is easier than learning it from scratch. A definition of \emph{relatedness} and \emph{a set of related tasks} is given in Section \ref{sec:relatedness}. Meta-learning methods often describe the full parameter space of the considered models as the product of \emph{global} parameters, and \emph{task-specific} parameters. Methods in transfer learning, few-shot learning and multi-task learning often can be classifed as applications of meta-learning.

Consider the few-shot meta-classification problem. Here, we there is a dataset $\D$ with a large number $N$ of data on a large number $K$ of classes. For each task $t$, we are given a smaller dataset $\D^t = \{(x_1, y_1), (x_n, y_n))\}_{n=1}^{N_t}$ where each input-output pair $(x_n, y_n)$ can be for one of $K^t < K$ classes and $N_t < N$; we must then find a classifier that $c_t$ such that a condition similar to Equation \ref{eq:optimal_model} is satisfied. During the meta-training phase, we are given datasets for several tasks; each dataset is split into training $\D^t_{tr}$ and validation $\D^t_{va}$ sets. The models are usually specified as 


\section{Notation}
We let $T$ denote a set of \emph{tasks} where a task is denoted by $t$, where the nature of $t$ will depend on the setting but should describe the task completely. A space of models is denoted by $\mc{M}$ which is parametrised by $\theta \in \Theta$. We assume that the parameter space can be written as the Cartesian product of outer and inner parameters (often called meta and inner parameters in the meta-learning literature) so that $\Theta = \Phi \times \Psi$ and $\theta = (\phi, \psi)$. Of note is the difference between the parameter space and function space; $\Phi \times \Psi$ and $\mc{M}_{\Phi} \times \mc{M}_{\Psi}$ where the first is typically a vector space while the second is not.

\section{Theoretical justification for current methods}
\subsection{The learning problem}
We begin by stating some definitions.

\begin{definition}
[Learning task]
A learning task is a target function $t: X \rightarrow Y$ which is the core \emph{learnable} component of a ML problem.
\end{definition}
It should be noted that a task here is usually any machine learning problem. This is immediately clear with supervised learning, since the $t$ in the definition is the data generating function. In unsupervised learning, we want to learn a map from the data to the structural components we are considering. For example, in k-means clustering, we learn a map from the data space to the corresponding cluster space; that is, each data point is mapped to its appropriate cluster. In reinforcement learning, a policy, which often maps from the state space to the action space is learned. In general, the learning task doesn't correspond to the data generating function or distribution; it is a map that is a part of ML problem that we can control, and learn. 

\begin{definition}
[Task space]
A space $\T$, where a learning task $t$ is an element of, is called the Task space. 
\end{definition}

\begin{definition}
[Model weight space]
The $d-$dimensional model weight space is $\Theta = \R^d$.
\end{definition}

\begin{definition}
[Model architecture]
Given a model weight space $\Theta$, the model architecture is a map $f: \Theta \times X \rightarrow Y$
\end{definition}

The model weight space gives us the parameter space of some model architecture. For each $\theta \in \Theta$, a model $f_\theta: X \rightarrow Y$ is given. For example, consider a linear model $f_\theta(x) = \theta^Tg(x)$, for $\theta \in \Theta$. In this case, each model $f_\theta$ is unique; that is $(\theta_1 \in \Theta) \neq (\theta_2 \in \Theta) \implies f_{\theta_1} \neq f_{\theta_2}$. In general however, this is not true. 

Consider now the model architecture given by $f_{\sin}(\theta, x) = f_{a, b}(x) = a\sin(x+b)$ for $((a, b) = \theta) \in (\Theta = \R^2)$. In the first parameter $a$, the situation is as the linear case; for any $a \in \R$ and for a fixed $b \in \R$, the model is uniquely identified. However, due to the periodic nature of the sine function, models repeat themselves as we vary along $b$. For example, $f_{a, 0}(x) = a\sin(x) = a\sin(x + 2\pi) = f_{a, 2\pi}$; in general, we can say that $f_{a, b} = f_{a, b+n\pi}$  $\forall n \in \Z$. Thus, we define the \emph{model space} to be as follows. 

\begin{definition}
[Model space] 
Given a model weight space $\Theta$ and a model architecture $f$, we can define an equivalence relation $\sim_m$ by 
\begin{equation} \label{eq:function_equivalence}
    (\theta_1 \in \Theta) \sim_m (\theta_2 \in \Theta) \iff f_{\theta_1}(x) = f_{\theta_2}(x) \quad \forall x \in X.   
\end{equation}
The quotient space $\Model = \Theta/_{\sim_m}$ is called the Model space.
\end{definition}

The model space gives us a way of bringing together all the model weights that are functionally the same w.r.t to the model architecture. We stated previously that the model weight space is Euclidean; the model space however, in general, have to be. In the case of linear models, the model weight space and model space are isomorphic, and the latter is therefore Euclidean. However, in the case of $f_{\sin}$ the model space is isomorphic to the cylinder $C^1 = \R \times \Circle^1$.

In ML, we want to find the element in the model space that best represents the task. We evaluate how well each model represents a tasks using the loss function.

\begin{definition}
[Loss function]
Given a task space $\T$ and a model space $\Model$, a map $l: \T \times \Model \rightarrow \R^+$ is called the loss function.
\end{definition}

The loss function measures a notion of distance between the task and a model. The learning algorithm uses the loss function to then find the best model for the given task; the learning algorithm can only distinguish between 2 models using the loss function. In the same way that 2 weights can correspond to the same function under the equivalence relation given in Equation \ref{eq:function_equivalence}, it is possible for 2 distinct models in $\Model$ to have the loss value. As far as the learning algorithm is concerned, these models are the same. Thus, we can defined a further quotient space. 

\begin{definition}
[Loss-wise identifiable model space]
Given a task $t \in \T$, a model space $\Model$ and a loss function $l$, we can define an equivalence relation $\sim_l$ on $\Model$ by 
\begin{equation} \label{eq:loss_equivalence}
    (m \in \Model) \sim_l (n \in \Model) \iff l(t, m) = \l(t, n).
\end{equation}
The quotient space $\Model_l = \Model/_{\sim_l}$ is called the Loss-wise identifiable model space.
\end{definition}

\subsection{Relatedness, Foliations and Transfer Learning} \label{sec:relatedness}
We begin once more by stating some definitions. 

\begin{definition}[$\Pi$-Relatedness]
Given a set of tasks $T$ and a transformation group $\Pi$ whose elements can act on $T$, two tasks, $t, s \in T$ are said to be $\Pi$-\emph{related} or just related to each other iff $\exists \pi_{ts} \in \Pi$, where $\pi_{ts}(t) = s$ and $\pi_{ts}^{-1}(s) = t$.
\end{definition}

This is distinct from similarity. Similarity is a geometric notion, while relatedness is a transformative notion.  

\begin{definition}[$\epsilon$-Similarity]
Given a set of tasks $T$, a metric $\rho$ on $T$, and some number $\epsilon \in \mathbb{R}^+$, two tasks $t, s \in T$ are $\epsilon$-\emph{similar} or just similar to each other with respect to $\rho$ if $\rho(t, s) < \epsilon$.
\end{definition}

The distinction between relatedness and similarity can be seen in Figure \ref{fig:related_vs_similar}.

\begin{figure}[ht]
    \centering
    \includegraphics[width=0.32\textwidth]{figures/related_vs_similar}
    \caption{The distinction between similarity and relatedness. Similarity is defined in terms of an $\epsilon$-ball around a particular element. Here, points $t_2$ and $t_3$ are similar to $t_1$. On the other hand, relatedness is defined in terms of a transformation set; this relationship is shown as a line joining them. Thus, tasks $t_1, t_2$ and $t_3$ are related to each other. However, $t_4$ is not related to $t_2$ and $t_1$ though they are similar; $t_3$ is not similar to $t_2$ and $t_1$, though they are related.}
    \label{fig:related_vs_similar}
\end{figure}

The notion of relatedness depends on the transformation group that is chosen. The transformation group partitions the space of tasks $T$ into equivalence classes. The orbits of the transformation group will be called \emph{sets of related tasks}. 
\begin{definition}[Set of related tasks]
Given a set of tasks $T$ and a transformation group $\Pi$ w.r.t which a notion of relatedness is defined on $T$, the orbit defined by $\orbit_t := \{\pi(t) \: | \: \forall \pi \in \Pi\}$ is called the \emph{set of related tasks}.
\end{definition}

Each set of related tasks contains all tasks that are related w.r.t to $\Pi$. These sets define equivalence classes w.r.t the relation given by the chosen notion of relatedness. These equivalence classes are then a partitioning of $T$ into parallel spaces. This is shown in Figure \ref{fig:tessellation}. Such a structure can be described mathematically using foliations. 

\begin{figure} 
    \centering
    \includegraphics[width=0.7\textwidth]{figures/tessellation}

    \caption{The difference between a tessellation and parallel spaces. The shaded regions denote the subsets we are considering in each case. A tessellation creates disjoint, smaller subsets that are of the same dimension as the original set. Parallel spaces on the other hand creates disjoint subsets that are of a lower dimension than the original set.}
    \label{fig:tessellation}
\end{figure}

\subsection{Relation to existing work}
\paragraph{Prototypical networks} are a simple and intuitive method of solving the meta learning problem \cite{Snell2017}. This method is applied specifically to the meta-classification problem. The model is as follows.

The key intuition is that each class can be represented by a \emph{prototype} vector in some embedding space. The embeddings of each input in this space, for a particular class will be geometrically \emph{close} to its prototype. The embedding is given by $f_\theta: X \rightarrow C$, where $X$ is the input space, and $C$ is the embedding space. Given $\D_t^{tr}$ and $\D_t^{va}$, the prototype $c_k$ can be found by
\begin{equation}
    c_k = \frac{1}{N_{t,k}}\sum_{i}^{N_{t, k}}{f_\theta(x_i}),
\end{equation}
where $N_{t,k}$ is the number of data points of each class $k$ in the $\D_t^{tr}$, and $x_i$ is the first variable from the pair $(x_i, y_i) \in \D_t^{tr}$. Given a new test input $x$, the distribution over which classes it can be is given by
\begin{equation} \label{eq:prototypical_softmax}
    p(y=k|x) = \frac{\exp(-d(f_\theta(x), c_k))}{\sum_{k^{'}}\exp(-d(f_\theta(x), c_{k^{'}}))},
\end{equation}
where $d: C \times C \rightarrow \R^+$ is a metric on the embedding space. Equation \ref{eq:prototypical_softmax} is a softmax over the distances to the prototypes. 

The collection of all prototypes can be seen as the task specific parameters. The space $C^k = C_1 \times C_2 \times ... \times C_k = \R^k$ then is the space of all tasks that are possible within this set of related tasks. The full model then is specified by $\Theta \times C^k$; in the meta-training phase, we learn the best $\theta \in \Theta$ that best describes the set of related tasks we are given. Then we fix this, and adapt to new tasks by finding their prototypes. The mechanism for finding these is fixed in \cite{Snell2017}; there is no inner loop. 

Thus, we can see that this method has a notion of global and task specific parameters, and fits into the foliated view in this way. 

\subsection{Questions that can be asked}
\subsubsection{Does a new task belong to a particular set of related tasks?}
\paragraph{Question}
Suppose that we choose some model space. The meta-configuration of this model is then given by a chosen foliation. That is, the foliation specifies how we rectify the model space into global and task-specific parameters. Using these, we then meta a model for a set of tasks. We assume that these tasks are related. Typically, given a new task, we would assume that it is in the same set of related tasks, and attempt to adapt the model to it. That is, we would assume that the global parameters are fixed, and retrain the task-specific parameters. How good is the assumption that the new task belongs to the set of related tasks from the training phase? Can we, without having to \emph{train} the model, use the given data, identify how much it belongs to the previous set?

\paragraph{Possible answers}
\begin{itemize}
    \item Assuming that we fix the global parameters, we can evaluate a gradient of the loss function from the dataset of the new task. How different is the direction of this vector from the tangent space at the point of evaluation? That is, does the loss function direct the flow along the leaf given by the set of related tasks? 
    
   The argument here is that if the task does belong on the set of related tasks, then it should belong on the same leaf. If we were to begin on correct the leaf, then we would expect that the flow would, on average, be along the leaf. Maybe there is some analysis that can be done by restricting the loss function to the leaf. How does this compare to the full loss function? How does the difference between the parameter space and the function space of the model affect this? See the example about the sinusoid below. 

    \item The above was a first order test. We could try a zero-order test where we just evaluate the loss function at some random points (within some epsilon) on the same leaf, from the existing solutions. How good is the performance on average?
\end{itemize}


\subsection{Suggested experiments by theoreticians}
\input{experiments}

\subsection{Simple informative examples}
\paragraph{Least Squares.}
The simplest case we consider is that of meta-learning where each task is an instance linear regression. For each task $t$ there is a distribution $\mu$ which generates the data and write $D \sim \mu^n$ to mean that $D = (x_i, y_i)_{i=1}^n$ where each datapair is sampled iid from $\mu$ and the loss is the least squared loss and $x \in \R^{d}, y \in \R$. We assume that the true functional relationship for each task $t$ is given by a linear function, such that we can split $x = (x_{\phi}, x_{\psi})^{T} \in \R^{d_{\phi} + d_{\psi}}$ representing the global and local relationships of the data. The true function is thus given by
\begin{equation} 
    f^t(x) = \theta^{T}x = \phi^{T}x_{\phi} + \psi^{T}x_{\psi}.
\end{equation}
note that here $\phi$ is independent of $t$ since it's global while $\psi$ will change depending on task by assumption of the framework.

In this setting the two sets $\mc{M}_{\Phi} \times \mc{M}_{\Psi}$ and $\Phi \times \Psi$ are isomorphic to each other and we can use the weights $(\phi, \psi)$ to represent functions directly. The diagram of this would be that of a "line" $\R^{d_{\phi}}$ with each point of this line having an orthogonal "line" representing the space $\R^{d_{\psi}}$ \todo{Make trivial foliation figure of space $\mc{M}_{\Phi} \times \mc{M}_{\Psi} = \R^{d_{\phi}} \times \R^{d_{\psi}}$}.

\paragraph{Generalised Least Squares.}
A slight generalisation of this is that of dictionary learning, where instead of using $x = (x_{\phi}, x_{\psi})^{T}$ we define a feature map of $\varphi: \R^d \to \R^F$ where again $F = d_{\phi} + d_{\psi}$ so that we use $\varphi(x)$ in place of $x$ in the least squares setting. This allows us to consider cases where combination of entries in a datapoint $x$ are both in the local and global relationships. In this case we have the functional form for a task to be
\begin{equation}
    f^t(x) =  \phi^{T}\varphi(x)_{\phi} + \psi^{T}\varphi(x)_{\psi}.
\end{equation}

As in the previous setting the function and weight space are isomorphic to each other.

\paragraph{Kernel Linear Regression.}
The most general setting for linear regression in the foliation framework is when we consider $\mc{M}_{\Phi} \times \mc{M}_{\Psi} = \mc{H}_{\Phi} \times \mc{H}_{\Psi}$ where $\mc{H}_{\Phi}, \mc{H}_{\Psi}$ are two arbitrary RKHS's. In this case we have two feature maps $\varphi_{\phi}, \varphi_{\psi}$ which maps to potentially infinite-dimensional RKHS's which are spaces of functions. This also means that the weights in this case will be a pair of functions $\theta = (\phi, \psi) \in \mc{H}_{\Phi} \times \mc{H}_{\Psi}$ and the true function for a task looks like
\begin{equation}
    f^t(x) = \scal{\phi}{\varphi_{\phi}(x)}_{\mc{H}_{\Phi}} + \scal{\psi}{\varphi_{\psi}(x)}_{\mc{H}_{\Psi}}
\end{equation}
An alternative view is that the feature maps in this case is a basis for the space, specifically they may be an orthonormal system. This means that we can view a function $f$ as a Generalised Fourier Series, $f = \sum_{i=1}^{\infty} f_i \varphi_i$ where $f_i = \scal{f}{\varphi_i}_{\mc{H}}$ and $\varphi_i$ is a base vector for the space $\mc{H}$. This would allow us to for example approximate a function through a truncated Fourier series by approximating $f = \sum_{i=1}^{\infty}f_i e_i \approx \sum_{i=1}^{T}f_i e_i$ which allows us to be in the finite vector case which will be simpler to simulate. \todo{clean up section, a lot of things are glossed over and does not necessarily follow convention of e.g. Fourier series with indices, domain of function and what not}

\subsection{Learning a Sinusoidal}
Assume that the function space where all of the true functions live in are of the form $\mc{F} = \{A \cos(x + b) \: | \: A \in \R^{+}, b \in [0, 2\pi)\}$. Arbitrarily we assume that $A = \phi$ and $b = \psi$ so that we are learning the global parameter $A$ which is shared by all tasks (all tasks have functions of the same amplitude) but each task has a different phase. In this case the weight space can be shown to $\Phi \times \Psi \cong \R^{+} \times \S^{1}$, but it also highlights the difference between the weight and function spaces; addition is readily defined for weights as $(A_1, b_1) + (A_2, b_2) = (A_1 + A_2, b_1 + b_2)$ which is in the space (for phase addition is modulo $2\pi$). However if we add these functions together we get 
\begin{align*}
    A_1 \cos(x + b_1) + A_2 \cos(x + b_2)
    & =  A_1 (\cos(x)\cos(b_1) - \sin(x)\sin(b_1) \\
    & \quad + A_2 (\cos(x)\cos(b_2) - \sin(x)\sin(b_2) \\
    & = (A_1\cos(b_1) + A_2\cos(b_2))\cos(x) \\
    & \quad - (A_1\sin(b_1) + A_2\sin(b_2))\sin(x) 
\end{align*}
which is not in the function space.

\section{Optimization Notes}

\input{optimization_notes}
































\section{Isak's Very Nice Algorithm for Great Speed for the Mother Land}
We consider \(f, g\) to be equivalent if \(\norm{f - g} = 0\). The norm that we consider is the L2 norm \(\norm{f - g}^2 = \int (f(x) - g(x))^2 dx\). We can't analytically integrate this but instead use a grid \(X\) over the domain \(\mc{X}\) and consider \(f \sim g\) if \(\norm{f - g}_{X}^2 = \frac{1}{\abs{X}}\sum_{x \in X}(f(x) - g(x))^2\). Regardless of the norm we use (L2 or a discretisation) we want to form the epsilon-approximate quotient bins, so that \(f \sim g\) if \(\norm{f - g}_X \leq \epsilon\). Now, assume that we have a list of functions \((f_i)_{i=1}^N\) and we want to classify these into epsilon-quotient bins \((b_j)_{j=1}^B\). The naive algorithm can be written as follows.

\begin{itemize}
    \item For \(i = 1, \dots, N\)
    \begin{itemize}
        \item For \(j < i\)
        \begin{itemize}
            \item If \(\norm{f_i - f_j}_X \leq \epsilon\) put \(f_i\) into bucket of \(f_j\)
            \item Else let \(f_i\) be a representer of a bin \(b\)
        \end{itemize}
    \end{itemize}
\end{itemize}

If each evaluation \(\norm{f - g}_X = O(c\abs{X})\) then the worst case computational scenario is that \(O(N^2 c \abs{X})\).

In order to speed this up it's possible to use anchor points \((h_j)_{j=1}^M\). The key trick is that for norms we can use the triangle inequality \(\norm{f - h_j}_X = \norm{f - g + g - h_j}_X \leq  \norm{f - g}_X + \norm{g - h_j}_X\) which leads to \(\norm{f - g}_X \geq \abs{\norm{f - h_j}_X - \norm{g - h_j}_X}\). Now, let call the value \(c_{ij} = \norm{f_i - h_j}_X\) then the anchor point algorithm will look as follows

\begin{itemize}
    \item Calculate \(c_{ij}\) for all \((f_i)_{i=1}^N\) and \((h_j)_{j=1}^M\)
    \item For \(i = 1, \dots, N\)
    \begin{itemize}
        \item For \(j < i\)
        \begin{itemize}
            \item \begin{itemize}
                    \item For \(l = 1, \dots, M\)
                    \item \quad If \(\abs{c_{il} - c_{jl}} \geq \epsilon\), break and jump to next \(i\)
                  \end{itemize}
            \item If \(\norm{f_i - f_j}_X \leq \epsilon\) put \(f_i\) into bucket of \(f_j\)
            \item Else let \(f_i\) be a representer of a bin \(b\)
        \end{itemize}
    \end{itemize}
\end{itemize}

\section{Motivation}
What: 
\begin{itemize}
    \item Let $\Theta$ be the weight space (standard topology) and the model architecture be given by $\phi : \Theta \times X \rightarrow Y$ and we say that $\theta_1, \theta_2 \in \Theta$ are equivalent ($\theta_1 \sim \theta_2$) if $\int_X (\phi(\theta_1, x) - \phi(\theta_2, x))^2 dx = 0$.
    \item We now want to find a method to visualize all the equivalence classes under this equivalence – i.e. visualize find the quotient space of $\Theta$ under this equivalence.
    \item Make an identifiable function space; that is, each element in this space is a unique function. 
    \item This removes repeated regions of the weight space. 
\end{itemize}

Why:
\begin{itemize}
    \item Generealizability: https://arxiv.org/pdf/1706.04454.pdf https://arxiv.org/pdf/1703.04933.pdf https://arxiv.org/pdf/1611.01540.pdf This argues that some phenomena observed in generalizability can be explained by symmetries. 
    \item Once we have some graphs. 
\end{itemize}

What:
\begin{itemize}
    \item We already have some optimizations are set-up. There is a lot of exploration left. 
\end{itemize}


Possible applications:
\begin{itemize}
    \item Meta-learning https://arxiv.org/abs/2008.00546.pdf
    \item Generealizability: https://arxiv.org/pdf/1706.04454.pdf https://arxiv.org/pdf/1703.04933.pdf https://arxiv.org/pdf/1611.01540.pdf This argues that some phenomena observed in generalizability can be explained by symmetries. 
    \item Visualize for practioners for smaller cases; some sort of software. Could lead to more intuition. Good way to start rigorously start visualising things, and analysing and understanding model spaces. 
    \item Explainability 
    
\end{itemize}
\end{document}
\section{abstract}
In this paper, we propose an efficient algorithm to visualise symmetries in parametric models. Typically the models that we use are defined w.r.t a parameter space, where non-equal parameters can produce the same function; this is the model unidentifiability problem. The method we propose allows us to identify parameters that are functionally equivalent and to visualise what the space of functions looks like when these symmetries are quotiented out. 
Specifically, we experiment on simple cases, but they identify and provide possible solutions for more complicated scenarios.
In particular we look at optimising the number of comparisons to be done using theoretical lower bounds on differences that we prove. 

\section{Introduction}



READ ASAP
\begin{itemize}
    \item https://arxiv.org/pdf/1906.06994.pdf
    \item https://www.sciencedirect.com/science/article/abs/pii/S0893608005800371
    \item http://bayesiandeeplearning.org/2017/papers/15.pdf
    \item https://www.sciencedirect.com/science/article/abs/pii/S0925231207003967
\end{itemize}





\todo{Kate and Janith: DO THIS ASAP, you nonces}
\begin{itemize}
    \item Why is it important for a model to be identifiable?
    \begin{itemize}
        \item Bayesian paper - unidentifiability makes it difficult to learn using MCMC and VI
        \item avoid inefficient training weights due to unseen similarities/symmetries?
        \item We further enforce the importance with motivating use cases (below)...
    \end{itemize}
    
    \item There are three use cases
    \begin{enumerate}
        \item understanding of NN weight space (symmetries) \begin{itemize}
            \item general understanding
            \item visualise
            \item mathematically represent and analyse the geometry
        \end{itemize}
        \item for better optimisation [bayesian inference paper]
        \begin{itemize}
            \item improving search space
            \item characterises the existance of multiple global minimisers [uniqueness of weights]
        \end{itemize}
        \item quantifying the generalisability of the model/neighbourhoods of models for practical uses
        \begin{itemize}
            \item e.g. improved training and development of ML models in applications [flat minima] 
            \item multitask/meta learning [michilis / janith paper].
        \end{itemize}
    \end{enumerate}
    
    \item Background
    \begin{itemize}
        \item Bayesian Inference paper
        \begin{itemize}
            \item ReLU symmetries
            \item apply to MCMC and VI to get better results
            \item reparameterisation (constraints) that account for the symmetries, does not change the mappings
        \end{itemize}
        \item Uniqueness of Weights for input-output maps
        \begin{itemize}
            \item symmetries in odd functions (e.g. tanh)
            \item Specify finite group of symmetries
            \item Define Irreducibility of NN (another form of symmetries?)
        \end{itemize}
        \item Uniqueness of Weights for NN
        \begin{itemize}
            \item \todo{@Janith}
        \end{itemize}
        \item EXTRA: Uniqueness of weights in single-layer perceptrons - looks at symmetries in a different way...
        \item visualisation tools?
    \end{itemize}
    \item Summary of Work
    \begin{itemize}
        \item Visualisation tool: Mani-PEDI
        \item Given a model architecture and weight space
        \item \todo{@Janith FIX} Analyse the quotient space, where the model is identifiable, after accouting symmetries (through a functional equivalence relation)
        \item Taking its MSE loss function, visualise it (using UMAP)
        \item Show how the visualisation can be interpretted to view where and what (kind) the symmetries are
    \end{itemize}
    \item Contributions
    \begin{itemize}
        \item Visualisation tool 
        \item Optimised search for identifiability
        \item Demonstrations to applications in meta-learning/transfer learning
    \end{itemize}
    \item Paper Layout
\end{itemize}

\section{Meta-Review}

1. Overall Decision
Accept
2. Please provide a brief summary of your decision
This paper proposes an algorithm to visualize the equivalence classes in the parameter space of neural networks. The reviewers raised some issues about presentation (e.g. missing abstract) and points that require clarification. This should be improved in the final version. That said, all reviewers agree that the problem of visualizing the symmetries of the parameter space is very interesting and worthy of inclusion in the workshop. I therefore recommend acceptance of this paper.


\section{Reviews}
\subsection{Review 1}
Questions
1. Please provide a summary of the work
This paper presents a tool to visualise the isotropy group of a parameter on the dataset for a neural network. They show examples of this behaviour in very small neural networks.
2. Please list the strengths of the work along the axes of technical soundness, novelty, technical execution, and experimental design (if applicable).
The work is interesting. I do not think I had ever seen any research along these lines. I cannot asses how good this work is in its context, as I have not seen anything like it before, but a priori I would be worried about its usefulness. Let $G$ be a Lie group acting faithfully on $M$. Assuming that we want to "quotient" by $G$, we are interested in performing optimisation on the space of orbits $M/G$. The present work shows how to visualise the isotropy group $G_x$. I have two main doubts about this approach:
- Why would we want to study $G_x$---\ie, the fibre of $M/G$ at one point, when we actually want to study at least the local structure of $M/G$. This gives no information in this regard.
- Why would we want to visualise it? Visualisations may help in _very_ low dimension, but this is the opposite to the setting that we are working on, that is, that of neural networks.
- We have to solve a full optimisation problem to find (an approximation of) the isotropy group at __one__ point. On the other hand, in optimisation, we want to at least understand the local geometry of our problem or, if we are going to use there results online, the method should not be slower than one forward/backward pass. Given all this, how does this method fit in the picture?

I believe that if the authors are able to answer these questions very clearly and show high dimensional examples that back their method, this could be an interesting paper, as anything that helps visualising the inner workings of a neural network can be potentially interesting.
3. Please briefly highlight the weaknesses, if any, of the current submissions and please recommend concrete suggestions for improvement.
- The paper does not have an abstract?!
- References to books. The authors cite several times Lee's book on optimisation on manifolds when talking about the isotropy group. It is good etiquette when referencing a large textbook on the subject to say at least which section one is referring to, otherwise the reference is does not serve its purpose at all.
- Line 42. "... the structure of the orbit can be non-trivial". What do the authors mean here. Is it related to principal / non-principal orbits? What does it mean for the structure of an orbit to be "non-trivial"?
- Approximation. How does this compare to the obvious solution to this problem: Find a gradient, see that the function is a submersion at that point---there exist directions on which the gradients either zero or very close to zero. Follow those directions. Of course this is notably more expensive, but I would assume that one would explore the isotropy class of the dataset much more efficiently?
Minor:
- Footnote 3. It should be $g_i \circ \dots \circ g_1$.
- The authors should consider compressing the images in the pdf, as the pdf now weights over 10MB and
5. Significance and novelty of contributions
Somewhat Novel, the contributions are interesting and would make for a solid paper if executed well
6. Presentation and Readability
Clearly Written. the paper is easy to read and follow
7. Overall score for this work.
2 (Accept)
8. Please rate your confidence level in your assessment of the overall score.
Somewhat Confident
9. Would you like to nominate this paper as a contributed talk?
No, this paper should not be considered for a contributed talk.

\subsection{Review 2}

Reviewer #6
Questions
1. Please provide a summary of the work
The authors seek to understand the symmetries of (potentially complex) neural networks - a very difficult task. Towards this end, they build a tool which helps visually and empirically explore such symmetries.
2. Please list the strengths of the work along the axes of technical soundness, novelty, technical execution, and experimental design (if applicable).
The idea to use optimization (in particular SGD) to explore symmetries is very interesting. The authors use their method to 'recover' known symmetries of a simple neural network.
3. Please briefly highlight the weaknesses, if any, of the current submissions and please recommend concrete suggestions for improvement.
The simple neural network the authors demonstrate their tool on is extremely simple, and it is not at all obvious that this tool will be effective on complex networks.

Moreover, it is not easy to read the plots their tool is outputting. Perhaps the authors could put together a comprehensive 'guide' displaying what certain symmetries will look like in their tool.

Finally, after applying a dimensionality reduction (UMAP), it seems a lot of the important features the symmetries seem to be lost (although perhaps I'm unable to effectively read the output plots of GENNI).

Nonetheless, I think this paper is worth accepting because I think the idea of visually exploring symmetries of the parameter space is a very important (and also very difficult) problem, and deserves future attention.
5. Significance and novelty of contributions
Somewhat Novel, the contributions are interesting and would make for a solid paper if executed well
6. Presentation and Readability
Minor Presentation Issues. The paper is generally well written but suffers from minor mistakes ---i.e. grammar, unclear notation, experiments etc ...
7. Overall score for this work.
3 (Strong Accept)
8. Please rate your confidence level in your assessment of the overall score.
Not Confident
9. Would you like to nominate this paper as a contributed talk?
Yes, this paper should be a contributed talk at the workshop.

\subsection{Review 3}
Reviewer #7
Questions
1. Please provide a summary of the work
This paper provides a new approach of visualising the equivalence classes of the parameters within neural networks. The approach is a simple one: use SGD to find the parameters and set the loss function as the L2-loss between the network outputs w.r.t. different parameters. The authors provide explicit visualisations on simple networks and show provide some remarks on the topology/geometry of the loss surface.
2. Please list the strengths of the work along the axes of technical soundness, novelty, technical execution, and experimental design (if applicable).
Overall, the paper is well-written and flows nicely. The perspective is interesting too; I think that it explores an interesting area (namely the equivalence classes in the parameter space of networks + the quotient space under this equivalence) which is not explored much in the deep learning community.

The proposed approach to use SGD as an approximate way to identify equivalence classes (which are often intractable otherwise) is reasonable. The authors did not provide the hyper-parameters they used for the algorithm; I am wondering are learning rates standard for example or they require quite a bit of tuning?

Also- what would be the run-time of GENNI? It is mentioned in Section 3 that a Gram-Schmidt procedure is necessary; would this be very slow in practice?
3. Please briefly highlight the weaknesses, if any, of the current submissions and please recommend concrete suggestions for improvement.
While I think the perspective is interesting, there are not too much actionable insights that can be derived from it. For example, I do not see how this would enable practitioners to easily identify regions of good weight initialisation.

Did the authors consider other types of equivalences or other types of group actions? Especially ones where there are non-trivial isotropy groups (fixed points; non-free action) and what would the implications be from the loss surface/deep learning model standpoint?
5. Significance and novelty of contributions
Somewhat Novel, the contributions are interesting and would make for a solid paper if executed well
6. Presentation and Readability
Clearly Written. the paper is easy to read and follow
7. Overall score for this work.
2 (Accept)
8. Please rate your confidence level in your assessment of the overall score.
Somewhat Confident
9. Would you like to nominate this paper as a contributed talk?
No, this paper should not be considered for a contributed talk.
\section{Theory} \label{sec:theory}


Given a domain $\X$ and co-domain $\Y$, we want to find the set of parameters in parameter space $\Theta$ which are functionally equivalent under a model architecture $\phi : \X \times \Theta \rightarrow \Y$.
An equivalence class $[\theta]$ for a parameter $\theta \in \Theta$ is given by the equivalence relation $\theta_1 \sim \theta_2$ iff $\phi(\cdot, \theta_1) = \phi(\cdot, \theta_2)$.
To practically check whether $\theta_1 \sim \theta_2$, a metric on the space of functions (for which the parameters are fixed) is introduced: $d(\phi(\cdot, \theta_1), \phi(\cdot, \theta_2)) = \sqrt{ \int_{\X} \vert \phi(x, \theta_1) - \phi(x, \theta_2) \vert_2^2 \dl x}$.
Then due to the definition of a metric: $\phi(\cdot, \theta_1) = \phi(\cdot, \theta_2)$ iff $d(\phi(\cdot, \theta_1), \phi(\cdot, \theta_2)) = 0$; thus the equivalence holds. 



It is common to express equivalence classes in terms of a group of transformations that result in them; let us denote the group that corresponds to $[\theta]$ by $\G_\theta$. This group can be composed of several smaller groups that each represent a class of symmetries (e.g. the group of permutations $\G_{\mathrm{perm}}$). Then, given a set of groups $\{\G_i\}_{i \in \mathcal{I}}$ acting on a specific $\theta$, the equivalence class $[\theta]$ is the orbit \cite[Chapter~7]{lee2013smooth} of the action of the direct product group $G_1 \times ... \times G_i$, $\forall i \in \mathcal{I}$, denoted as $\G_{\theta}$ \footnote{The group operator is the canonical operator on a direct product of groups.  The group action here is given by the composition of transformations. That is, for $(g_1, ..., g_i) \in \G_\theta$, the action $\pi(\theta, (g_1, ..., g_i)) = g_1 \circ ... \circ g_i(\theta)$}. In order to form  $\G_\theta$, each $G_i$ must be identified. This can be difficult to do for modern neural networks, as they can be overtly over-parameterised with many complex layers (such as CNNs \cite{krizhevsky2012imagenet}, ResNets \cite{he2016deep}, transformers \cite{devlin2018bert}, etc.). 
Furthermore, the set of groups $\G_i$ is not equal for all $\theta$; \cite{petzka2020notes} showed this for a simple feedforward network. Finally, the structure of the orbit can be non-trivial, even once $\G_\theta$ is known. This could, for example, be due to non-trivial isotropy subgroups\footnote{An isotropy, or stabilizer subgroup $(\mathcal{S}_\G(\theta) \subseteq \G) = \{g \in \G | g(\theta) = \theta \}$, where $\theta \in \Theta$, and $g(\theta)$ is the action of $g$ on $\theta$.  It is trivial if $\mathcal{S}_\G(\theta) =\{e\}$, where $e$ is the neutral element of $\G$.} \cite[Chapter~7]{lee2013smooth} of the group action. 

Thus, the equivalence class of $\theta$, and by extension the quotient set $\Theta /_\sim$, can be difficult to study analytically. 
A visualisation of a single equivalence class could help derive the symmetries of various network architectures by looking at its topological and geometric properties, such as connectedness, dimension and curvature, among others. 
Following this, we can gain an understanding of the quotient set by looking at how different equivalence classes in a neighbourhood stack together. While this is useful \cite{meng2018mathcal, Draxler2018}, we presently focus on visualising a single equivalence class; extensions to understanding the quotient set is beyond the scope of this work.

\section{GENNI: Visualising the \textit{G}eometry of \textit{E}quivalences for \textit{N}eural \textit{N}etwork \textit{I}dentifiability}\label{sec:method}

GENNI\footnotemark[4] is our visualisation tool for studying complex symmetries of neural networks.

Since neural network parameter spaces are high-dimensional, it is difficult to find $[\theta]$ via brute-force methods such as exhaustive grid search or random guessing, as they scale exponentially with the number of dimensions. 
At a high level, GENNI uses stochastic gradient descent (SGD) to efficiently search for likely candidates of $[\theta]$, even as the dimension of $\Theta$ increases. 
More concretely, to find parameters which are in $[\theta]$ we randomly initialize vectors in $\Theta$ and use SGD to minimize the auxiliary loss $J(\tilde{\theta}) = \frac{1}{\abs{C}}\sum_{x \in C} \vert \phi(x, \theta) - \phi(x, \tilde{\theta})\vert_2^2$.
We use $J(\tilde{\theta})$ as an approximation of $d(\phi(\cdot, \theta), \phi(\cdot, \tilde{\theta}))$, as seen in the pseudo-code found in Appendix \ref{app:algorithm}. 
With this method, we can efficiently explore $\Theta$ to find parameters with low enough loss\footnote{In a practical setting, this means that the loss should be comparable to a parameter that has been found by known symmetries.} to be considered in $[\theta]$.
Given the points found by GENNI, we conjecture that the hyperplane they lie in contains further 'good' solutions, making it more suitable for visualisation than a randomly chosen subset.


To construct an $m$ dimensional hyperplane for a visualisation, we run GENNI until we find $m+1$ linearly independent vectors with low enough loss.
We then use Gram-Schmidt to produce an orthonormal basis $\{\tilde{\theta_i}\}_{i=1}^m$ for the hyperplane from the set of vectors $\{(\theta_i - \theta_0)\}_{i=1}^m$ centered at $\theta_0$.
Since we can only visualize a finite subset of the hyperplane, we define a grid of coefficients in $\mathbb{R}^{m}$ as $\{c^i\}_{i \in \mathcal{I}}$ where $\mathcal{I}$ is a finite index set for the grid\footnote{Generally, we use a grid which is defined by a grid bound $[a, b]$ and the number of grid points $n$ on that interval. 
The grid for a $m$ dimensional space is then be given by $\bigtimes_m \{a + \frac{i - 1}{n - 1} (b - a) \}_{1 \leq i \leq n}$, which is the Cartesian product of the grid on $[a, b]$.}.
To restrict our search to candidates that approximately belong to $[\theta]$, we choose some sufficiently small $\epsilon > 0$ and construct the set of vectors $[\theta]_{\epsilon; \mathcal{I}} = \{ \theta' | \theta' = \theta_0 + \sum_{i = 1}^m c^j_i \tilde{\theta_i} \in \Theta; J(\theta') < \epsilon; \forall j \in \mathcal{I} \}$, which we call the $\epsilon$-equivalent set.
We can also define the $\epsilon$-equivalent coefficient set as $C([\theta]_{\epsilon; \mathcal{I}}) = \{ c^j | \theta_0 + \sum_{i = 1}^m c^j_i \tilde{\theta_i} \in [\theta]_{\epsilon; \mathcal{I}} \}$.
Since $C([\theta]_{\epsilon; \mathcal{I}}) \subset \mathbb{R}^m$, it can be directly visualised if $m \leq 3$; otherwise, we have to resort to a dimensionality reduction tool, such as UMAP \cite{mcinnes2018umap}.
The runtime of creating such a set is $\mathcal{O}(N)$ where $N$ is the number of grid points. 
However, using standard griding techniques, the runtime will be exponential in the dimension $m$. 
For larger $m$ (approximately $ > 7$), we found that  visualisation was computationally infeasible while trying to be sensitive to the spacing of the grid and the value of $\epsilon$.

We note that there are other methods to locally explore the parameter space or speed-up the population of $[\theta]$ such as continue running SGD as a MCMC sampling method or continue along level sets of the loss $J(\theta)$. 
The disadvantage of these methods for visualization is that we are unable to restrict the subspace in which these solutions lie to be at most three dimensional; which we circumvent by constructing $C([\theta]_{\epsilon; \mathcal{I}})$.
We leave exploration of other methods for future work. 