[Paper Review] Understanding How Encoder-Decoder Architectures Attend
This paper introduces a decomposition of encoder-decoder hidden states into temporal (sequence-position independent) and input-driven (input-dependent) components to explain how attention matrices are formed. The authors show that networks rely more on temporal components when attention matrices are close to a shared average, regardless of architecture—revealing a unified mechanism across recurrent and feed-forward models despite differing dynamics in temporal component formation.
Encoder-decoder networks with attention have proven to be a powerful way to solve many sequence-to-sequence tasks. In these networks, attention aligns encoder and decoder states and is often used for visualizing network behavior. However, the mechanisms used by networks to generate appropriate attention matrices are still mysterious. Moreover, how these mechanisms vary depending on the particular architecture used for the encoder and decoder (recurrent, feed-forward, etc.) are also not well understood. In this work, we investigate how encoder-decoder networks solve different sequence-to-sequence tasks. We introduce a way of decomposing hidden states over a sequence into temporal (independent of input) and input-driven (independent of sequence position) components. This reveals how attention matrices are formed: depending on the task requirements, networks rely more heavily on either the temporal or input-driven components. These findings hold across both recurrent and feed-forward architectures despite their differences in forming the temporal components. Overall, our results provide new insight into the inner workings of attention-based encoder-decoder networks.
Motivation & Objective
- To understand the mechanisms behind attention matrix formation in encoder-decoder networks, especially across different architectures.
- To investigate how temporal and input-driven components of hidden states contribute to attention behavior in sequence-to-sequence tasks.
- To determine whether attention dynamics differ meaningfully between recurrent and feed-forward architectures despite structural differences.
- To develop a decomposition method that isolates input-driven and temporal dynamics to improve interpretability of attention mechanisms.
Proposed method
- The authors decompose encoder and decoder hidden states into two orthogonal components: one dependent on input sequence (input-driven) and one independent of input (temporal).
- They use linear projection to separate the hidden state vector into a sum of a temporal component and an input-driven component, enabling disentanglement of dynamics.
- The decomposition is applied across three architectures: AED (attention-based encoder-decoder), VED (vanilla encoder-decoder), and a recurrent variant with attention.
- They analyze how each component contributes to attention matrix formation, particularly in tasks with diagonal attention matrices and sample-dependent variations.
- They evaluate the alignment of readout vectors with input components and temporal dynamics, especially in the context of logit contributions to model outputs.
- They use synthetic tasks and visualization techniques, including principal component analysis, to trace hidden state trajectories and assess clustering behavior.
Experimental results
Research questions
- RQ1How do temporal and input-driven components of hidden states contribute to attention matrix formation in encoder-decoder models?
- RQ2To what extent do these components vary across different architectures (e.g., recurrent vs. feed-forward)?
- RQ3Why do networks form attention matrices that are close to a shared average matrix in certain tasks, and what drives sample-specific deviations?
- RQ4How do the dynamics of the decoder readout and context vector readout interact in attention-based models?
- RQ5What structural patterns emerge in hidden state space, such as tree-like organization, and how do they relate to attention and sequence generation?
Key findings
- The temporal component of hidden states plays a dominant role in attention matrix formation when the average attention matrix is a good approximation of individual sample matrices.
- The input-driven component becomes more influential when attention matrices deviate significantly from the average, indicating task-specific alignment mechanisms.
- Despite differing dynamics in temporal component formation, both recurrent and feed-forward architectures rely on similar component interactions to generate attention, suggesting a shared underlying mechanism.
- In the AED model, context vector readouts align closely with input components and contribute significantly more to logit differences than decoder hidden state readouts, which are nearly orthogonal and contribute uniformly.
- In the VED model, encoder hidden states form a tree-like structure in hidden space, with distinct paths for different input phrases, but no mirrored tree structure is observed in the decoder, indicating distinct learning dynamics.
- The decoder readouts in AED are nearly orthogonal to context vector readouts and contribute minimally to logit differences, confirming that context vectors are the primary drivers of output prediction.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.