Answers.Body: <p>A neural network essentially is a function:</p>
  
  <p><span class="math-container">$$\mathbf{y} = f(\mathbf{x}, \mathbf{\theta})$$</span></p>
  
  <p>Where <span class="math-container">$\mathbf{x}$</span> is a vector input, <span class="math-container">$\mathbf{\theta}$</span> are changeable or learnable parameters, and <span class="math-container">$\mathbf{y}$</span> is a vector output.</p>
  
  <p>There are some variations of this in practice, as you can make special arrangements of <span class="math-container">$\mathbf{x}$</span> and <span class="math-container">$\mathbf{y}$</span>, or use an internal state and feedback loops to allow either or both <span class="math-container">$\mathbf{x}$</span>, <span class="math-container">$\mathbf{y}$</span> to be sequences. However, the above function is basically what a neural network is; how it works beyond that summary are details that you can study.</p>
  
  <p>In <a href="https://en.wikipedia.org/wiki/Supervised_learning" rel="nofollow noreferrer">supervised learning</a>, you are interested in fixed sizes/shapes of <span class="math-container">$\mathbf{x}, \mathbf{y}, \mathbf{\theta}$</span> and trying to find a value of <span class="math-container">$\mathbf{\theta}$</span> such that</p>
  
  <p><span class="math-container">$$f(\mathbf{x}, \mathbf{\theta}) \approx g(\mathbf{x})$$</span></p>
  
  <p>where <span class="math-container">$g(\mathbf{x})$</span> is some "true" function that you care about, and can find or generate examples of, but typically don't fully know. The value <span class="math-container">$\mathbf{\theta}$</span> is called the <em>parameters</em> of the neural network. In addition to these parameters, there are also <em>hyper-parameters</em> of the neural network, which include how many neurons there are in each layer, the valid connections between them, which non-linear function is applied after summing connections between them, etc.</p>
  
  <p>There are learning algorithms used to find <span class="math-container">$\mathbf{\theta}$</span> - the many variations of gradient descent being the most popular. Some algorithms - mainly evolutionary approaches - can also vary hyper-parameters, although a more common approach is to repeatedly find <span class="math-container">$\mathbf{\theta}$</span> using gradient descent, and vary hyper-parameters in different learning trials, using some metric of performance using test data to pick the best one.</p>
  
  <blockquote>
    <p>Can the inputs and outputs of a neural network (NN) be a neural network (that is, neurons and connections), so that "if some NN exist, then edit any NN".</p>
  </blockquote>
  
  <p>Yes - partially. This is a data representation issue. To use it as an input, you would need to express the state of a neural network as a vector - or sequence of vectors - for the input, and the output/edit would also need to be a vector. Probably the simplest way to do this would be to use one network directly output a fixed length vector for <span class="math-container">$\mathbf{\theta}$</span> of the target network given an existing value of <span class="math-container">$\mathbf{\theta}$</span>. That would not allow you to change connections or layer sizes etc, but it would be a very straightforward way to express "one neural network altering another" (ignoring whether this was in any way useful for a task).</p>
  
  <p>If the output was a full representation of the new network, then you would have a function that took as input the definition of one neural network, and output the definition of another network. It would be up to you to convert to/from implemented neural networks and the representations for input <span class="math-container">$\mathbf{x}$</span> and <span class="math-container">$\mathbf{y}$</span>.</p>
  
  <p>If the output <span class="math-container">$\mathbf{y}$</span> was an "edit" for a change <span class="math-container">$\mathbf{x} \rightarrow \mathbf{x}'$</span>, then you would have to decide what edits are allowed, design the representation and write code that applied the edit (the NN would not actually make any changes to another NN by itself). There is no standard way to do this, although there are things you could base this on (such as <a href="https://en.wikipedia.org/wiki/Neuroevolution_of_augmenting_topologies" rel="nofollow noreferrer">NEAT</a>).</p>
  
  <p>The big unanswered question with both of the approaches though is what your "true function" <span class="math-container">$g(\mathbf{x})$</span> is supposed to be. Having a neural network that represents a neural network generator or edit function is only half of the problem. You also need a way to either generate "correct" outputs to learn from, or a way to assess outputs against a goal. </p>
  
  <p>The goal cannot simply be "make a valid edit", as the number of valid edits that will do nothing useful vastly outnumbers the number of edits that have some specific purpose. This is a similar issue to the fact that there are roughly <span class="math-container">$2^{8000000}$</span> valid 1MB files, but only a small proportion of those will be valid image files, and a smaller proportion still will be valid images that represent a natural image that could be taken by a camera. Neural networks that generate natural images therefore must be trained using natural images as a reference, otherwise they will tend to produce meaningless static-like noise.</p>
  
  <blockquote>
    <p>I think that by creating NNs with various inputs and outputs, interacting with each other, and optimizing them with evolution, we can create strong intelligence</p>
  </blockquote>
  
  <p>This is very broadly compatible with an <a href="https://en.wikipedia.org/wiki/Artificial_life" rel="nofollow noreferrer">Articial Life</a> approach to AI. Although there are two differences between what you are proposing and typical A-life approaches:</p>
  
  <ul>
  <li><p>Evolutionary algorithms need some measure of fitness, in order to select the best performing individuals to take forward. A-life solves this by implementing a very open environment that makes no direct judgement on outputs of functions, but allows virtual creatures that collect enough resources (defined in the environment) to procreate. </p>
  
  <ul>
  <li>Your suggestion contains no hint that you are thinking of any kind of measure of success or fitness for either the editing NN or target NN. You will need some measure of fitness at least for the target network (and maybe the editing network too) if you intend to use evolutionary algorithms</li>
  </ul></li>
  <li><p>A-life typically does not treat the evolutionary algorithm itself (the editing or the NNs) as a learning goal. You will not see the results of a good or bad editor until many simulations have passed, so this "meta-search" is likely to be incredibly slow.</p>
  
  <ul>
  <li>A-life simulations are typically already quite slow to reach behaviour which is <em>interesting</em> (because it has emerged without direction from the developer), but usually quite <em>simple</em> for the given environment such as predators chasing prey.</li>
  </ul></li>
  </ul>
  
  <p>From what we know of the evolution of life, a simple feedback mechanism of RNA molecules editing other RNA molecules - the "<a href="https://en.wikipedia.org/wiki/RNA_world" rel="nofollow noreferrer">RNA world</a>" - is considered a likely pre-life step. This has some parallels with what you are suggesting - and this or something similar perhaps, has resulted in intelligent beings such as ourselves. So your idea perhaps has some merit in a theoretical sense. However, it took biology billions of years to go from such a basic stage to self-aware creatures, and this took the full processing power of large numbers of atoms interacting in ways that even all the computers in the world could not simulate in a fraction of real time.</p>
  
  <p>To speed things up, and turn the idea into something feasible, you would need to look into viable environments and evaluations that would focus the learning towards direct measures of intelligence. Also, you would do well to compare your idea about NNs editing NNs with learning approaches that don't use such a feedback loop. </p>
  
  <p>There is no theory that suggests a NN that can edit or output other NNs would offer any advantage for research into strong AI, compared to other search methods. The idea is basically "AI alchemy" - an idea of an experiment that could perhaps be done, but without any theory backing it as being better or worse than other ideas.</p>
  
  <p>Personally, I would expect the search for a NN which is a good NN editor for a NN which has some other task, to be too slow to be useful when faced with very broad tasks such as exhibiting high level reasoning.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-31T16:31:01.130Z
