GRU

分类: 网络架构

GRU

定义

GRU(Gated Recurrent Unit)是 Cho et al. (2014) 提出的一种门控循环神经网络变体,通过重置门和更新门机制解决标准 RNN 的梯度消失问题,相比 LSTM 参数更少、计算更快,性能相当

数学形式

zt=σ(Wzxt+Uzht1+bz)z_t = \sigma(W_z x_t + U_z h_{t-1} + b_z) rt=σ(Wrxt+Urht1+br)r_t = \sigma(W_r x_t + U_r h_{t-1} + b_r) h~t=tanh(Whxt+Uh(rtht1)+bh)\tilde{h}_t = \tanh(W_h x_t + U_h (r_t \odot h_{t-1}) + b_h) h_t = (1 - z_t) \odot h_{t-1} + z_t \odot \tilde{h}_t}

其中 ztz_t 为更新门(update gate),rtr_t 为重置门(reset gate),\odot 为逐元素乘法

核心要点

更新门 ztz_t:控制前一时刻隐藏状态保留多少,类似 LSTM 的遗忘门+输入门的组合

重置门 rtr_t:决定候选隐状态计算时忽略多少历史信息;rt0r_t \to 0 时相当于从头计算

相比 LSTM 少了一个门和 cell state,参数量约为 LSTM 的 75%,训练速度更快

在机器翻译、语音识别等序列建模任务上表现与 LSTM 相当

GRU 和 LSTM 的选择本质上是偏差-方差权衡:小数据集用 GRU(更少参数),大数据集用 LSTM(更强表达力)

CS224N 中作为 RNN 家族的核心架构之一被讲授

代表工作

Cho et al., 2014: Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation,首次提出 GRU 结构

Chung et al., 2014: Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling,GRU vs LSTM 的系统对比

相关概念

循环神经网络

Encoder-Decoder

Seq2Seq

Word Embedding