Machine Reasoning
2018.12.27
Chin-Hui Chen, Hsiao-Hua Cheng
MSLab Deep Reasoning Team
About
陳晉暉 Chin-Hui Chen (CH)
LinkedIn: https://www.linkedin.com/in/chinhui/
Website: https://brain-and-ai.chyy.app
Today’s slide
Agenda
Y LeCun, et al. Deep learning. (Nature 2015)
What is reasoning?
「推理」是人們由已知或假定的前提來推求結論,或由已知的答案結果,反求其理由根據。例如由因以求果、由果以溯因、由現象以歸其原理、以原理說明現象,包括抽象、類比、演繹、歸納等等思考活動。�
發展心理學的研究指出,人類思考能力從小時候,便開始透過對具體事物的分類與組合來理解事物間的關係,然後約從七歲開始能夠對這些具體事物進行較細緻的邏輯思考,到了十一歲左右智能發展逐漸成熟,便能逐步進行抽象的形式思考。
http://www.atlas-zone.com/science/talk/part_1/science150.htm
Inductive Reasoning (歸納) vs Deductive Reasoning (演繹)
https://www.quora.com/Whats-the-difference-between-inductive-deductive-and-abductive-reasoning
http://roodo.iguang.tw/bizcom/archives/5015757.html
Deductive Reasoning (演繹推理)
https://en.wikipedia.org/wiki/Deductive_reasoning
Natural Deduction 自然演繹法 (歸納vs演繹)
Can neural network learn 18 rules of inference(推論規則) explicity or implicitly? (8蘊含規則, 10等值規則)
https://www.youtube.com/watch?v=sbCdDItHEOE
http://neuralnetworksanddeeplearning.com/images/tikz10.png
Object1 -is in- Object3
Object1 -picked up- Object4
Object2 -went to- Object5
Where is Object4 ? A: Object3
Good at Inductive (tons of training examples)
Neurally plausible? (SGD...)
deep learning (connectionism)
symbolic rules (symbolism)
Intrinsic rules (explicitly or implicitly)
Machine Learning + Reasoning (Knowledge Representation Reasoning)
Machine Reasoning Dataset
Artificial Tasks for Artificial Intelligence (ICLR2015)
NLR: bAbI dataset
Jason Weston, et al. Towards AI-Complete Question Answering: A Set of Prerequisite Toy Tasks 2015
Single/Two/Three supporting factors
Two/Three Argument Relations
Some variants
Black text is spoken by the teacher
Red text denotes responses by the learner
Blue text is provided by an expert student
(+) denotes positive reward external to the dialog
A Nematzadeh, et al. Evaluating Theory of Mind in Question Answering (EMNLP 2018)
Machine Reasoning Dataset
VQA: CLEVR
https://www.cs.ubc.ca/~lsigal/532L/PP_ProgramsForVisualReasoning.pdf
VQA: Abstract Reasoning
DGT Barrett, et al. Measuring abstract reasoning in neural networks (ICML 2018)
Machine Reasoning Dataset
neural math
F Arabshahi, et al. Combining Symbolic Expressions and Black-box Function Evaluations in Neural Programs (ICLR 2018)
logic entailment
R Evans, et al. Can Neural Networks Understand Logical Entailment? (ICLR 2018)
(A entails B if every model in which A is true is also a model in which B is true)
Agenda
Single/Two/Three supporting factors
MemNN appraoch (FAIR)
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
Single/Two/Three supporting factors
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://www.shuang0420.com/2017/12/04/%E8%AE%BA%E6%96%87%E7%AC%94%E8%AE%B0%20-%20Memory%20Networks/
MemNN appraoch (FAIR)
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://www.shuang0420.com/2017/12/04/%E8%AE%BA%E6%96%87%E7%AC%94%E8%AE%B0%20-%20Memory%20Networks/
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
Compare to MemNN (multi-hop/addressing)
http://www.shuang0420.com/2017/12/04/%E8%AE%BA%E6%96%87%E7%AC%94%E8%AE%B0%20-%20Memory%20Networks/
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
http://slazebni.cs.illinois.edu/spring17/lec27_memory.pdf
MemNN appraoch (FAIR)
http://people.idsia.ch/~rupesh/rnnsymposium2016/slides/weston.pdf
http://people.idsia.ch/~rupesh/rnnsymposium2016/slides/weston.pdf
http://people.idsia.ch/~rupesh/rnnsymposium2016/slides/weston.pdf
Recurrent Entity Network
Input Module
Dynamic Memory
Output Model
M Henaff, et al. Tracking the World State with Recurrent Entity Networks (ICLR 2017)
Agenda
Bio-inspired approach
Long short-term memory (LSTM)
https://en.wikipedia.org/wiki/Long_short-term_memory
LSTM
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
forget gate
input gate
update Cell
output gate
LSTM memory operations
�
Bio-inspired approach
Inspired by working memory
Demis Hassabis, et al. Neuroscience-Inspired Artificial Intelligence
(Baddeley, 2012)
https://www.slideshare.net/Frank.van.Harmelen/panel-on-the-future-of-ai-at-the-flamish-royal-society-of-sciences-and-arts
Dorsolateral Prefrontal cortex (DLPFC) and Supplementary Motor Area (SMA)
https://tinyurl.com/yatrslht
NTM
Alex Graves et al. Neural Turing Machines 2014
We need external & explicit memory
Von Neumann architecture scheme
credit from http://cpmarkchang.logdown.com/posts/279710-neural-network-neural-turing-machine
NTM architecture
credit from http://cpmarkchang.logdown.com/posts/279710-neural-network-neural-turing-machine
Traditional RNN
RNN
output(raw)
input
output
Parameters of read & write heads
Memory
write heads (make modifications to the memory)
read heads (get data from memory)
read vector
previous states
credit from https://docs.google.com/presentation/d/1FqU7q-vWN9uV7sMRt9It9F_el9nIdqzBfMPm91hJ4B0/edit#slide=id.g240572a74a_0_134
Reading:
Writing:
wt =addressing(parametert )
(ot , et, at , parametert)=LSTM(xt ; rt-1)
1)
yt = otw + b
2)
3)
4)
Mt = Mt-1
x
o
Addressing
http://llcao.net/cu-deeplearning15/presentation/NeuralTuringMachines.pdf
credit from http://cpmarkchang.logdown.com/posts/279710-neural-network-neural-turing-machine
Sharpen
NTM capabilities
Copy Task
10
20
30
50
120
train on length=20
LSTM Generalization on copy task
Copy Task
Copy Task
Repeat Copy Task
Associative Recall
Brain analogy
Kahana, Michael J. (2012) Foundations of human memory New York: Oxford University Press
Hintzman, D. L. (2003) Robert Hooke’s model of memory Psychonomic Bulletin & Review, 87, 398-410
NTM issues
1. Memory overlap and interfere: no mechanism to ensure that blocks of allocated memory do not overlap and interfere
2. Free memory: no way to free memory; no way to resue memory
3. No way to jump to different parts of memory (limitation of content and location)
Dynamic-NTM (Neural Computation 2018)
Content-based + Dynamic Least Recently Used(LRU) Addressing
Address matrix + Content matrix
Bio-inspired approach
DNC intro
DNC architecture
DNC architecture (cont’)
( feed forward network or RNN (LSTM) )
Selecting locations for reading and writing depends on weightings:
Reading memory (R readers):
b. reading and writing memory
Writing memory:
: where to write: content-based addressing and dynamic memory allocation
: where to read: content-based addressing and temporal memory linkage
c. memory addressing
Content-based addressing:
(both for read and write)
: where to write: content-based addressing and dynamic memory allocation
: where to read: content-based addressing and temporal memory linkage
c. memory addressing
Dynamic memory allocation: (write) allow controller to free and allocate memory as needed
memory retention vector: represents by how much each location will not be freed by the free gates. (1 -> retention t-1 read weighting)
memory usage vector:
free list: sorting the indices of the memory locations in asc order of usage. is the index of the least used location.(least)
allocation weighting: provide new locations for writing.
: where to write: content-based addressing and dynamic memory allocation
: where to read: content-based addressing and temporal memory linkage
c. memory addressing
write weighting: controller can 1. write to newly allocated locations, or 2. to locations addressed by content, or 3. not to write at all.
: where to write: content-based addressing and dynamic memory allocation
: where to read: content-based addressing and temporal memory linkage
c. memory addressing
Temporal memory linkage:
precedence weighting: represents the degree to which location i was the last one written to.
a temporal link matrix: to keep track of consecutively modified memory location.
represents the degree to which location i was the location written to after location j. The rows and columns represent the weights of temporal links going into and out from particular memory slots.
: where to write: content-based addressing and dynamic memory allocation
: where to read: content-based addressing and temporal memory linkage
c. memory addressing
read weighting:
DNC capabilities
http://people.idsia.ch/~rupesh/rnnsymposium2016/slides/graves.pdf
Experiment (copy)
Synthetic question answering experiments (bAbI)
the story “John is in the playground. John picked up the football.” followed by the question “Where is the football?” with answer “playground”
Graph experiments
Graph experiments
random seven-step traversal: 98.8%
four-step shortest path: 55.3%
four-step inference: 81.8%
Brain analogy
Kahana, Michael J. (2012) Foundations of human memory New York: Oxford University Press
credit from https://greydanus.github.io/2017/02/27/differentiable-memory-and-the-brain/
Comparison
| LSTM | NTM | DNC |
I/O | seq2seq | same | same |
Memory capability | relatively short | long | long |
Memory size | cell (512) (babi) | NxW (256x64) | NxW (256x64) |
Memory addressing | NA(forget, input, output gate) | content, location | content, dynamic memory allocation, temporal memory linkage |
Computing cost | 3h (sorting task) | 20h | 72h |
issues | gradient vanish/explode (clip) | memory overlapping inferences | slow |
Capability | Speech Recognition, NLP, ... | simple program task, NMT, meta-learning, ... | simple NLR, graph tasks, enhance RL, ... |
Brain like direction?
https://www.atlasobscura.com/articles/the-birdlike-soviet-flying-machine-that-never-quite-took-off
https://www.mpoweruk.com/flight_theory.htm
Fundamentals of nature intelligence?
MANN for Neural Machine Translation
Mingxuan Wang, et al. Memory-enhanced Decoder for Neural Machine Translation. EMNLP 2016
MANN for One-Shot/Meta Learning
Adam Santoro, et al. Meta-Learning with Memory-Augmented Neural Networks, ICML, 2016
MANN for Stack Emulation
Learning Operations on a Stack with Neural Turing Machines (NIPS 2016 workshop)
MANN for Neural Programming
Jacob Devlin, et al. Neural Program Meta-Induction NIPS 2017
MANN for Reinforcement Learning (Neural Episodic Control)
Alexander Pritzel, et al. Neural Episodic Control. Deepmind 2017
Neural Episodic Control - DND (differentiable neural dictionary)
https://docs.google.com/presentation/d/1rjb7EcHPApf313W-JL40I6tz5NhDel4n53Qbulcb6YA/edit#slide=id.g274915602e_0_2
Experiment
Agenda
Relation Networks (RN)
Hsiao-Hua Cheng
A simple neural network module for relational reasoning (NIPS 2017) https://arxiv.org/abs/1706.01427
Relational Reasoning & Relation Networks
RN-augmented network
RN-augmented network for CLEVR
RN-augmented network for bAbi
RN module
CLEVR Dataset
CLEVR Dataset - Question type
Experiment - CLEVR
Experiment - CLEVR
bAbI Dataset
Ref: https://research.fb.com/downloads/babi/
Experiment - bAbI
Conclusion
Why does RN work?
PW Battaglia, et al. Relational inductive biases, deep learning, and graph networks (Deepmind, MIT, 2018)
Graph Network (GN)
Graph Network (GN)
RN = GN
Working Memory Network
J Pavez et al. Working Memory Networks: Augmenting Memory Networks with a Relational Reasoning Module (ACL 2018)
Agenda
Tensor Product Representation based
http://www.aclweb.org/anthology/N18-1114
filler
role
binding = tensor (out) product
Jay saw Kay != Kay saw Jay
TPR-RNN
Input Module:
I Schlag, et al. Learning to Reason with Third-Order Tensor Products (NIPS 2018)
Update Module:
et(1), et(2)
rt(1), rt(2), rt(3)
st =>
write, move, backlink memory operation
Inference Module:
LN=layer normalization
Some Conclusions
Y LeCun, et al. Deep learning. (Nature 2015)
Thanks
linkedin.com/in/chinhui
fb.me/dongochen
If you have any questions
Related Works
MANN
Graves, Alex, Greg Wayne, and Ivo Danihelka. “Neural turing machines.” arXiv (2014).
Graves, Alex, et al. “Hybrid computing using a neural network with dynamic external memory.” Nature (2016)
Caglar Gulcehre, Sarath Chandar, Kyunghyun Cho, and Yoshua Bengio. “Dynamic Neural Turing Machine with Soft and Hard Addressing Schemes” arXiv (2016).
Caglar Gulcehre, Sarath Chandar, and Yoshua Bengio. “Memory Augmented Neural Networks with Wormhole Connections.” arXiv (2017).
Shiv Shankar, Sunita Sarawagi “Label Organized Memory Augmented Neural Network” NIPS (2017)
Grefenstette, Edward, et al. “Learning to transduce with unbounded memory.” NIPS 2015.
MANN for Language Understanding
Weston, Jason, Sumit Chopra, and Antoine Bordes. “Memory networks.” ICLR (2015).
Sainbayar Sukhbaatar, et al. “End-To-End Memory Networks” NIPS (2015)
Kumar, Ankit, et al. “Ask me anything: Dynamic memory networks for natural language processing.” JMLR (2015).
Zhang, Jiani, et al. “Dynamic Key-Value Memory Network for Knowledge Tracing.” arXiv (2016).
Caiming Xiong, Stephen Merity, Richard Socher. “Dynamic Memory Networks for Visual and Textual Question Answering.” ICML (2016).