0%

准RNN Quasi-recurrent Neural Networks

QRNN 是 Salesforce Research 团队(Update: 官方pytorch实现)提出的一种使用卷积操作替代传统的循环结构(vanilla RNN, LSTM, GRU)的新网络结构。
QRNN 可以视为介于 RNN 和 CNN 之间的特殊结构。
由于卷积操作没有循环结构时间上的依赖性,因此,QRNN 的计算并行度高;在训练时,卷积结构也要比循环结构更稳定。因此 ,QRNN 是一种潜在有用的网络,可以 drop-in 地替代各种 RNN。

motivation

RNN 在计算时,有时间的依赖性,并行度受限;而 CNN 受制于有限的 receptive field,因此,信息传递太慢。QRNN 希望能综合RNN和CNN的优点,尽量避免各自的缺陷。

model

$$
\mathbf{Z} = \tanh(\mathbf{W} _ z * \mathbf{X})
$$

$$
\mathbf{F} = \sigma(\mathbf{W} _ f * \mathbf{X})
$$
$$
\mathbf{O} = \sigma(\mathbf{W} _ o * \mathbf{X})
$$

其中 表示1维卷积操作。显然,这一步操作是没有时序上的依赖的。

为建模时序关系,不同时刻 memory 更新如下:

$$ a_{r-2} \mathbf{c}_{t-1} $$
$$
\mathbf{c}_t = \mathbf{f}_t \odot \mathbf{c} _ {t - 1} + (1 - \mathbf{f} _ t) \odot \mathbf{z} _ t
$$

  1. 仍然保留c和h

fo-Pool

  1. Mixture of Softmax + QuasiRNN/SRU进行加速
  2. Adaptive Softmax + SRU, 效果较差,(也许是tensorflow的实现有问题,尚未检查)

下周计划

  1. Adaptive Softmax + SRU/QRNN
  2. 初步在sogou数据上验证效果
  3. 使用tensorRT 对inference加速

dynamic average pooling

细节

Quasi-RNN的核心是在 k-gram CNN(文本卷积)的基础上使用 adaptive gating。
在讨论k-gram卷积的时候,通常不会使用k=1既 window size 1作为运行参数。这点在包括Q-RNN本身的许多论文中都有体现 。

SRU中的矩阵变换虽然可以看做 k=1的情况,但这跟声称“所有前馈神经网络(fast forward network)都是 k=1 卷积” 或者 “VGG net 和 GoogLeNet 是 AlexNet 改成3*3卷积然后加深度”没有本质差别。
3卷积然后加深度”没有本质差别。

变种

Regularization

Variational inference–based dropout

卧槽,这么高级。

全连接层

Encoder–Decoder 架构

参考

  1. https://blog.csdn.net/u011961856/article/details/77431869
  2. https://blog.csdn.net/u014665013/article/details/81911850
  3. https://blog.csdn.net/JackyTintin/article/details/77945354
  4. Deep VoiceDeep Voice 2 利用 QRNN 做 TTS 系统前端的韵律预测