The decoder then generates the target tree by inserting the LSTM state of the root into a queue of nodes to be expanded. While the queue contains elements, one is popped out and an attention mechanism is applied to determine what nodes in the input tree are most relevant [1]}. The attention mechanism is based on computing a dot product of a representation of the hidden state with all the encoded representations from the input tree [2]} and produces a context vector \(e_s\) . From there, the hidden state and the context vector are used to determine the probabilities of the next token as shown in Equations (2) and (3).
\(e_t = \mathbf {tanh}(W_1 [e_s ; h])\) 
\(t_t = \textbf {argmax softmax} (We_t)\) 
