Answers.Body: <p>To answer this, it's helpful to consider the notion of a neural network architecture – in this context, we can think of the architecture as being the network depth (i.e. number of layers), width (i.e. number of nodes in a layer), and some other structural aspects, such as recurrent layers, convolution layers, pool layers, etc. </p>
  
  <h3>Theory</h3>
  
  <p>In terms of the theory, there are a few ideas that provide insight into your question. First is the commonly cited <a href="https://en.m.wikipedia.org/wiki/Universal_approximation_theorem" rel="nofollow noreferrer">universal approximation theorem</a>, which states that a single hidden layer, feed forward neural network with a sigmoid activation and finite width (i.e. the number of nodes in single the hidden layer) can approximate any n-dimensional real-valued function. Superficially, this tells us that we can do a whole lot with one of the most simple architectures and could (in theory) approximate more complex architectures such as LSTMs, CNNs, etc.</p>
  
  <p>Yet, while this seems to indicate that reductions are always possible, research on the asymmetry in representational power between depth and width hints that things may not be so simple (for example, see <a href="https://papers.nips.cc/paper/7203-the-expressive-power-of-neural-networks-a-view-from-the-width.pdf" rel="nofollow noreferrer">this paper</a> and <a href="http://proceedings.mlr.press/v49/eldan16.pdf" rel="nofollow noreferrer">this paper</a>). Specifically, network depth provides much greater representational power relative to width. Intuitively, this makes sense – depth allows us to build hierarchies and stack multiple non-linearities. Indeed, this is where we begin to see the outlines of what the answer looks like in practice – depth provides a clear, easy way to bake <em>structure</em> into our network. </p>
  
  <p>So, the upshot from the theoretical perspective is that the universal approximation theorem answers in the affirmative; yes, you could reduce a complex network architecture to a single hidden layer network, but the basis for doing this is a bit naïve – it doesn't consider the efficiency of the network relative to the number of parameters.The two papers linked above imply this.</p>
  
  <h3>Practice</h3>
  
  <p>In practice, there are issues with performing such a reduction. To date, the most successful models have deep architectures. More importantly though, many of these models are specialized – we have CNNs for computer vision, RNNs for sequence-based data, etc. These architectures were conceived as a way to integrate knowledge about the structure of the problem into the structure of the network to improve learning of the desired representation, and this too requires depth. </p>
  
  <p>In fact, last year a paper took this idea to the extreme. <a href="https://weightagnostic.github.io/" rel="nofollow noreferrer">Weight agnostic neural networks</a> are specifically constructed such that their architecture is in essence the representation with a single parameter (weight) that can be varied to generate multiple distinct models with different performance characteristics. The WANNs that were developed in this research weren't especially deep, but they also weren't single layered. </p>
  
  <p>The upshot here is that, for complex problems, depth is necessary for efficient learning and gradient computation and that it can be used to encode problem structure into a network. While it may be possible to reduce a learned representation to a single hidden layer network, it's not inconceivable that you may end up with <em>more</em> parameters condensed into a single hidden layer with very high dimensional gradients. In terms of implementation, this isn't desirable. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-31T10:39:06.510Z
