Toeplitz-Neural-Network (TNN)
An attention-free sequence model that mixes tokens with relative-position Toeplitz matrices in log-linear time.
Language · 810 operations Checked
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
- Task
- Language
- Parameters
- 19.7M
- Operations
- 810
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICLR 2023
- Cited by
- 10 (as of 27 October 2026)
- Authors
- Zhen Qin, Xiaodong Han, Weixuan Sun and others
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m20983
- Graph hash
- a8a69af13babf55b414c416a69a0a008aa3ac33e601942adcbcc9b168e175948
- Skeleton hash
- cc52e48570c4aa57a83a9099cf1baa5b07d1db3481acad5cc4731538fda0e062
- Architecture hash
- f57f6a076123cd718bccc914bed11102915c6cfdaabca42e429661d6703140ea
- Diagram SHA-256
- 336bde5b41d39b3bf93cde43497ea2a0fa528a408615fceec6841127befb1ff1
- 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 is a stack of six TNN layers of width 512 with the causal option switched on, the setting the reference package recommends for a language model.
The Toeplitz Neural Network (TNN) is a sequence model that relates tokens only through their relative positions. The paper starts from the cost of transformers on long inputs, which it attributes mainly to the quadratic space-time complexity of attention. In place of attention matrices, TNN uses Toeplitz matrices to describe the relation between each pair of tokens. Multiplying a Toeplitz matrix by a vector can be done in O(n log n) time, and that product is the token mixing operation.
The network is a stack of Gated Toeplitz Units (GTU) and GLU layers, where a GTU is a GLU layer with the Toeplitz Neural Operator added. A small sub-network, the relative position encoder, generates the entries of the Toeplitz matrices, so the number of parameters no longer depends on the sequence length. An exponential decay bias is added to the matrix to allow extrapolation to longer inputs.
Trained on 512-token sequences, the model is reported to keep consistent performance on inputs of up to 14K tokens at inference. The paper also shows analytically that transformers, CNNs and state-space-based methods can be derived as special forms of the Toeplitz neural network.
Key idea. The paper models sequences with a relative position encoded Toeplitz matrix and a Toeplitz matrix-vector product, reducing the space-time complexity of sequence modeling to log linear.
- TNN
- Toeplitz Neural Network
- Toeplitz matrix
- sequence modeling
- relative position encoder
- Gated Toeplitz Unit
- attention-free sequence model
- length extrapolation
- long sequence modeling
- log linear complexity
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{qin2023toeplitzneuralnetworksequence,
title={Toeplitz Neural Network for Sequence Modeling},
author={Zhen Qin and Xiaodong Han and Weixuan Sun and Bowen He and Dong Li and Dongxu Li and Yuchao Dai and Lingpeng Kong and Yiran Zhong},
year={2023},
eprint={2305.04749},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2305.04749},
}