All models

Ordered Neurons LSTM (ON-LSTM)

A three-layer LSTM language model whose ordered neurons bias it toward tree-like structure.

Language · 8,840 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 8,840 operations (468 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
25.2M
Operations
8,840
Framework
PyTorch
Recurrent
Yes
Published
ICLR 2019
Cited by
223 (as of 28 October 2026)
Authors
Yikang Shen, Shawn Tan, Alessandro Sordoni, Aaron Courville
License
BSD-3-Clause
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
m19013
Graph hash
96a2c62571ffd9679c7313a49c6aabe88f1215c29845691e30ef89a6aea1d762
Skeleton hash
6879a9f41160c05ed5406eec2e9b408272ead8b4e5f575d72f2bf2c5413f1a66
Architecture hash
49af777b07442eeeaa2cc6b7bc3b031578e1e30b73ef1e232d760bf24ae56f7e
Diagram SHA-256
400721d63f1e5b7ceee77a0f36010f151e8c659ef8fe62295b5d2884740d1677
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

ON-LSTM (ordered neurons LSTM) is a recurrent network that gives the LSTM a bias toward hierarchical structure by ordering its neurons. The motivation is that language is nested: when a larger constituent ends, all of the smaller constituents nested within it must also be closed.

The mechanism is a vector of master input and forget gates, which ensures that when a given neuron is updated, all the neurons that follow it in the ordering are updated too. The gates come from a new activation, cumax(), so the values in the master forget gate increase monotonically from 0 to 1 and those in the master input gate decrease. To limit the extra parameters, the master gates are smaller than the hidden state, and every neuron within a chunk of size C shares the same master gates.

For language modeling on the Penn TreeBank, the paper uses a three-layer ON-LSTM with 1150 units in the hidden layer, an embedding of size 400 and C = 10. The README of the code reports a perplexity of approximately 56.17 on the PTB test set for the default setting. For unsupervised constituency parsing on the WSJ test set, the paper reports its best results from the second layer, while the first and third layers do not perform as well.

Key idea. ON-LSTM orders the neurons of an LSTM with master input and forget gates, so that updating one neuron also updates all the neurons that follow it in the ordering.

  • ON-LSTM
  • Ordered Neurons LSTM
  • Ordered Neurons
  • language model
  • unsupervised parsing
  • tree structure
  • cumax
  • Penn Treebank

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

Cite the paper

@misc{shen2019orderedneuronsintegratingtree,
      title={Ordered Neurons: Integrating Tree Structures into Recurrent Neural Networks}, 
      author={Yikang Shen and Shawn Tan and Alessandro Sordoni and Aaron Courville},
      year={2019},
      eprint={1810.09536},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/1810.09536}, 
}