TSLib Reformer
A Transformer forecaster from TSLib built on locality-sensitive hashing attention for long sequences.
Time series · 260 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
- Time series
- Parameters
- 5.8M
- Operations
- 260
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICLR 2020
- Cited by
- 1,434 (as of 23 October 2026)
- Authors
- Nikita Kitaev, Łukasz Kaiser, Anselm Levskaya
- 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
- m3042
- Graph hash
- f0cd476061df70031d4bd070ffa58f451e5724ecf43a9982b67faf33834a939f
- Skeleton hash
- 616e9c0e5f8195ca0143da79919fdbf3e5bf41b7f198c25c7d096e2017fa8b83
- Architecture hash
- 121fc78a5e0e10490f3f5c967e001a98cb8c03bea64ec5d05a4a6c8c178c0231
- Diagram SHA-256
- 89416c5e8ddc47f17001ddf92596d5d3249b7554f4226c2a50cc9e56eb151432
- 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
Reformer is a Transformer variant that its paper describes as performing on par with Transformer models while being much more memory-efficient and much faster on long sequences. It replaces dot-product attention with attention based on locality-sensitive hashing (LSH), which changes the complexity of attention from O(L^2) to O(L log L) for a sequence of length L. LSH attention restricts each query position to the items that share its hash bucket. Because similar items can still land in different buckets, the hashing can be repeated over multiple rounds to lower that probability.
The paper also uses reversible residual layers in place of standard residuals, so activations are stored only once during training instead of once per layer. Activations inside the feed-forward layers are split and processed in chunks to save memory. The paper's experiments cover a synthetic task, the enwik8 text task with sequences of length 64K, and imagenet-64 image generation with sequences of length 12K. On enwik8, the paper reports 1.19 bits/dim on the test set for a 12-layer model trained for 20K steps.
The paper's conclusion names time-series forecasting among the other domains the Reformer could serve. The version shown here is the implementation in the Time Series Library (TSLib). TSLib is a code base for evaluating deep time series models on long- and short-term forecasting, imputation, anomaly detection, and classification.
Key idea. Reformer replaces dot-product attention with locality-sensitive hashing attention, changing attention complexity from O(L^2) to O(L log L) in the sequence length L.
- reformer
- tslib reformer
- efficient transformer
- locality-sensitive hashing
- lsh attention
- reversible residual layers
- shared-qk attention
- long sequences
- time series forecasting
- memory efficiency
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{kitaev2020reformerefficienttransformer,
title={Reformer: The Efficient Transformer},
author={Nikita Kitaev and Łukasz Kaiser and Anselm Levskaya},
year={2020},
eprint={2001.04451},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2001.04451},
}