All models

NAU (Neural Addition Unit)

Linear layer with clamped, sparsity-regularized weights that learns exact addition and subtraction.

16 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 (20 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
202
Operations
16
Framework
PyTorch
Recurrent
No
Published
ICLR 2020
Cited by
26 (as of 24 October 2026)
Authors
Andreas Madsen, Alexander Rosenberg Johansen
License
MIT
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
m18637
Graph hash
222096b7498f7e3c9481e4c96870d4582a83360f255e2f97aabe34c314244bec
Skeleton hash
1e1a34f92996ecd665095aef6a7cfdf53d43a9de82daf3dbde2817d11d84c581
Architecture hash
83250d2231de478e4e316f53a2f51b0cf38cbcf6777cf84e136ed11d554b99aa
Diagram SHA-256
aa080bd07043b5bd2d4b4f704e7ad93ad8b9c3c714183c5961a04169f1adfe4b
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

The Neural Addition Unit (NAU) is a neural network component that can learn exact addition and subtraction. It comes from a paper that starts from the observation that neural networks struggle to perform exact arithmetic operations over real numbers. The same paper presents a second component, the Neural Multiplication Unit (NMU), which can multiply subsets of a vector.

Both units were developed from a theoretical analysis of the earlier Neural Arithmetic Logic Unit (NALU). The NAU itself is a linear layer. Its weights are clamped to the range between -1 and 1 in each training iteration. A sparsity regularizer is one of the paper's changes, alongside a simpler parameter matrix and a new multiplication unit. The authors consider weights close to -1, 0 or 1 important for inferring exact arithmetic operations.

In the paper's experiments the NAU does a subset selection that is followed by either a summation or a multiplication. On the paper's arithmetic datasets the NAU and the older NAC+ both reach a 100% success rate on addition and subtraction, and the NAU solves both tasks faster. The authors did not solve gating between addition and multiplication units and left it for future work.

Key idea. The paper presents the Neural Addition Unit and the Neural Multiplication Unit, two components that learn exact addition and subtraction and multiply subsets of a vector.

  • nau
  • neural addition unit
  • neural arithmetic units
  • neural arithmetic
  • arithmetic extrapolation
  • exact addition
  • exact subtraction
  • arithmetic neural network

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

Cite the paper

@misc{madsen2020neuralarithmeticunits,
      title={Neural Arithmetic Units}, 
      author={Andreas Madsen and Alexander Rosenberg Johansen},
      year={2020},
      eprint={2001.05016},
      archivePrefix={arXiv},
      primaryClass={cs.NE},
      url={https://arxiv.org/abs/2001.05016}, 
}