按年被提到
20192019 · 3 次2026
大模型与语言模型›量化、解码与分词·arXiv:1901.02860 · cs.LG

Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context

Transformer-XL:超越固定长度上下文的注意力语言模型
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov · 2019

用段级循环和新位置编码突破 Transformer 的固定上下文长度

开始阅读 ↗PDFalphaXiv 讨论
被推荐 · 5 人首次 2019-09-10 · 最近 2023-02-08发表于 Proceedings of the conference - Association for Computational Linguistics. Meeting
5不同的人
6活跃月份
6讨论串
3,169被引(OpenAlex)

Transformer 能学习更长期依赖,但在语言建模中受限于固定长度上下文。论文提出 Transformer-XL,由段级循环机制和新的位置编码方案组成,使模型能在不破坏时间连贯性的前提下学习超出固定长度的依赖,同时解决上下文碎片化问题。它学到的依赖比 RNN 长 80%、比原始 Transformer 长 450%,评估速度最高快 1800 多倍,并刷新了 enwiki8、text8、WikiText-103、One Billion Word 和 Penn Treebank 上的最佳结果。仅用 WikiText-103 训练,它就能生成数千 token、较为连贯的新文章。

HN 为什么提它

HN 上的人称赞它生成的长篇维基风格文章结果惊人和附录里的表格,也把它当作解决 Transformer 上下文长度限制的早期研究以及 XLNet 的基础。

方法难度 4 / 5约 60 分钟经得起时间
读之前最好知道
1Transformer 与自注意力
2位置编码(positional encoding)
3循环神经网络(RNN)
4语言建模与困惑度(perplexity)

学习路径

读这篇之前,按顺序读书架上的 4 篇 · 参考文献来自 OpenAlex,顺序和要点由 Claude Code 排出

先看 LSTM 语言模型的基线和评测,再读 Transformer 及其固定长度上下文的字符级应用,才能明白 Transformer-XL 的段级循环在补什么缺陷。

  1. 1
    Exploring the Limits of Language Modeling探索语言建模的极限 · 2016

    它给出大规模 LSTM 语言模型和十亿词基准上的结果,是 Transformer-XL 要对比的循环网络基线。

    读语言模型的困惑度指标与大规模 LSTM 的设置,了解当时的最好水平。

  2. 2

    AWD-LSTM 是目标论文在小型语料上对比的强 RNN 基线。

    读权重绑定、DropConnect 等正则化技巧,只需知道它为何是强基线。

  3. 3
    Attention Is All You Need注意力就是你所需要的一切 · 2017

    Transformer-XL 在原始 Transformer 的基础上改造,需要先懂自注意力和位置编码。

    读自注意力、多头结构与正弦位置编码,位置编码正是目标论文要改的部分。

  4. 4

    它把固定长度上下文的 Transformer 用于字符级语言模型,暴露了上下文被切段而割裂的问题。

    读固定长度片段训练的做法,以及辅助损失,体会上下文碎片化的含义。

  5. 5
    Transformer-XL: Attentive Language Models Beyond a Fixed-Length ContextTransformer-XL:超越固定长度上下文的注意力语言模型 · 2019 · 就是这篇

    在前面几篇的基础上,看用段级循环和相对位置编码突破固定上下文。

    读段级循环机制中缓存上一段隐状态的做法,以及相对位置编码的推导。

HN 书评

推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及
推荐AlexCoventry · 2019-11

“The results are pretty remarkable. Check out the hallucinated Napoleonic-history wikipedia article at the bottom of Transformer-XL”

称结果相当惊人,推荐看论文末尾生成的拿破仑史维基文章
A.I. and the Future of Cheating原评论 ↗
推荐AlexCoventry · 2019-12

“Have you seen the tables in Appendix E (starts p. 16) of the Transformer-XL paper? I think they're pretty good.”

推荐看论文附录 E 的表格,认为相当不错
The dark ages of AI: A panel discussion at AAAI-84 (1985)原评论 ↗
引用ma2rten · 2019-09

“See the last section of this paper:”

让人看这篇论文的最后一节
GPT-2 is not as dangerous as OpenAI thought it might be原评论 ↗
引用liviosoares · 2020-08

“XLnet, and the underlying TransformerXL technology, did have Google researchers involved:”

指出 XLNet 及其底层 Transformer-XL 有谷歌研究者参与
Deep learning job postings have collapsed in the past six months原评论 ↗
引用thegeomaster · 2023-01

“There's already research that tries to fix this problem with transformers in general, like Transformer-XL [1].”

举 Transformer-XL 为例,说明已有研究在修补 Transformer 的这个问题
ChatRWKV, like ChatGPT but powered by the RWKV (RNN-based, open) language model原评论 ↗
引用vikashrungta · 2023-02

“I posted a list of papers on twitter, and will be posting a summary for each of them as well.”

把它列入自己发在推特上的基础论文清单
What were the 40 research papers on the list Ilya Sutskever gave John Carmack?原评论 ↗