All models

Neural Stack / Neural Queue / Neural DeQue

A recurrent network that uses a differentiable stack as its memory.

Language · 6,532 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

This diagram has 6,532 operations (125 KB) and is drawn when you ask.

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
757
Operations
6,532
Framework
PyTorch
Recurrent
Yes
Published
NIPS 2015
Cited by
221 (as of 24 October 2026)
Authors
Edward Grefenstette, Karl Moritz Hermann, Mustafa Suleyman, Phil Blunsom
License
Apache-2.0
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
m18835
Graph hash
564225db3756f6959b2df8dcecb4fbf7f7503efa1717d3419460fac9634fdbe4
Skeleton hash
13255327941d0dbdb95217b283b492c1189defafbd12fcb61d586a2d9d58c9a7
Architecture hash
59aa151a2c739910e6bc73e5594b20acfe68c714560c601770b7d40c5aa25302
Diagram SHA-256
f4d6c05b97fd57f418fac6e0f7b613479f7da066a26fc887ba13a00c7355e1c1
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This model comes from StackNN, a PyTorch project that implements differentiable stacks and queues. It is built with the project's LSTM controller and its Stack structure.

Neural Stacks, Queues and DeQues are differentiable versions of classic data structures that a recurrent network can use as memory. A Neural Stack holds continuous vectors, and its push and pop operations are real values in the interval (0, 1) rather than discrete actions, so every operation stays differentiable.

A Neural Stack model has two parts: a controller network that carries out the computation and a stack that implements the data model. A Neural Queue operates the same way, except that the pop operation reads from the front of the queue rather than the top of the stack. The paper places these models as a middle ground between simple RNNs and the Neural Turing Machine. They provide a logically unbounded memory while keeping push and pop to constant time.

On synthetic transduction tasks, the paper reports that single-layer LSTMs with such a memory solved sequence-to-sequence tasks for which Deep LSTMs falter. A later study that trained stack RNNs on tasks including string reversal found that they are more difficult to train than classical architectures such as LSTMs.

Key idea. The paper proposes memory-based recurrent networks that implement continuously differentiable analogues of Stacks, Queues and DeQues, and shows better generalization than Deep RNNs on synthetic transduction tasks.

  • neural stack
  • neural queue
  • neural deque
  • differentiable stack
  • stack rnn
  • stack-augmented rnn
  • learning to transduce with unbounded memory
  • stacknn
  • differentiable data structures
  • sequence transduction

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

Cite the paper

@misc{grefenstette2015learningtransduceunboundedmemory,
      title={Learning to Transduce with Unbounded Memory}, 
      author={Edward Grefenstette and Karl Moritz Hermann and Mustafa Suleyman and Phil Blunsom},
      year={2015},
      eprint={1506.02516},
      archivePrefix={arXiv},
      primaryClass={cs.NE},
      url={https://arxiv.org/abs/1506.02516}, 
}