# RNN转换器

RNN转换器（RNN-T）是一种用于序列转换的神经网络架构，即将输入序列转换为长度未知的输出序列，由[多伦多大学](https://www.edgepedia.org/zh/university-of-toronto)的Alex Graves在2012年的论文《用循环神经网络进行序列转换》中提出。<sup>[1](https://arxiv.org/abs/1211.3711)</sup> 它定义了在所有长度的输出序列上以及输入与输出之间所有对齐方式上的概率分布，联合建模输入-输出和输出-输出依赖关系。<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup> 其主要应用是流式自动语音识别，在该领域已成为标准的端到端架构。<sup>[3](https://arxiv.org/abs/1801.00841)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 由Alex Graves提出，arXiv 1211.3711（2012年11月）<sup>[1](https://arxiv.org/abs/1211.3711)</sup><sup> • </sup><sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup> |
| 与CTC的关系 | 扩展了连接主义时间分类：与CTC不同，它允许输出比输入更长，并对输出标签之间的相互依赖关系建模<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup> |
| 组件 | 对输入的编码器（转录网络）、对先前输出符号的预测网络，以及将二者结合的联合网络，另有一个空白符号用于对齐格中的水平移动<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup> |
| 流式处理 | 持续处理输入样本并在其到达时发出输出符号，无需对完整输入进行注意力计算；适用于听写和端侧识别<sup>[5](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)</sup> |
| 训练损失 | 给定输入时输出的负对数似然，在(T, U)格上用前向-后向动态规划算法对所有对齐方式求和<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup><sup> • </sup><sup>[6](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)</sup> |
| 计算成本 | 联合网络输出的形状为(N, T, U, V)，其中N为批大小、T为输入长度、U为输出长度、V为词表大小，远大于CTC或注意力模型的(N, T, V)；剪枝方法可降低此成本<sup>[6](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)</sup> |
| 部署实例 | 谷歌的端侧Gboard识别器（2019年）使用了约450 MB的RNN-T，可离线运行并逐字符输出<sup>[5](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)</sup> |

## 动机及与CTC的关系

Graves将问题表述如下：当输入-输出对齐已知时，循环神经网络可以对语音信号的每一帧或蛋白质链中的每一个氨基酸进行分类，但通用转换器需要覆盖所有可能对齐方式的所有长度序列上的分布。<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup> 连接主义时间分类（CTC）是Graves及其同事较早提出的RNN输出层，它定义了在所有不长于输入的输出序列的对齐方式上的分布。这排除了输出比输入更长的任务，如文本转语音，而且CTC不建模输出之间的相互依赖关系。序列转换器解决了这两个局限。<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup>

原始论文还主张以RNN作为底层序列模型：其高维内部状态和非线性状态间动力学比隐马尔可夫模型具有更强的表达能力，且能够长时间存储和访问信息。<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup>

## 架构

RNN-T结合了三个网络。<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup>

- **编码器**，在原始论文中称为转录网络，扫描输入序列（对于语音，即声学特征）并在每个时间步产生隐藏表示；它扮演声学模型的角色。<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup><sup> • </sup><sup>[7](https://anwarvic.github.io/speech-recognition/RNN-T)</sup>
- **预测网络**接收前一个输出符号并产生输出历史的表示；它类似于对迄今已发出标签的内部语言模型。<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup>
- **联合网络**，通常是一个小型前馈网络，将每个编码器输出与每个预测输出结合，计算词表加一个空白符号上的未归一化对数分数；归一化指数函数给出每个（时间、输出位置）对处每个词元的概率。<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup>

在原始表述中，预测网络消费前一个标签的独热编码，并在输出序列前添加空白符号∅。<sup>[2](https://www.cs.toronto.edu/~graves/icml_2012.pdf)</sup> 解码时将每个预测符号反馈到预测网络，因此预测同时以迄今的音频和过去的输出为条件；解码器在所得图中搜索最高似然路径。<sup>[5](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)</sup>

## 训练与损失计算

损失是给定输入时输出标签序列的负对数后验，其中后验对输入与输出之间所有可能的对齐方式（包括空白标签）求和。<sup>[4](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)</sup> 朴素表述难以处理，因此该求和通过在以输入时间和输出位置为轴的格上运行前向-后向动态规划算法来计算。<sup>[8](https://proceedings.neurips.cc/paper_files/paper/2024/file/b6145836acf918800b4b025f842512de-Paper-Conference.pdf)</sup> 前向变量\( \alpha(t, u) \)累积水平（空白）和垂直（标签）转移的对数概率，并结合log-sum-exp运算。<sup>[6](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)</sup>

这一计算是该架构的主要实际负担。由于联合网络必须对每个输入帧和输出位置的配对进行评估，其输出形状为(N, T, U, V)，远大于CTC和基于注意力的模型的(N, T, V)或(N, U, V)张量；大词表（如基于字符的中文ASR）可使未剪枝的RNN-T损失在GPU内存上不可行。<sup>[6](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)</sup> 剪枝RNN-T通过先用廉价线性联合器计算剪枝边界，然后仅在这些边界内评估完整非线性联合器来解决此问题；在报告的实验中，其词错误率略优于未剪枝训练。<sup>[9](https://arxiv.org/abs/2206.13236)</sup> 梯度集中在格中狭窄的单调带内，这正是剪枝有效的原因。<sup>[6](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)</sup>

## 流式行为及与其他端到端模型的比较

与大多数序列到序列模型在产生输出之前处理整个输入不同，RNN-T持续处理输入样本并流式输出符号，这一特性对听写很有价值。<sup>[5](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)</sup> 在三种主要的端到端ASR方法中，RNN-T可以进行在线流式处理，这对基于注意力的编码器-解码器（AED）模型具有挑战性，而且它通过预测网络建模输出依赖关系，避免了CTC的帧独立性假设。<sup>[10](https://arxiv.org/abs/1909.12415)</sup> AED模型与CTC和RNN-T一起，推动端到端神经网络成为学术界和工业界性能最佳的ASR系统。<sup>[8](https://proceedings.neurips.cc/paper_files/paper/2024/file/b6145836acf918800b4b025f842512de-Paper-Conference.pdf)</sup> 代价在于实现层面：概率求和需要非平凡的动态规划，而且RNN-T在产生通常短得多的输出序列时循环处理所有输入帧。<sup>[8](https://proceedings.neurips.cc/paper_files/paper/2024/file/b6145836acf918800b4b025f842512de-Paper-Conference.pdf)</sup>

## 评估历史

原始论文使用TIMIT语音语料库（一个标准基准）在[音素识别](https://www.edgepedia.org/zh/phoneme-recognition)上评估了转换器；对训练模型的分析表明，转录网络对频谱图中的声学模式敏感，而预测网络已学习到语言结构，例如对词间空格的敏感度降低。<sup>[1](https://arxiv.org/abs/1211.3711)</sup>

2018年谷歌的一项研究为大规模词汇语音搜索和听写训练了RNN-T系统。最佳系统是一个十二层LSTM编码器加两层LSTM解码器，以30,000个词片作为输出目标进行训练，在语音搜索上达到8.5%的词错误率，在语音听写上达到5.2%，与最先进基线的8.3%和5.4%相当。<sup>[3](https://arxiv.org/abs/1801.00841)</sup> 子词单元捕获了更长的上下文并显著减少了替换错误。<sup>[3](https://arxiv.org/abs/1801.00841)</sup>

## 部署及后续发展

RNN-T的流式特性使其成为端侧识别的基础。谷歌2019年的Gboard识别器使用RNN-T训练，体积紧凑到约450 MB即可驻留在手机上，在字符级别离线工作，避免了生产服务器端系统约2 GB的解码器搜索图。<sup>[5](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)</sup> 后来的一种第一遍RNN-T配合第二遍Listen, Attend, Spell重打分器在质量和延迟上均超越了传统模型，在相同延迟下WER相对降低8%，同时模型大小缩小了400多倍。<sup>[11](https://research.google/pubs/a-streaming-on-device-end-to-end-model-surpassing-server-side-conventional-model-quality-and-latency/)</sup>

此后研究针对该架构的成本和假设：

- **预测网络的作用。** 无状态预测网络（移除循环层）在使用词片时表现几乎与原始版本一样好，这表明预测网络主要帮助模型对齐输入音频，而编码器和联合网络捕获声学和语言信息。<sup>[12](https://research.google/pubs/rnn-transducer-with-stateless-prediction-network/)</sup>
- **延迟。** 对齐受限训练和FastEmit等训练方法可降低发射延迟，通常以一定的精度为代价；2022年的一种方法在训练期间显式建模并降低延迟。<sup>[13](https://arxiv.org/abs/2211.02333)</sup>
- **规模与时间缩减。** 漏斗池化层降低编码器帧率以加速训练和推理；一个9亿参数的RNN-T在大规模语音搜索任务上可容忍低至640 ms的编码器输出帧率，6亿参数的模型在Librispeech上以160 ms帧率训练。<sup>[14](https://aclanthology.org/2024.naacl-long.344/)</sup>
- **判别式训练。** RNN-T的最小词错误率训练采用半即时方案，对N-best假设重新计算对齐分数，运行速度比即时方法快6倍，相对基线RNN-T的WER降幅相近，为3.6%。<sup>[15](https://www.amazon.science/publications/efficient-minimum-word-error-rate-training-of-rnn-transducer-for-end-to-end-speech-recognition)</sup>
- **域适应与元数据。** 微软关于部署挑战的工作解决了无需新音频的域适应问题，方法为拼接源域语音片段（在其评估中相对基线WER降低58.03%），添加了共享编码器的音素预测分支，使词时间戳平均在真实值的50 ms以内，并从解码特征中推导词级置信度分数。<sup>[16](https://arxiv.org/abs/2105.00858)</sup>

空白符号机制也被证明具有可移植性：近期关于多模态大语言模型流式识别的工作推广了RNN-T的空白符号，用以教仅解码器架构实时处理音频。<sup>[17](https://arxiv.org/abs/2406.09569)</sup>

## References

1. [Alex Graves (2012). Sequence Transduction with Recurrent Neural Networks. arXiv:1211.3711.](https://arxiv.org/abs/1211.3711)
2. [Alex Graves (2012). Sequence Transduction with Recurrent Neural Networks, ICML 2012 paper PDF.](https://www.cs.toronto.edu/~graves/icml_2012.pdf)
3. [Kanishka Rao et al. (2018). Exploring Architectures, Data and Units For Streaming End-to-End Speech Recognition with RNN-Transducer. arXiv:1801.00841.](https://arxiv.org/abs/1801.00841)
4. [Jinxi Guo et al. (2020). Efficient minimum word error rate training of RNN-transducer for end-to-end speech recognition (architecture description).](https://www.researchgate.net/publication/343279397_Efficient_minimum_word_error_rate_training_of_RNN-Transducer_for_end-to-end_speech_recognition)
5. [Google Research Blog (2019). An All-Neural On-Device Speech Recognizer.](https://www.research.google/blog/an-all-neural-on-device-speech-recognizer/)
6. [Fangjun Kuang et al. (2022). Pruned RNN-T for fast, memory-efficient ASR training. arXiv:2206.13236.](https://www.researchgate.net/publication/361580306_Pruned_RNN-T_for_fast_memory-efficient_ASR_training)
7. [RNN-T: RNN Transducer (explanatory overview).](https://anwarvic.github.io/speech-recognition/RNN-T)
8. [Aligner-Encoders: Self-Attention Transformers Can Be Self-Transducers, NeurIPS 2024.](https://proceedings.neurips.cc/paper_files/paper/2024/file/b6145836acf918800b4b025f842512de-Paper-Conference.pdf)
9. [Pruned RNN-T for fast, memory-efficient ASR training, arXiv abstract.](https://arxiv.org/abs/2206.13236)
10. [Improving RNN Transducer Modeling for End-to-End Speech Recognition. arXiv:1909.12415.](https://arxiv.org/abs/1909.12415)
11. [A Streaming On-Device End-to-End Model Surpassing Server-Side Conventional Model Quality and Latency, Google Research.](https://research.google/pubs/a-streaming-on-device-end-to-end-model-surpassing-server-side-conventional-model-quality-and-latency/)
12. [Eugene Weinstein et al. (2020). RNN-Transducer with Stateless Prediction Network, ICASSP 2020.](https://research.google/pubs/rnn-transducer-with-stateless-prediction-network/)
13. [Yusuke Shinohara (2022). Minimum Latency Training of Sequence Transducers for Streaming End-to-End Speech Recognition. arXiv:2211.02333.](https://arxiv.org/abs/2211.02333)
14. [Weiran Wang et al. (2024). Massive End-to-end Speech Recognition Models with Time Reduction, NAACL 2024.](https://aclanthology.org/2024.naacl-long.344/)
15. [Efficient minimum word error rate training of RNN-transducer, Amazon Science.](https://www.amazon.science/publications/efficient-minimum-word-error-rate-training-of-rnn-transducer-for-end-to-end-speech-recognition)
16. [Rui Zhao et al. (2021). On Addressing Practical Challenges for RNN-Transducer. arXiv:2105.00858.](https://arxiv.org/abs/2105.00858)
17. [Speech ReaLLM: Real-time Streaming Speech Recognition with Multimodal LLMs. arXiv:2406.09569.](https://arxiv.org/abs/2406.09569)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Titles I to Z

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/rnn-transducer

English original: https://www.edgepedia.org/rnn-transducer
