Unidades recurrentes cerradas

Las unidades recurrentes cerradas (GRU, por sus siglas en inglés) son un mecanismo de compuerta en redes neuronales recurrentes, introducido en 2014 por Kyunghyun Cho et al.[1]​ La GRU es como una memoria a largo plazo (LSTM, por sus siglas en inglés) con un mecanismo de compuerta para introducir u olvidar ciertas características,[2]​ pero carece de vector de contexto o compuerta de salida, lo que resulta en menos parámetros que la LSTM.[3]​ El rendimiento de la GRU en determinadas tareas de modelado de música polifónica, modelado de señales de voz y procesamiento de lenguaje natural fue similar al de la LSTM.[4][5]​ Las GRU demostraron que la compuerta es útil en general, y el equipo de Bengio no llegó a ninguna conclusión concreta sobre cuál de las dos unidades de compuerta era mejor.[6][7]

Arquitectura

Existen diversas variaciones de la unidad de compuerta completa, en la que la compuerta se realiza utilizando el estado oculto anterior y el sesgo en diversas combinaciones, y una forma simplificada denominada unidad de compuerta mínima.[8]

El operador {\displaystyle \odot } denota el producto Hadamard en lo siguiente:

Unidad totalmente cerrada

Inicialmente, para t = 0 {\displaystyle t=0} , el vector de salida es h 0 = 0 {\displaystyle h_{0}=0} .

