# Can the inputs and outputs of a neural network be a neural network?

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.

• Comments are not for extended discussion; this conversation has been moved to chat. – Ben N Apr 2 '19 at 3:19

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, 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).

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 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" - 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.

• the comment you wrote in other post "where a NN is used to guide mutations by learning a better heuristic than random mutation, and that might count. " . can it accelerate evolution?? i mean... evolution of evolution or something.. – Dimer Apr 1 '19 at 3:44
• at first NN is made randomly by other NN... then after. NN is made meaningfully by NN... – Dimer Apr 1 '19 at 3:49
• I do not think the evolutionary approach will be slow. I think the reason why it took a long time for the earth to make man was that it took a long time to make "the expression of the algorithm". If we appropriately make "the expression of the algorithm", we think it will evolve rapidly. I don't think there's a reason. though – Dimer Apr 1 '19 at 4:14
• my comment can be seem to be dumb.. sorry about that – Dimer Apr 1 '19 at 4:27
• @Dimer: "then after. NN is made meaningfully by NN" - to achieve this, you need to define and measure "meaningfully". Designing that measure of "meaningfully" to lead to intelligent behaviour is the hard part of the problem. In comparison, designing a self-evolving neural network system (that does nothing useful without such a measure) is easy. – Neil Slater Apr 1 '19 at 6:41