Neural Networks with Memory
Memory Networks, End-to-End Memory Networks, Condensed Memory Networks, Neural Turing Machine & Differential Neural Computer
Aaditya Prakash
Nov 5, 2018��
Why?
Siri, play me a good song
Sorry, I couldn’t find a ‘good song’ in your music.
Because AI is good only with context !
Neural Network - limitation
Text source: Sumit Chopra FAIR, DLSS 2016
Why not RNN ?
Reasoning is hard
Bilbo travelled to the cave. Gollum dropped the ring there. Bilbo took the ring.�Bilbo went back to the Shire. Bilbo left the ring there. Frodo got the ring.�Frodo journeyed to Mount-Doom. Frodo dropped the ring there. Sauron died.�Frodo went back to the Shire. Bilbo travelled to the Grey-havens. The End.
Where is the ring?
Where is Bilbo now?
Where is Frodo now?
Reasoning is hard
Bilbo travelled to the cave. Gollum dropped the ring there. Bilbo took the ring.�Bilbo went back to the Shire. Bilbo left the ring there. Frodo got the ring.�Frodo journeyed to Mount-Doom. Frodo dropped the ring there. Sauron died.�Frodo went back to the Shire. Bilbo travelled to the Grey-havens. The End.
Where is the ring? A: Mount-Doom
Where is Bilbo now? A: Grey-havens
Where is Frodo now? A: Shire
Memory Networks
I
G
O
R
Convert the input (x) to internal representation (aka feature space)� - learn embeddings (bow/gru/lstm), use pre-trained vectors (glove/w2v)
Make a memory state (u), write initial data to the memory, update when necessary
Generate the output state, which is combination of memory state and input�
Convert the output (O) into response as desired by the model
Memory Networks
Figure: Saina Sukhbaatar
Memory Networks
Figure: Saina Sukhbaatar
John is in the playground.
Bob is in the office.
John picked up the football.
Bob went to the kitchen.
bABI tasks ---
Where is the football?
Where was Bob before the kitchen?
Where is the football? A:playground
Where was Bob before the kitchen? A:office
Hard Attention (Strong supervision)
Supervision
(hard attention)
Supervision
(hard attention)
Soft Attention (Weak supervision)
Supervision
(soft attention)
Supervision
(soft attention)
Soft Attention (Weak supervision)
Supervision
(soft attention)
Supervision
(soft attention)
Now applicable to more problems where it is hard to get strong supervision
End to End Memory Networks
End to End Memory Networks
One hop is just not sufficient
Condensed Memory Network [ C-MemNN ]
MemNN
Condensed Memory Network [ C-MemNN ]
MemNN
C-MemNN
Condensed Memory Network [ C-MemNN ]
A-MemNN
MemNN
C-MemNN
C-MemNN
Condensed Memory Network [ C-MemNN ]
A-MemNN
C-MemNN
C-MemNN
Condensation of memory state - continuous hierarchy.
Neural Turing Machine
NTM can learn basic algorithms like sorting.
Neural Turing Machine
Sharp functions made smooth. Now can be trained with ‘backpropagation’
Neural Turing Machine
Sharp functions made smooth. Now can be trained with ‘backpropagation’
Neural Turing Machine - Selective Attention
Source: Alex Graves
Neural Turing Machines - Memory
Neural Turing Machines - Memory
Neural Turing Machines - Memory
Forget gate !!
Déjà vu
Neural Turing Machines - Memory
Forget gate !!
Déjà vu
Neural Turing Machines - Memory
Neural Turing Machines - Memory
The key vector kt, & key strength βt, are used to perform content-based addressing of the memory matrix Mt.The resulting content-based weighting is interpolated with the weighting from the previous time step based on the value of the interpolation gate gt.The shift weighting st, determines whether & by how much the weighting is rotated. Depending on γt,the weighting is sharpened and used for memory access.
NTM - Copy
- A simple task of ‘copying’ the input back can be hard, when the time period becomes very long.
- NTM can learn basic algorithms like copy, loop, sort, associative recall, N-gram inference.
NTM - Mult Copy
Copying the same sequence many times.
Differential Neural Computer
Architecture of DNC
Architecture of NTM
Differential Neural Computer
Architecture of DNC
Differential Neural Computer
How DNC Reads Graphs
Differential Neural Computer
Relevant papers
Source materials (also good for tutorials)