{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/reformer-the-efficient-transformer-1","title":"Reformer: The Efficient Transformer","arxiv_id":"2001.04451","date":"2020-01-13","proceeding":"ICLR 2020 1","authors":["Nikita Kitaev","Łukasz Kaiser","Anselm Levskaya"],"abstract":"Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its complexity from O($L^2$) to O($L\\log L$), where $L$ is the length of the sequence. Furthermore, we use reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of $N$ times, where $N$ is the number of layers. The resulting model, the Reformer, performs on par with Transformer models while being much more memory-efficient and much faster on long sequences.","url_abs":"https://arxiv.org/abs/2001.04451v2","url_pdf":"https://arxiv.org/pdf/2001.04451v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/google/trax/tree/master/trax/models/reformer","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/huggingface/transformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/lucashueda/long_sentence_transformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"LGPL-3.0"}},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/sliao-mi-luku/Chatbot-Reformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/sliao-mi-luku/NLP-Chatbot-Reformer-Trax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/MindCode-4/code-3/tree/main/efficientformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/Rick-McCoy/Reformer-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/junnyu/paddle_reformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok"}},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/lucidrains/reformer-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"reformer-the-efficient-transformer-1","repo_url":"https://github.com/yangyucheng000/University/tree/main/model-3/reformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"d4rl","task_name":"D4RL"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"offline-rl","task_name":"Offline RL"},{"task_slug":"open-domain-question-answering","task_name":"Open-Domain Question Answering"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adafactor","method_name":"Adafactor"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"lsh-attention","method_name":"LSH Attention"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"reformer","method_name":"Reformer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"reversible-residual-block","method_name":"Reversible Residual Block"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[{"slug":"reformer","name":"Reformer","full_name":"Reformer"}],"results":[{"leaderboard":"/sota/d4rl-on-d4rl","task":"D4RL","dataset":"D4RL","model":"Reformer","rank_in_archive_order":8,"of":9,"metrics":{"Average Reward":"63.9"},"uses_additional_data":false},{"leaderboard":"/sota/image-generation-on-imagenet-64x64","task":"Image Generation","dataset":"ImageNet 64x64","model":"Reformer (12 layers)","rank_in_archive_order":56,"of":65,"metrics":{"Bits per dim":"3.710"},"uses_additional_data":false},{"leaderboard":"/sota/image-generation-on-imagenet-64x64","task":"Image Generation","dataset":"ImageNet 64x64","model":"Reformer (6 layers)","rank_in_archive_order":58,"of":65,"metrics":{"Bits per dim":"3.740"},"uses_additional_data":false},{"leaderboard":"/sota/language-modelling-on-wikitext-103","task":"Language Modelling","dataset":"WikiText-103","model":"Reformer 125M","rank_in_archive_order":62,"of":89,"metrics":{"Test perplexity":"26.0"},"uses_additional_data":false},{"leaderboard":"/sota/open-domain-question-answering-on-searchqa","task":"Open-Domain Question Answering","dataset":"SearchQA","model":"Locality-Sensitive Hashing","rank_in_archive_order":2,"of":14,"metrics":{"EM":"66.0"},"uses_additional_data":false},{"leaderboard":"/sota/question-answering-on-natural-questions-long","task":"Question Answering","dataset":"Natural Questions (long)","model":"Locality-Sensitive Hashing","rank_in_archive_order":3,"of":13,"metrics":{"F1":"75.5"},"uses_additional_data":false},{"leaderboard":"/sota/question-answering-on-quasart-t","task":"Question Answering","dataset":"Quasart-T","model":"Locality-Sensitive Hashing","rank_in_archive_order":2,"of":7,"metrics":{"EM":"53.2"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2001.04451","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2001.04451"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huggingface/transformers","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucashueda/long_sentence_transformer","reach":{"status":"ok","spdx":"LGPL-3.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MindCode-4/code-3/tree/main/efficientformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yangyucheng000/University/tree/main/model-3/reformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/reformer-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/junnyu/paddle_reformer","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sliao-mi-luku/NLP-Chatbot-Reformer-Trax","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Rick-McCoy/Reformer-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/google/trax/tree/master/trax/models/reformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sliao-mi-luku/Chatbot-Reformer","reach":{"status":"ok"}}],"summary":{"ran":1,"ran_draft_wrong":5,"unverified":2},"by_repo_kind":{"listed":{"samples":8,"ran":6,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"f730a019cd6dfa68","entry":"LocalitySensitiveHash","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f730a019cd6dfa68"}},{"code_sha256_prefix":"bde1d7f419f43bee","entry":"expand","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bde1d7f419f43bee"}},{"code_sha256_prefix":"e25bbd4d3edcecd5","entry":"expand_gather","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e25bbd4d3edcecd5"}},{"code_sha256_prefix":"fa28de4db6c8dda3","entry":"get_dup_keys","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fa28de4db6c8dda3"}},{"code_sha256_prefix":"48898f78f7058226","entry":"look_back","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"48898f78f7058226"}},{"code_sha256_prefix":"4afdf83df6c27154","entry":"reverse_sort","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4afdf83df6c27154"}},{"code_sha256_prefix":"6874256369242fb8","entry":"LSHAttention","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6874256369242fb8"}},{"code_sha256_prefix":"939cb0f4831afed5","entry":"deterministic_dropout","repo":"Rick-McCoy/Reformer-pytorch","repo_kind":"listed","path":"model/attention.py","file_url":"https://github.com/Rick-McCoy/Reformer-pytorch/blob/HEAD/model/attention.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"939cb0f4831afed5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}