Papers › Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov
Transformers have a potential of learning longer-term dependency, but are limited by a fixed-length context in the setting of language modeling. We propose a novel neural architecture Transformer-XL that enables learning dependency beyond a fixed length without disrupting temporal coherence. It consists of a segment-level recurrence mechanism and a novel positional encoding scheme. Our method not only enables capturing longer-term dependency, but also resolves the context fragmentation problem. As a result, Transformer-XL learns dependency that is 80% longer than RNNs and 450% longer than vanilla Transformers, achieves better performance on both short and long sequences, and is up to 1,800+ times faster than vanilla Transformers during evaluation. Notably, we improve the state-of-the-art results of bpc/perplexity to 0.99 on enwiki8, 1.08 on text8, 18.3 on WikiText-103, 21.8 on One Billion Word, and 54.5 on Penn Treebank (without finetuning). When trained only on WikiText-103, Transformer-XL manages to generate reasonably coherent, novel text articles with thousands of tokens. Our code, pretrained models, and hyperparameters are available in both Tensorflow and PyTorch.
In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.
For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1901.02860")
Code
Syntology Ran 63 of 143 code samples harvested from 20 repositories linked to this paper; 80 have no recorded run. Of those that ran: 4 ran · honoured contract; 1 ran · violated contract; 6 ran · our draft was wrong; 12 ran · fixture could not drive it; 40 ran with no contract checked.
By repository: official repository: 13 samples from 1 repository, 8 ran; community (archive-listed): 128 samples from 19 repositories, 53 ran; 2 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.
37 repositories listed; official and paper-mentioned ones first.
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
Code Syntology ran Syntology
143 samples harvested; 63 ran; 4 honoured the contract we drafted; 80 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.
Licence: 43 of the 143 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.
Harvested from 20 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.
Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.
Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.
1ae137f0cee15e33 · report
e8aac29a19d0c2e7 · report
220657028509cfb1 · report
d99c9cc9af9de483 · report
c96fba039a607703 · report
338c39719307318d · report
fe28ba867add05c0 · report
93228a3eb5c4d179 · report
9ef2fc89678fefb2 · report
17ee18e7e701439f · report
a033a134e9f6452f · report
89afd0bff30e18a9 · report
fb613dd5bc21371c · report
e77541c1b4b15830 · report
8a8691f05cb1b5da · report
e3217ee8bd314909 · report
548da299b3bc04e9 · report
845f84e3a319753d · report
72ccb5501088c2b4 · report
6a748d270690866b · report
709b8a145b15f0ca · report
39c5be8f7b1c0490 · report
ad41eff0feadfd69 · report
39480331817170e8 · report
84585e9be4407fc4 · report
df5a6cf54dd0aca6 · report
e672e8a20905b62b · report
5597fd8e1219b866 · report
7eb33bec45fe09f3 · report
b54068382071f8c8 · report
5fb8aacfbced509d · report
142586d370dc7c1e · report
06ce2b899569db5b · report
07bf8cf6e731d1bc · report
eed8c286b97219b7 · report
4088ee884194d7c4 · report
7d9e9736e6c57d11 · report
2e57dbd19f63d3f4 · report
4c8b264bb79a35a1 · report
8fa37260188b5fd8 · report
4977fa89216a56fa · report
032b78da6979837c · report
a97a22ac6fb31922 · report
c7b5eb55f15a37de · report
2a023fc4bac8d229 · report
2a5f4bac2414eb0f · report
773651748c9618d6 · report
9d5e914b24b8911a · report
c92e4fc990bba2fe · report
35ef111fc00c21b4 · report
499bf5fee7915c78 · report
9109ba9791e44324 · report
c1184d27672a7461 · report
8d59a6d5900428f5 · report
d50e8679cde3a927 · report
9bf0f6e6298f3fbe · report
2398c4a5c285bdc4 · report
f7a746d73ab2f28c · report
d37883dc58ff9b69 · report
5f7c5b38aeb29bf5 · report
edeef97857b7cdca · report
8e76562720b0c921 · report
4e762613ee907cdb · report
df4647a6d9f03c0e · report
cec833a99feb528c · report
a4f0d0fb0e45662a · report
87202268910cb496 · report
fe3454282cf0b88e · report
fc52846dc775edff · report
c614edf5b8c0d3b0 · report
117b06ce2fbc7877 · report
e4e12108c18eb032 · report
de07f82e734e3e2c · report
5ffa84d26ba39532 · report
a7430322070cedb5 · report
12dd38874c15490a · report
d4857f57ecefa3d5 · report
de3ab66ec62fc167 · report
62b1b4ab79fdfc8b · report
6b820cc9aac66bc1 · report
752529d23a4b3b22 · report
ea7c8500cbc85ff5 · report
3dafbc50941af43d · report
cb862dd19b1f381a · report
dc7c9e91c34d6ddf · report
9ec384a6bfe40952 · report
fd8d58e6a1428332 · report
5014b04d3358c101 · report
fdc345d0da45dd95 · report
8361fa24d3e06e13 · report
5e1b71bde76b69e7 · report
c018d465b6253b94 · report
274ae09f88dbb42a · report
1be1a875d12d10b3 · report
534b6317f069c394 · report
532a59e61c71b7a8 · report
d7bd7d30264b3658 · report
b28585d20fefea46 · report
9a2f71717dcf3962 · report
a2315dc06271216b · report
fa690903d5ea5d89 · report
91e5af7605c83b9a · report
2b646a664c00ffa8 · report
ed15761e38990647 · report
c1f8a649a7a837d5 · report
5c61a4c30ce59547 · report
6b2a8f1c93d0b071 · report
0e3f1e158da4c3b8 · report
36eed0b265968be7 · report
6fee57012e68e835 · report
e505aeb6374f0f1c · report
48246428164ddbc5 · report
5abf0267f0fc7514 · report
f07d3c5f67c9a93d · report
d5a05e8b3b59f012 · report
8ca3ba583d69ea38 · report
ab8eff277d0925e9 · report
b4bb49d2de702f67 · report
6804d62cb7cd8df3 · report
c1c98338b80e7459 · report
3d6b054785523852 · report
1ebc2bf2c3cddc4d · report
99e35dc770639097 · report
fca4d6d03913ae24 · report
8d07f1308bd24cbc · report
e344186184b46850 · report
3652bf001c221967 · report
ddf11fc956cd28ce · report
cf208c8c20d52c1b · report
9d6735f22035b700 · report
bf75653cc30018e0 · report
b517847a8c809203 · report
b1f1afea05cd968b · report
6ccb8d28491109b6 · report
582150577e5bd769 · report
69598ced7806d8c3 · report
aa1de448b0528802 · report
e7ebaba541ff0216 · report
d0f56431ab6c3b37 · report
d077730400326171 · report
2d935f29546db9cd · report
78d91efd74e4d12a · report
4e978f9f7835b10a · report
Tasks
Results from the paper archive 2025-07-28
| Task | Dataset | Model | Metric | Value | Rank at snapshot | Leaderboard | Report |
|---|---|---|---|---|---|---|---|
| Language Modelling | Hutter Prize | 24-layer Transformer-XL | Bit per Character (BPC) | 0.99 | #4 of 18 | Archive leaderboard | report |
| Language Modelling | Hutter Prize | 24-layer Transformer-XL | Number of params | 277M | #4 of 18 | Archive leaderboard | report |
| Language Modelling | Hutter Prize | 18-layer Transformer-XL | Bit per Character (BPC) | 1.03 | #7 of 18 | Archive leaderboard | report |
| Language Modelling | Hutter Prize | 18-layer Transformer-XL | Number of params | 88M | #7 of 18 | Archive leaderboard | report |
| Language Modelling | Hutter Prize | 12-layer Transformer-XL | Bit per Character (BPC) | 1.06 | #9 of 18 | Archive leaderboard | report |
| Language Modelling | Hutter Prize | 12-layer Transformer-XL | Number of params | 41M | #9 of 18 | Archive leaderboard | report |
| Language Modelling | One Billion Word | Transformer-XL Large | Number of params | 0.8B | #4 of 27 | Archive leaderboard | report |
| Language Modelling | One Billion Word | Transformer-XL Large | PPL | 21.8 | #4 of 27 | Archive leaderboard | report |
| Language Modelling | One Billion Word | Transformer-XL Base | Number of params | 0.46B | #8 of 27 | Archive leaderboard | report |
| Language Modelling | One Billion Word | Transformer-XL Base | PPL | 23.5 | #8 of 27 | Archive leaderboard | report |
| Language Modelling | Penn Treebank (Word Level) | Transformer-XL | Params | 24M | #22 of 43 | Archive leaderboard | report |
| Language Modelling | Penn Treebank (Word Level) | Transformer-XL | Test perplexity | 54.55 | #22 of 43 | Archive leaderboard | report |
| Language Modelling | Penn Treebank (Word Level) | Transformer-XL | Validation perplexity | 56.72 | #22 of 43 | Archive leaderboard | report |
| Language Modelling | Text8 | Transformer-XL - 24 layers | Bit per Character (BPC) | 1.08 | #5 of 24 | Archive leaderboard | report |
| Language Modelling | Text8 | Transformer-XL - 24 layers | Number of params | 277M | #5 of 24 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Large | Number of params | 257M | #34 of 89 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Large | Test perplexity | 18.3 | #34 of 89 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Large | Validation perplexity | 18.2 | #34 of 89 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Standard | Number of params | 151M | #54 of 89 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Standard | Test perplexity | 24.0 | #54 of 89 | Archive leaderboard | report |
| Language Modelling | WikiText-103 | Transformer-XL Standard | Validation perplexity | 23.1 | #54 of 89 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (24 layers) | Bit per Character (BPC) | 0.99 | #12 of 42 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (24 layers) | Number of params | 277M | #12 of 42 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (18 layers) | Bit per Character (BPC) | 1.03 | #23 of 42 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (18 layers) | Number of params | 88M | #23 of 42 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (12 layers) | Bit per Character (BPC) | 1.06 | #26 of 42 | Archive leaderboard | report |
| Language Modelling | enwik8 | Transformer-XL (12 layers) | Number of params | 41M | #26 of 42 | Archive leaderboard | report |
Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.
Methods
Introduced by this paper: Transformer-XL
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections