12RNNs with Attention
12.1 Introduction
In this chapter we introduce attention, an enhancement mechanism for an RNN providing the capability that the information generated by the previous hidden states is directly available at each step [102, 103]. Recall from Chapter 10 that in an RNN, at step
, only the hidden state information from the previous step
can be directly used. Recursively,
only has direct access to the hidden state information of
from step
, which, in turn, has utilized the hidden state of
, and so on. But the indirect information from distant past hidden states only has a weak influence on the current hidden state, especially as the distance to a past hidden state grows. On the other hand, in an RNN with attention, denoted as RNN‐Att, all hidden states generated at the previous steps (i.e. for a sequence of consecutive inputs) are directly available when computing the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access