{"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/compressive-transformers-for-long-range-1","title":"Compressive Transformers for Long-Range Sequence Modelling","arxiv_id":"1911.05507","date":"2019-11-13","proceeding":"ICLR 2020 1","authors":["Jack W. Rae","Anna Potapenko","Siddhant M. Jayakumar","Timothy P. Lillicrap"],"abstract":"We present the Compressive Transformer, an attentive sequence model which compresses past memories for long-range sequence learning. We find the Compressive Transformer obtains state-of-the-art language modelling results in the WikiText-103 and Enwik8 benchmarks, achieving 17.1 ppl and 0.97 bpc respectively. We also find it can model high-frequency speech effectively and can be used as a memory mechanism for RL, demonstrated on an object matching task. To promote the domain of long-range sequence learning, we propose a new open-vocabulary language modelling benchmark derived from books, PG-19.","url_abs":"https://arxiv.org/abs/1911.05507v1","url_pdf":"https://arxiv.org/pdf/1911.05507v1.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":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/ViktorStagge/CompressiveTransformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/deepmind/pg19","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/google-deepmind/pg19","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/lucidrains/block-recurrent-transformer-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/labmlai/annotated_deep_learning_paper_implementations","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"compressive-transformers-for-long-range-1","repo_url":"https://github.com/lucidrains/compressive-transformer-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"adaptive-input-representations","method_name":"Adaptive Input Representations"},{"method_slug":"adaptive-softmax","method_name":"Adaptive Softmax"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"compressed-memory","method_name":"Compressed Memory"},{"method_slug":"compressive-transformer","method_name":"Compressive Transformer"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gradient-clipping","method_name":"Gradient Clipping"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer-xl","method_name":"Transformer-XL"},{"method_slug":"variational-dropout","method_name":"Variational Dropout"}],"datasets_introduced":[{"slug":"pg-19","name":"PG-19","full_name":""}],"methods_introduced":[{"slug":"compressed-memory","name":"Compressed Memory","full_name":"Compressed Memory"},{"slug":"compressive-transformer","name":"Compressive Transformer","full_name":"Compressive Transformer"}],"results":[{"leaderboard":"/sota/language-modelling-on-hutter-prize","task":"Language Modelling","dataset":"Hutter Prize","model":"Compressive Transformer","rank_in_archive_order":2,"of":18,"metrics":{"Bit per Character (BPC)":"0.97"},"uses_additional_data":false},{"leaderboard":"/sota/language-modelling-on-wikitext-103","task":"Language Modelling","dataset":"WikiText-103","model":"Compressive Transformer (18L, M=1024)","rank_in_archive_order":20,"of":89,"metrics":{"Test perplexity":"17.1","Validation perplexity":"16.0"},"uses_additional_data":false},{"leaderboard":"/sota/language-modelling-on-enwiki8","task":"Language Modelling","dataset":"enwik8","model":"Compressive Transformer (24 layers)","rank_in_archive_order":8,"of":42,"metrics":{"Bit per Character (BPC)":"0.97","Number of params":"277M"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/1911.05507","atlas_url":"https://app.syntology.ai/?focus=1911.05507","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1911.05507"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/ViktorStagge/CompressiveTransformer","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/compressive-transformer-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/block-recurrent-transformer-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/labmlai/annotated_deep_learning_paper_implementations","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/deepmind/pg19","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/google-deepmind/pg19","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_violates":2,"ran":3,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"listed":{"samples":11,"ran":6,"repositories":2}},"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":"369eced62e96d690","entry":"cast_tuple","repo":"lucidrains/compressive-transformer-pytorch","repo_kind":"listed","path":"compressive_transformer_pytorch/compressive_transformer_pytorch.py","file_url":"https://github.com/lucidrains/compressive-transformer-pytorch/blob/HEAD/compressive_transformer_pytorch/compressive_transformer_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"369eced62e96d690"}},{"code_sha256_prefix":"a1bda7590dd9a4d2","entry":"default","repo":"lucidrains/compressive-transformer-pytorch","repo_kind":"listed","path":"compressive_transformer_pytorch/compressive_transformer_pytorch.py","file_url":"https://github.com/lucidrains/compressive-transformer-pytorch/blob/HEAD/compressive_transformer_pytorch/compressive_transformer_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a1bda7590dd9a4d2"}},{"code_sha256_prefix":"2386968d2b386e18","entry":"get_optimizer","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/optimizers.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/optimizers.py","link_basis":"harvester_set","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":"2386968d2b386e18"}},{"code_sha256_prefix":"7417c98099ec4e15","entry":"to","repo":"lucidrains/compressive-transformer-pytorch","repo_kind":"listed","path":"compressive_transformer_pytorch/compressive_transformer_pytorch.py","file_url":"https://github.com/lucidrains/compressive-transformer-pytorch/blob/HEAD/compressive_transformer_pytorch/compressive_transformer_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7417c98099ec4e15"}},{"code_sha256_prefix":"0a1ea081d7a22055","entry":"treebank","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/load/treebank.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/load/treebank.py","link_basis":"harvester_set","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":"0a1ea081d7a22055"}},{"code_sha256_prefix":"ff138d8d7172a07a","entry":"wma","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/load/wma.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/load/wma.py","link_basis":"harvester_set","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":"ff138d8d7172a07a"}},{"code_sha256_prefix":"9935f8b67694d72e","entry":"compression_layer","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/layers/compression.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/layers/compression.py","link_basis":"harvester_set","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":"9935f8b67694d72e"}},{"code_sha256_prefix":"185debb5bed29c85","entry":"content_based_attention","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/layers/attention.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/layers/attention.py","link_basis":"harvester_set","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":"185debb5bed29c85"}},{"code_sha256_prefix":"ba5b86960e25b0d6","entry":"content_based_attention_numpy","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/layers/attention.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/layers/attention.py","link_basis":"harvester_set","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":"ba5b86960e25b0d6"}},{"code_sha256_prefix":"3e55a982471a2ac4","entry":"cosine_similarity","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/utils.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/utils.py","link_basis":"harvester_set","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":"3e55a982471a2ac4"}},{"code_sha256_prefix":"da8e90a779ce9bc4","entry":"euclidean_norm","repo":"ViktorStagge/CompressiveTransformer","repo_kind":"listed","path":"ct/model/utils.py","file_url":"https://github.com/ViktorStagge/CompressiveTransformer/blob/HEAD/ct/model/utils.py","link_basis":"harvester_set","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":"da8e90a779ce9bc4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}