Answers.Text: As far as I know using a complex model to train a simpler one has been done. Probably by Schmidhuber. I'm not sure they still do it.
Answers.UserDisplayName: BlindKungFuMaster
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-31T10:45:27.543Z
Answers.Text: See also [One Model To Learn Them All](https://arxiv.org/abs/1706.05137) (2017) by Lukasz Kaiser et al.
Answers.UserDisplayName: BlindKungFuMaster
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-10-27T18:29:53.893Z
Answers.LastActivityDate: 2020-02-28T18:32:37.473Z
Answers.LastEditDate: 2020-02-28T18:32:37.473Z
Answers.UserDisplayName: Greenstick
Body: <p>I have read the paper <a href="https://arxiv.org/pdf/1410.5401.pdf%20" rel="nofollow noreferrer">Neural Turing Machines</a> and the paper <a href="https://www.sciencedirect.com/science/article/pii/S0022000085710136" rel="nofollow noreferrer">On the Computational Power of Neural Nets</a> about the computational power of neural networks. However, it isn't still clear to me one thing.</p>
  
  <p>Is there a way of converting a neural network to another one that represents the same function? For example, given a trained recurrent neural network that represents a certain function, is it possible to convert this RNN to e.g. an MLP that represents the same function?</p>
  
  <p>If an answer to the above question exists, can we show the equivalence between neural networks, e.g., all problems solved by a multilayer perceptron can be solved by a recurrent neural network, but the opposite is not true, i.e., MLP is subset of RNN (I do not know if this is true, it is just an example). So, if we obtain this relationship between all neural networks, we can get a neural network <span class="math-container">$X$</span> that is more powerful than others, so, we can throw away all other neural networks because <span class="math-container">$X$</span> can solve any problem that other NN can. Is this reasoning correct?</p>
  
Tags: <neural-networks><comparison><function-approximation><computational-learning-theory>
Title: Is there a way of converting a neural network to another one that represents the same function?
UserDisplayName: ViniciusArruda
ThreadText: # Is there a way of converting a neural network to another one that represents the same function?
  
  (Asked by: username_0 on 2017-10-27)
  
  I have read the paper [Neural Turing Machines](https://arxiv.org/pdf/1410.5401.pdf%20) and the paper [On the Computational Power of Neural Nets](https://www.sciencedirect.com/science/article/pii/S0022000085710136) about the computational power of neural networks. However, it isn't still clear to me one thing.
  
  Is there a way of converting a neural network to another one that represents the same function? For example, given a trained recurrent neural network that represents a certain function, is it possible to convert this RNN to e.g. an MLP that represents the same function?
  
  If an answer to the above question exists, can we show the equivalence between neural networks, e.g., all problems solved by a multilayer perceptron can be solved by a recurrent neural network, but the opposite is not true, i.e., MLP is subset of RNN (I do not know if this is true, it is just an example). So, if we obtain this relationship between all neural networks, we can get a neural network $X$ that is more powerful than others, so, we can throw away all other neural networks because $X$ can solve any problem that other NN can. Is this reasoning correct?
  
  **Tags:** neural-networks, comparison, function-approximation, computational-learning-theory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-10-27. Score: 4
  
  To answer this, it's helpful to consider the notion of a neural network architecture – in this context, we can think of the architecture as being the network depth (i.e. number of layers), width (i.e. number of nodes in a layer), and some other structural aspects, such as recurrent layers, convolution layers, pool layers, etc.
  
  ### Theory
  
  In terms of the theory, there are a few ideas that provide insight into your question. First is the commonly cited [universal approximation theorem](https://en.m.wikipedia.org/wiki/Universal_approximation_theorem), which states that a single hidden layer, feed forward neural network with a sigmoid activation and finite width (i.e. the number of nodes in single the hidden layer) can approximate any n-dimensional real-valued function. Superficially, this tells us that we can do a whole lot with one of the most simple architectures and could (in theory) approximate more complex architectures such as LSTMs, CNNs, etc.
  
  Yet, while this seems to indicate that reductions are always possible, research on the asymmetry in representational power between depth and width hints that things may not be so simple (for example, see [this paper](https://papers.nips.cc/paper/7203-the-expressive-power-of-neural-networks-a-view-from-the-width.pdf) and [this paper](http://proceedings.mlr.press/v49/eldan16.pdf)). Specifically, network depth provides much greater representational power relative to width. Intuitively, this makes sense – depth allows us to build hierarchies and stack multiple non-linearities. Indeed, this is where we begin to see the outlines of what the answer looks like in practice – depth provides a clear, easy way to bake *structure* into our network.
  
  So, the upshot from the theoretical perspective is that the universal approximation theorem answers in the affirmative; yes, you could reduce a complex network architecture to a single hidden layer network, but the basis for doing this is a bit naïve – it doesn't consider the efficiency of the network relative to the number of parameters.The two papers linked above imply this.
  
  ### Practice
  
  In practice, there are issues with performing such a reduction. To date, the most successful models have deep architectures. More importantly though, many of these models are specialized – we have CNNs for computer vision, RNNs for sequence-based data, etc. These architectures were conceived as a way to integrate knowledge about the structure of the problem into the structure of the network to improve learning of the desired representation, and this too requires depth.
  
  In fact, last year a paper took this idea to the extreme. [Weight agnostic neural networks](https://weightagnostic.github.io/) are specifically constructed such that their architecture is in essence the representation with a single parameter (weight) that can be varied to generate multiple distinct models with different performance characteristics. The WANNs that were developed in this research weren't especially deep, but they also weren't single layered.
  
  The upshot here is that, for complex problems, depth is necessary for efficient learning and gradient computation and that it can be used to encode problem structure into a network. While it may be possible to reduce a learned representation to a single hidden layer network, it's not inconceivable that you may end up with *more* parameters condensed into a single hidden layer with very high dimensional gradients. In terms of implementation, this isn't desirable.
  
  > **Comments:**
  > **username_2**: As far as I know using a complex model to train a simpler one has been done. Probably by Schmidhuber. I'm not sure they still do it.  
  > **username_2**: See also [One Model To Learn Them All](https://arxiv.org/abs/1706.05137) (2017) by Lukasz Kaiser et al.  
  
  ---
  
  