Simple and Efficient Learning with Automatic Operation Batching
Graham Neubig http://dynet.io/autobatch/
joint work w/ Yoav Goldberg and Chris Dyer
in
https://github.com/neubig/howtocode-2017
Simple and Efficient Learning with Automatic Operation Batching - - PowerPoint PPT Presentation
Simple and Efficient Learning with Automatic Operation Batching Graham Neubig joint work w/ Yoav Goldberg and Chris Dyer http://dynet.io/autobatch/ in https://github.com/neubig/howtocode-2017 Neural Networks w/ Complicated Structures Words
joint work w/ Yoav Goldberg and Chris Dyer
https://github.com/neubig/howtocode-2017
Phrases Words Sentences
Alice gave a message to Bob
PP NP VP VP S
Dynamic Decisions
a=1 a=1 a=2
graphs, flow control)
“graph” language
Paradigm 2: Dynamic+Eager Evaluation (PyTorch, Chainer)
API is closer to standard Python/C++
decide device placement, etc.
API is closer to standard Python/C++
presentation!)
decide device placement, etc.
much slower than 1 operation of size 10
into one big one
and loss functions, everything else automatic
efficiency group sentences by length)
them to the lookup and loss functions
I hate this movie I love this movie I do n’t hate this movie
very good good neutral bad very bad very good good neutral bad very bad very good good neutral bad very bad
I hate this movie + bias = scores + + +
lookup lookup lookup lookup
W
=
I
I hate this movie + + +
lookup lookup lookup lookup
love that movie
this is an example </s> this is another </s> </s> Padding Loss Calculation Mask
1 1
1
1
1
I hate this movie + bias = scores
W
LSTM LSTM LSTM LSTM LSTM LSTM LSTM LSTM concat
I hate this movie + bias = scores
W
RNN RNN RNN
Phrases Words Sentences
Alice gave a message to Bob
PP NP VP VP S
Dynamic Decisions
a=1 a=1 a=2
implementation relatively complicated)
for minibatch in training_data: loss_values = [] for x, y in minibatch: loss_values.append(calculate_loss(x,y)) loss_sum = sum(loss_values) loss_sum.forward() loss_sum.backward() trainer.update() Just write a for loop! Batching occurs here
must be blazing fast!
embeddings, tree LSTM, dependency parser