# Ability of neural network to learn a random neural network

In experimenting with the power of basic neural networks to learn particular functions, I was wondering whether a neural network can learn a random neural network. That is, if we take a neural network $N_0$ of some fixed shape, and randomly initialize the parameters, and then take another neural network $N_1$ of the same shape and train $N_1$ to produce the function given by $N_0$, what happens?

I feel like this is a natural question, and predict that there are others who have tried to do the same. I'm finding it difficult to search for relevant results, though.

Can anyone tell me whether this has been tried before, and where I can find the experimenters' observations?

• Neural networks have the universal approximation quality, so this problem isn't meaningfully different from any other neural network task. – Sycorax Sep 1 '17 at 14:57
• I feel that any universal approximation theorem (that I know of) is not especially relevant to this question: clearly $N_1$ could know the function coded by $N_0$, since the network has the same shape, but I am interested in whether or not it could learn it. Edit: Particularly via standard stochastic techniques like the SGD, but open to analytic methods if that matters. – Mees de Vries Sep 1 '17 at 15:00
• @MeesdeVries Of course $N_1$ could learn $N_0,$ but it could also fall into a local minimum. I'd say the more complex $N_0,$ and the less samples we have, the less likely $N_1$ is to learn $N_0$ exactly. For example, if $N_0$ is a linear function plus some extremely subtle deviations that are small compared to noise, $N_1$ is likely to capture the linear model but not the deviations. Also keep in mind that there are different weight settings that are equivalent. For example, for any hidden layer with $k$ nodes, any of the $k!$ re-orderings of those nodes give equivalent results. – Bridgeburners Sep 1 '17 at 15:08
• The ability of $N_1$ to learn is subject to the same constraints of every other ANN application: you have some data and want to generalize. Choices of architecture, size, regularization and data limitations will all qualify the universal approximation property, so all that's left is to establish what degree of precision is desired at different configurations (since $N_0$ gives you potentially infinite data). – Sycorax Sep 1 '17 at 15:17
• These are all things that I have considered, but I am interested in actual experiments. How well does $N_1$ learn $N_0$, and under what assumptions (there are of course a lot of parameters here: depth, width, activation, training algorithm...). In practice, not in theory. – Mees de Vries Sep 1 '17 at 18:58

## 1 Answer

I'm not aware of any studies to this effect. As Sycorax pointed out in the comments, neural networks are universal function approximators. In theory you could learn to approximate any neural network $N_0$ with another neural network $N_1$. But as Bridgeburners points out, the more complicated $N_0$ the less likely $N_1$ is to learn it correctly. For this reason, I don't think anyone has found it worthwhile to study in general.

If you're interested in reverse-engineering neural networks, then there are some results that might help you:

1. Tramèr, F., et al. (2016). Stealing machine learning models via prediction APIs. 25th Usenix Security Symposium.
2. Oh, S., et al. (2018). Towards reverse-engineering black-box neural networks. ICLR 2018.