Keras: Add synthetic gradient training per "Decoupled Neural Interfaces using Synthetic Gradients"

Created on 19 Aug 2016  路  10Comments  路  Source: keras-team/keras

Most helpful comment

Hi.
This is my experimental reproduction of "Decoupled Neural Interfaces using Synthetic Gradients"
https://github.com/rarilurelo/tensorflow-synthetic_gradient

There are two problems in my code for using Keras as a complete wrapper.

  1. Initial gradient
    Initial gradient can be set by Tensorflow(tf.gradient's grad_ys), but K.gradient has no argument for this.
    Does anyone know how to set initial gradient by Theano?
  2. control dependencies
    An M which synthesis the gradients of the lower layer is trained by the true error descending from the upper layer.
    This gif on DeepMind's blog is very useful to understand this flow(https://deepmind.com/blog/decoupled-neural-networks-using-synthetic-gradients/#gif-1).
    The true error must be computed before the layer updated, so I need to use tf.control_dependencies.
    I think it can be implemented by modifying Model: _make_train_function() and Model's initial argument.
    However tensorflow and theano have different ways to control dependencies, so it's difficult and will be ugly.

Thanks.

All 10 comments

yes please

Hi.
This is my experimental reproduction of "Decoupled Neural Interfaces using Synthetic Gradients"
https://github.com/rarilurelo/tensorflow-synthetic_gradient

There are two problems in my code for using Keras as a complete wrapper.

  1. Initial gradient
    Initial gradient can be set by Tensorflow(tf.gradient's grad_ys), but K.gradient has no argument for this.
    Does anyone know how to set initial gradient by Theano?
  2. control dependencies
    An M which synthesis the gradients of the lower layer is trained by the true error descending from the upper layer.
    This gif on DeepMind's blog is very useful to understand this flow(https://deepmind.com/blog/decoupled-neural-networks-using-synthetic-gradients/#gif-1).
    The true error must be computed before the layer updated, so I need to use tf.control_dependencies.
    I think it can be implemented by modifying Model: _make_train_function() and Model's initial argument.
    However tensorflow and theano have different ways to control dependencies, so it's difficult and will be ugly.

Thanks.

@rarilurelo Initial grads can be set in theano using known_grads option : theano.gradient.grad(cost, wrt, consider_constant=None, disconnected_inputs='raise', add_names=True, known_grads=None, return_disconnected='zero', null_gradients='raise')

@rarilurelo and @llSourcell Please put an example of RNN(LSTM) using synthetic gradient if possible because its no-where at internet and when I tried with myself, I faced lots-off problem.
And one question: How can we updates the weight at particular layer using synthetic gradient, as LSTM layers shared weights so updating the weight of one layer can update the weights of other too ?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

So was this implemented in Keras ?

Any update?

nobody cares :(

@x0rb0t :(

Was this page helpful?
0 / 5 - 0 ratings