neural turing machines - meetupfiles.meetup.com/1406240/2016-06-23_ml-ny-meetup.pdf · conclusion...

38
Neural Turing Machines Tristan Deleu @tristandeleu June 23, 2016

Upload: others

Post on 20-May-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thank you

@tristandeleu! June 23, 2016