Answers.LastActivityDate: 2019-03-31T22:02:29.490Z
Answers.LastEditDate: 2019-03-31T22:02:29.490Z
Answers.UserDisplayName: Neil Slater
Body: <p>Can the inputs and outputs of a neural network (NN) be a neural network (that is, neurons and connections), so that "if some NN exist, then edit any NN".</p>
  
  <p>I think that by creating NNs with various inputs and outputs, interacting with each other, and optimizing them with evolution, we can create strong intelligence.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-02T03:19:53.227Z
Comments.Text: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/91843/discussion-on-question-by-dimer-can-the-inputs-and-outputs-of-a-neural-network-b).
Comments.UserDisplayName: Ben N
Tags: <neural-networks>
Title: Can the inputs and outputs of a neural network be a neural network?
UserDisplayName: Dimer
ThreadText: # Can the inputs and outputs of a neural network be a neural network?
  
  (Asked by: username_0 on 2019-03-30)
  
  Can the inputs and outputs of a neural network (NN) be a neural network (that is, neurons and connections), so that "if some NN exist, then edit any NN".
  
  I think that by creating NNs with various inputs and outputs, interacting with each other, and optimizing them with evolution, we can create strong intelligence.
  
  **Tags:** neural-networks
  
  > **Comments:**
  > **username_1**: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/91843/discussion-on-question-by-username_0-can-the-inputs-and-outputs-of-a-neural-network-b).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-03-31. Score: 1 | Accepted answer
  
  A neural network essentially is a function:
  
  $$\mathbf{y} = f(\mathbf{x}, \mathbf{\theta})$$
  
  Where $\mathbf{x}$ is a vector input, $\mathbf{\theta}$ are changeable or learnable parameters, and $\mathbf{y}$ is a vector output.
  
  There are some variations of this in practice, as you can make special arrangements of $\mathbf{x}$ and $\mathbf{y}$, or use an internal state and feedback loops to allow either or both $\mathbf{x}$, $\mathbf{y}$ to be sequences. However, the above function is basically what a neural network is; how it works beyond that summary are details that you can study.
  
  In [supervised learning](https://en.wikipedia.org/wiki/Supervised_learning), you are interested in fixed sizes/shapes of $\mathbf{x}, \mathbf{y}, \mathbf{\theta}$ and trying to find a value of $\mathbf{\theta}$ such that
  
  $$f(\mathbf{x}, \mathbf{\theta}) \approx g(\mathbf{x})$$
  
  where $g(\mathbf{x})$ is some "true" function that you care about, and can find or generate examples of, but typically don't fully know. The value $\mathbf{\theta}$ is called the *parameters* of the neural network. In addition to these parameters, there are also *hyper-parameters* of the neural network, which include how many neurons there are in each layer, the valid connections between them, which non-linear function is applied after summing connections between them, etc.
  
  There are learning algorithms used to find $\mathbf{\theta}$ - the many variations of gradient descent being the most popular. Some algorithms - mainly evolutionary approaches - can also vary hyper-parameters, although a more common approach is to repeatedly find $\mathbf{\theta}$ using gradient descent, and vary hyper-parameters in different learning trials, using some metric of performance using test data to pick the best one.
  
  > Can the inputs and outputs of a neural network (NN) be a neural network (that is, neurons and connections), so that "if some NN exist, then edit any NN".
  
  Yes - partially. This is a data representation issue. To use it as an input, you would need to express the state of a neural network as a vector - or sequence of vectors - for the input, and the output/edit would also need to be a vector. Probably the simplest way to do this would be to use one network directly output a fixed length vector for $\mathbf{\theta}$ of the target network given an existing value of $\mathbf{\theta}$. That would not allow you to change connections or layer sizes etc, but it would be a very straightforward way to express "one neural network altering another" (ignoring whether this was in any way useful for a task).
  
  If the output was a full representation of the new network, then you would have a function that took as input the definition of one neural network, and output the definition of another network. It would be up to you to convert to/from implemented neural networks and the representations for input $\mathbf{x}$ and $\mathbf{y}$.
  
  If the output $\mathbf{y}$ was an "edit" for a change $\mathbf{x} \rightarrow \mathbf{x}'$, then you would have to decide what edits are allowed, design the representation and write code that applied the edit (the NN would not actually make any changes to another NN by itself). There is no standard way to do this, although there are things you could base this on (such as [NEAT](https://en.wikipedia.org/wiki/Neuroevolution_of_augmenting_topologies)).
  
  The big unanswered question with both of the approaches though is what your "true function" $g(\mathbf{x})$ is supposed to be. Having a neural network that represents a neural network generator or edit function is only half of the problem. You also need a way to either generate "correct" outputs to learn from, or a way to assess outputs against a goal.
  
  The goal cannot simply be "make a valid edit", as the number of valid edits that will do nothing useful vastly outnumbers the number of edits that have some specific purpose. This is a similar issue to the fact that there are roughly $2^{8000000}$ valid 1MB files, but only a small proportion of those will be valid image files, and a smaller proportion still will be valid images that represent a natural image that could be taken by a camera. Neural networks that generate natural images therefore must be trained using natural images as a reference, otherwise they will tend to produce meaningless static-like noise.
  
  > I think that by creating NNs with various inputs and outputs, interacting with each other, and optimizing them with evolution, we can create strong intelligence
  
  This is very broadly compatible with an [Articial Life](https://en.wikipedia.org/wiki/Artificial_life) approach to AI. Although there are two differences between what you are proposing and typical A-life approaches:
  
  * Evolutionary algorithms need some measure of fitness, in order to select the best performing individuals to take forward. A-life solves this by implementing a very open environment that makes no direct judgement on outputs of functions, but allows virtual creatures that collect enough resources (defined in the environment) to procreate.
  
    + Your suggestion contains no hint that you are thinking of any kind of measure of success or fitness for either the editing NN or target NN. You will need some measure of fitness at least for the target network (and maybe the editing network too) if you intend to use evolutionary algorithms
  * A-life typically does not treat the evolutionary algorithm itself (the editing or the NNs) as a learning goal. You will not see the results of a good or bad editor until many simulations have passed, so this "meta-search" is likely to be incredibly slow.
  
    + A-life simulations are typically already quite slow to reach behaviour which is *interesting* (because it has emerged without direction from the developer), but usually quite *simple* for the given environment such as predators chasing prey.
  
  From what we know of the evolution of life, a simple feedback mechanism of RNA molecules editing other RNA molecules - the "[RNA world](https://en.wikipedia.org/wiki/RNA_world)" - is considered a likely pre-life step. This has some parallels with what you are suggesting - and this or something similar perhaps, has resulted in intelligent beings such as ourselves. So your idea perhaps has some merit in a theoretical sense. However, it took biology billions of years to go from such a basic stage to self-aware creatures, and this took the full processing power of large numbers of atoms interacting in ways that even all the computers in the world could not simulate in a fraction of real time.
  
  To speed things up, and turn the idea into something feasible, you would need to look into viable environments and evaluations that would focus the learning towards direct measures of intelligence. Also, you would do well to compare your idea about NNs editing NNs with learning approaches that don't use such a feedback loop.
  
  There is no theory that suggests a NN that can edit or output other NNs would offer any advantage for research into strong AI, compared to other search methods. The idea is basically "AI alchemy" - an idea of an experiment that could perhaps be done, but without any theory backing it as being better or worse than other ideas.
  
  Personally, I would expect the search for a NN which is a good NN editor for a NN which has some other task, to be too slow to be useful when faced with very broad tasks such as exhibiting high level reasoning.
  
  
  ---
  
  