All models

memn2n_babi

End-to-end memory network that answers questions by reading an external memory over several attention hops.

Language · 42 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (5 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
2.6K
Operations
42
Framework
PyTorch
Recurrent
No
Published
2015
Authors
Sainbayar Sukhbaatar, Arthur D. Szlam, Jason Weston, Rob Fergus
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m11986
Graph hash
d15c455c0b3aa25e9774391226b1f41eb7ddda0083e253eaa4bc167e842aa69b
Skeleton hash
f1ca905d4bad3892efb0e5526c56e5a0706223c5b80eb7a04382a25379813cc0
Architecture hash
e3ebcbd4917a2abb9a7cb8092399bcc8264b9a0084d326a48d905f01d76f743f
Diagram SHA-256
739edd199fe88f0cbd1c9ad0ed13aa2c8223906309746c5ce70b1f8d456cf8c3
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

menagerie.classics.memn2n_match_lstm:build_memn2n_babi: build({})

What it is

MemN2N, the End-To-End Memory Network, is a neural network with a recurrent attention model over a possibly large external memory. It reads from that memory multiple times before outputting a symbol. It is a form of Memory Network, but unlike the earlier model it is trained end-to-end and so requires significantly less supervision during training.

Each stored input is embedded as a memory vector, the question is embedded as an internal state, and the match between the state and each memory is an inner product followed by a softmax. The response from the memory is a sum over transformed inputs, weighted by the resulting probability vector. When layers are stacked into several hops, the input to each layer above the first is the sum of the output and the input of the layer below. The hard max operations of the earlier Memory Network are replaced with a continuous weighting from the softmax.

The question answering experiments use the 20 bAbI QA tasks. Unless otherwise stated, they use a model with K = 3 hops and the adjacent weight sharing scheme. On these tasks, as reported at the time, the paper found its best models reasonably close to the supervised Memory Networks, for example 6.7% error for MemNN against 12.6% for MemN2N on the 1k training set, although the supervised models were still superior. Applied to language modeling, the same architecture is reported as comparable to RNNs and LSTMs on the Penn TreeBank and Text8 datasets.

Key idea. The paper makes the Memory Network trainable end-to-end by replacing hard memory lookups with soft attention, and shows that multiple computational hops yield improved results.

  • MemN2N
  • End-To-End Memory Networks
  • end-to-end memory network
  • memn2n_babi
  • bAbI
  • question answering
  • external memory
  • memory hops
  • multi-hop attention

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{sukhbaatar2015endtoendmemorynetworks,
      title={End-To-End Memory Networks}, 
      author={Sainbayar Sukhbaatar and Arthur Szlam and Jason Weston and Rob Fergus},
      year={2015},
      eprint={1503.08895},
      archivePrefix={arXiv},
      primaryClass={cs.NE},
      url={https://arxiv.org/abs/1503.08895}, 
}