![Page 1: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/1.jpg)
Neural Turing MachinesTristan Deleu
@tristandeleu! June 23, 2016
![Page 2: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/2.jpg)
Deep Learning
![Page 3: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/3.jpg)
The building blocks
ConvolutionalLayer
Fully connectedLayer
RecurrentLayer
+
Object Recognition Object Detection Image Segmentation
Others
"
"
"
Predictions" Speech Recognition Language Processing
"
"
![Page 4: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/4.jpg)
Examples
+ =
Object Detection
Predictions
+ =
PredictionsSpeech Recognition
+
Image Segmentation
Predictions
Face detection
Automatic speech recognition
=
Image segmentation
![Page 5: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/5.jpg)
Examples
+ +
Object Recognition
Language Processing
Predictions
Sentiment analysis
Image captioning
Machine translation
=
=
=
+
Language Processing
+
Language Processing
Predictions
Language Processing
![Page 6: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/6.jpg)
Frameworks
TheanoTorch
Tensorflow
Keras
Chainer
Neon
CNTK
MXNet
Caffe
LasagneLasagne
![Page 7: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/7.jpg)
Theano + Lasagne
https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py
![Page 8: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/8.jpg)
Neural Turing Machines
![Page 9: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/9.jpg)
Recurrent Neural Network
ht
yt
xt
ht+1
yt+1
xt+1
yt�1
ht�1
xt�1
LSTMtLSTMt�1 LSTMt+1
![Page 10: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/10.jpg)
Memory-augmented Networks
BOAT
Neural Network
Boats float on water You can’t sail against the wind Boats do not fly …
?
• Inspired by neuroscience
• Memory-augmented networks: add an external memory to neural networks to act as a knowledge base
• Keep track of intermediate computations — The story to answer the question in QA problems Memory Networks & Dynamic Memory Networks
![Page 11: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/11.jpg)
Memory-augmented Networks
Memory Networks Dynamic Memory Networks Neural GPU
Neural Stack/Queue/DeQue Stack-augmented RNN
![Page 12: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/12.jpg)
Current state Read Operation New state Write
0 0
1 0
0 1
1 0
Turing Machine
0 1 101010 1 0q0
q0
q0 q0
q0
q1
q1
q1
q1
· · ·
![Page 13: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/13.jpg)
Neural Turing Machine
0 1 101010 1 0q0
Current state Read Operation New state Write
0 0
1 0
0 1
1 0
q0
q0 q0
q0
q1
q1
q1
q1
· · ·
Input Output
?
![Page 14: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/14.jpg)
Heads
0 1 101010$
wt
Mt
$ $ $
Turing Machine Neural Turing Machine
![Page 15: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/15.jpg)
Neural Turing Machine
FFt
ht
yt
rt
xt
xt
FFt+1
ht+1
yt+1
rt+1
xt+1
xt+1
yt�1
ht�1
rt�1
FFt�1
xt�1
xt�1
Mt�1 Mt
%&Controller
%'Read heads
%(Write heads
![Page 16: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/16.jpg)
Neural Turing Machine
ht
yt
rt
xt
xt
ht+1
yt+1
rt+1
xt+1
xt+1
yt�1
ht�1
rt�1
xt�1
xt�1
Mt�1 Mt
LSTMtLSTMt�1 LSTMt+1
%&Controller
%'Read heads
%(Write heads
![Page 17: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/17.jpg)
Neural Turing Machine
)
%*Memory
%&Controller
%'Read heads
%(Write heads
Input Output
&
NTM
![Page 18: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/18.jpg)
Open-source Library
medium.com/snips-ai
github.com/snipsco/ntm-lasagne+
(
![Page 19: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/19.jpg)
NTM-Lasagne
![Page 20: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/20.jpg)
Algorithmic Tasks
• Goal: Learn full algorithms only from input/output examples Generate as much data as we need
• Strong Generalization: Generalize beyond the data the NTM has seen during trainingLonger sequences for example
,?Input Output
P (X,Y )
?
![Page 21: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/21.jpg)
Copy taskInputs
Outputs
EOS
![Page 22: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/22.jpg)
Training
![Page 23: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/23.jpg)
Copy task
![Page 24: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/24.jpg)
Copy task
![Page 25: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/25.jpg)
Copy task
Length 120
![Page 26: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/26.jpg)
Copy task
Length 150
![Page 27: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/27.jpg)
Repeat Copy task
x5EOS
Inputs
Outputs
![Page 28: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/28.jpg)
Repeat Copy task
![Page 29: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/29.jpg)
Repeat Copy task
![Page 30: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/30.jpg)
Associative Recall taskInputs
Outputs
![Page 31: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/31.jpg)
Associative Recall task
![Page 32: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/32.jpg)
Associative Recall task
![Page 33: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/33.jpg)
Priority Sort task
![Page 34: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/34.jpg)
bAbI tasks
![Page 35: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/35.jpg)
bAbI tasks
Mary
John
bathroom
garden
Sandra
hallway
Mary
John
bathroom
garden
Sandra
hallway
Mary went to the garden John went to the garden Mary went back to the hallway Sandra journeyed to the bathroom John went to the hallway Mary went to the bathroom
![Page 36: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/36.jpg)
bAbI tasks
![Page 37: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/37.jpg)
Conclusion
• The NTM is able to learn algorithms only from examples
• It shows better generalization performances compared to other recurrent architecturesFor example LSTMs
• Fully differentiable structureDrawback: generalization is still not quite perfect
• New take on Artificial IntelligenceTrying to teach machines things they can do, the same way we would learn them
• Resources • Theano: http://deeplearning.net/software/theano/ • Lasagne: http://lasagne.readthedocs.io/en/latest/ • NTM-Lasagne: https://github.com/snipsco/ntm-lasagne
@tristandeleu! June 23, 2016
![Page 38: Neural Turing Machines - Meetupfiles.meetup.com/1406240/2016-06-23_ML-NY-meetup.pdf · Conclusion • The NTM is able to learn algorithms only from examples • It shows better generalization](https://reader033.vdocuments.mx/reader033/viewer/2022042218/5ec46b551f6eb751b3238570/html5/thumbnails/38.jpg)
Thank you
@tristandeleu! June 23, 2016