z t = σ ( W z x t + U z h t 1 + b z ) r t = σ ( W r x t + U r h t 1 + b r ) h ^ t = ϕ ( W h x t + U h ( r t h t 1 ) + b h ) h t = ( 1 z t ) h t 1 + z t h ^ t {\displaystyle {\begin{aligned}z_{t}&=\sigma (W_{z}x_{t}+U_{z}h_{t-1}+b_{z})\\r_{t}&=\sigma (W_{r}x_{t}+U_{r}h_{t-1}+b_{r})\\{\hat {h}}_{t}&=\phi (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 {\hat {h}}_{t}\end{aligned}}}
Unidad Recurrente Cerrada, versión totalmente cerrada

Variables ( d {\displaystyle d} denota el número de características de entrada y e {\displaystyle e} el número de características de salida):

  • x t R d {\displaystyle x_{t}\in \mathbb {R} ^{d}} : vector de entrada
  • h t R e {\displaystyle h_{t}\in \mathbb {R} ^{e}} : vector de salida
  • h ^ t R e {\displaystyle {\hat {h}}_{t}\in \mathbb {R} ^{e}} : vector de activación candidato
  • z t ( 0 , 1 ) e {\displaystyle z_{t}\in (0,1)^{e}} : actualizar el vector de puerta
  • r t ( 0 , 1 ) e {\displaystyle r_{t}\in (0,1)^{e}} : resetear vector puerta
  • W R d × e {\displaystyle W\in \mathbb {R} ^{d\times e}} , U R e × e {\displaystyle U\in \mathbb {R} ^{e\times e}} and b R e {\displaystyle b\in \mathbb {R} ^{e}} : matrices de parámetros y vectores que deben aprenderse durante el entrenamiento.

Funciones de activación

Son posibles funciones de activación alternativas, siempre que: σ ( x ) [ 0 , 1 ] {\displaystyle \sigma (x)\in [0,1]} .

Tipo 1

Se pueden crear formas alternativas cambiando z t {\displaystyle z_{t}} y r t {\displaystyle r_{t}} .[9]

  • Tipo 1, cada puerta depende sólo del estado oculto anterior y del sesgo.
    z t = σ ( U z h t 1 + b z ) r t = σ ( U r h t 1 + b r ) {\displaystyle {\begin{aligned}z_{t}&=\sigma (U_{z}h_{t-1}+b_{z})\\r_{t}&=\sigma (U_{r}h_{t-1}+b_{r})\\\end{aligned}}}
  • Tipo 2, cada puerta depende sólo del estado oculto anterior.
    z t = σ ( U z h t 1 ) r t = σ ( U r h t 1 ) {\displaystyle {\begin{aligned}z_{t}&=\sigma (U_{z}h_{t-1})\\r_{t}&=\sigma (U_{r}h_{t-1})\\\end{aligned}}}
Tipo 2
  • Tipo 3, cada puerta se calcula utilizando sólo el sesgo.
z t = σ ( b z ) r t = σ ( b r ) {\displaystyle {\begin{aligned}z_{t}&=\sigma (b_{z})\\r_{t}&=\sigma (b_{r})\\\end{aligned}}}

Unidad mínima cerrada

Tipo 3

La unidad mínima cerrada (MGU) es similar a la unidad de compuerta completa, salvo que el vector de compuerta de actualización y reinicio se fusiona en una compuerta de olvido. Esto también implica que la ecuación para el vector de salida debe cambiarse:[10]

f t = σ ( W f x t + U f h t 1 + b f ) h ^ t = ϕ ( W h x t + U h ( f t h t 1 ) + b h ) h t = ( 1 f t ) h t 1 + f t h ^ t {\displaystyle {\begin{aligned}f_{t}&=\sigma (W_{f}x_{t}+U_{f}h_{t-1}+b_{f})\\{\hat {h}}_{t}&=\phi (W_{h}x_{t}+U_{h}(f_{t}\odot h_{t-1})+b_{h})\\h_{t}&=(1-f_{t})\odot h_{t-1}+f_{t}\odot {\hat {h}}_{t}\end{aligned}}}

Variables

  • x t {\displaystyle x_{t}} : vector de entrada
  • h t {\displaystyle h_{t}} : vector de salida
  • h ^ t {\displaystyle {\hat {h}}_{t}} : vector de activación candidato
  • f t {\displaystyle f_{t}} : vector de olvido
  • W {\displaystyle W} , U {\displaystyle U} y b {\displaystyle b} : matrices de parámetros y vector

Unidad recurrente ligera

La unidad recurrente activada por luz (LiGRU)[4]​ elimina la puerta de reinicio, sustituye tanh por la activación ReLU y aplica la normalización por lotes (BN):

z t = σ ( BN ( W z x t ) + U z h t 1 ) h ~ t = ReLU ( BN ( W h x t ) + U h h t 1 ) h t = z t h t 1 + ( 1 z t ) h ~ t {\displaystyle {\begin{aligned}z_{t}&=\sigma (\operatorname {BN} (W_{z}x_{t})+U_{z}h_{t-1})\\{\tilde {h}}_{t}&=\operatorname {ReLU} (\operatorname {BN} (W_{h}x_{t})+U_{h}h_{t-1})\\h_{t}&=z_{t}\odot h_{t-1}+(1-z_{t})\odot {\tilde {h}}_{t}\end{aligned}}}

La LiGRU se ha estudiado desde una perspectiva bayesiana.[11]​ Este análisis dio lugar a una variante denominada unidad recurrente bayesiana ligera (LiBRU), que mostró ligeras mejoras sobre la LiGRU en tareas de reconocimiento del habla.

Referencias

  1. Cho, Kyunghyun; van Merrienboer, Bart; Bahdanau, DZmitry; Bougares, Fethi; Schwenk, Holger; Bengio, Yoshua (2014). «"Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation".». Association for Computational Linguistics. 
  2. Felix Gers; Jürgen Schmidhuber; Fred Cummins (1999). «Learning to forget: Continual prediction with LSTM".». 9th International Conference on Artificial Neural Networks: ICANN '99. ISBN 0-85296-721-7. doi:10.1049/cp:19991218. 
  3. «Recurrent Neural Network Tutorial, Part 4 – Implementing a GRU/LSTM RNN with Python and Theano – WildML». web.archive.org. 10 de noviembre de 2021. Consultado el 9 de marzo de 2024. 
  4. a b Ravanelli, Mirco; Brakel, Philemon; Omologo, Maurizio; Bengio, Yoshua (2018). «"Light Gated Recurrent Units for Speech Recognition"». IEEE Transactions on Emerging Topics in Computational Intelligence. doi:10.1109/TETCI.2017.2762739. 
  5. Su, Yuahang; Kuo, Jay (2019). «"On extended long short-term memory and dependent bidirectional recurrent neural network"». Neurocomputing. doi:10.1016/j.neucom.2019.04.044. 
  6. Chung, Junyoung; Gulcehre, Caglar; Cho, KyungHyun; Bengio, Yoshua (2014). Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling". 
  7. Gruber, N.; Jockisch, A. (2020). «"Are GRU cells more specific and LSTM cells more sensitive in motive classification of text?». Frontiers in Artificial Intelligence. PMC 7861254. PMID 33733157. doi:10.3389/frai.2020.00040. 
  8. Chung, Junyoung; Gulcehre, Caglar; Cho, KyungHyun; Bengio, Yoshua (2014). "Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling". 
  9. Dey, Rahul; Salem, Fathi M. (2017). "Gate-Variants of Gated Recurrent Unit (GRU) Neural Networks". 
  10. Heck, Joel; Salem, Fathi M. (2017). "Simplified Minimal Gated Unit Variations for Recurrent Neural Networks". 
  11. Bittar, Alexandre; Garner, Philip N. (2021-06). «A Bayesian Interpretation of the Light Gated Recurrent Unit». ICASSP 2021 - 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP): 2965-2969. doi:10.1109/ICASSP39728.2021.9414259. Consultado el 11 de marzo de 2024.