Backpropagation through composition of neural networks where one has fixed parameters

31 Views Asked by At

I am currently writing some code that involves two neural networks, and . In this structure, I am giving batch data , where I am trying to train through some loss function . For this problem, has already been pretrained and much larger relative to . I do not want to perform any updates on , I simply want to train . The issue I am having is that performing backpropagation to update the parameters of is taking much longer than expected, it is on the same order as what it took for . I am now thinking that since is being fed into , computing backpropagation needs to run through both networks even though won't be updated. Is this how backpropagation works and could it be the source of my slow code? And if so, are there any work arounds so I don't need to compute the backpropagation through the ?

1

There are 1 best solutions below

0
mkissel On

In backpropagation, the errors are (back-) propagated from the outputs to the neurons of the network in order to compute the gradients. In your arrangement, the neural network, which is not trained, is closer to the outputs than the neural network, which you intend to train. Hence, you need to propagate the errors through this network in order to compute the gradients for the neural network, which you intend to train. So as far as I know, you can not avoid these computations in your setting, if you are using the backpropagation algorithm for training.

If this is a problem for you, then you could try to use another, non-gradient based training algorithm. Possible methods for this are genetic or evolutionary algorithms.