Multi-head attention was originally conceived as a way for neural networks to attend to information from different representation subspaces simultaneously. In theory, each "head" should act as a unique observer, capturing distinct semantic or syntactic features—one head might focus on the subject of a sentence, while another tracks the verb or a specific visual attribute.
In practice, however, these heads often suffer from "head collapse," where multiple heads learn redundant patterns and focus on the same highly salient regions. This redundancy wastes the model's capacity and limits the richness of the resulting representations. To solve this, researchers have developed a suite of orthogonality constraints and diversity regularizers that mathematically force attention heads to "look elsewhere."
The Geometry of Non-Redundancy
The most common way to ensure diversity is to treat the attention weights as a matrix and penalize its self-similarity. In A Structured Self-Attentive Sentence Embedding, Zhouhan Lin and colleagues introduced a penalization term based on the Frobenius norm:
$$P = \|(AA^\top - I)\|_F^2$$
Here, $A$ is the matrix of attention weights across all heads, and $I$ is the identity matrix. By minimizing the difference between $AA^\top$ and the identity matrix, the model is incentivized to make the rows of the attention matrix orthogonal to one another. If two heads attend to the same words, their dot product will be high, increasing the penalty. To lower the loss, the heads must distribute their focus across different parts of the input.
This simple geometric constraint has profound effects. In dialogue systems, Chongyang Tao and others found that this penalty prevents "generic" responses by forcing the model to attend to multiple semantic aspects of a query, leading to more informative and diverse conversations (Get The Point of My Utterance!).
Where to Apply the Constraint
While penalizing the final attention maps is intuitive, researchers have explored different "levels" of the architecture to enforce diversity:
- Attention Affinity Matrices: Aston Zhang and colleagues demonstrated in On Orthogonality Constraints for Transformers that regularizing the affinity matrix (the raw scores before softmax) improves numerical stability and translation quality, particularly in large-scale models.
- Projection Weights: Instead of penalizing the output, one can constrain the internal Query, Key, and Value matrices ($W_Q, W_K, W_V$). Yuqing Wang proposed using a Momentum Stiefel Optimizer to ensure these matrices remain strictly orthogonal during training, which decorrelates features within the representation subspace (Momentum Stiefel Optimizer).
- Head Outputs: Jian Li introduced "disagreement regularization," which maximizes the cosine distance between the actual vectors produced by each head. This ensures that even if heads look at similar regions, they extract different information from them (Multi-Head Attention with Disagreement Regularization).
Beyond Text: Vision and Anomaly Detection
The need for diversity is perhaps most visible in computer vision. In tasks like person re-identification, a model might overfit to a single high-contrast feature, like a bright red shirt. Tianlong Chen and the authors of ABD-Net used orthogonality to force the network to capture a "holistic" view, attending to shoes, hats, and bags in addition to the most obvious garments.
Similarly, in Disentangling Tabular Data towards Better One-Class Anomaly Detection, Jianan Ye used cosine similarity constraints to ensure that different attention heads partitioned the feature space into non-overlapping views. This "disentanglement" prevents the model from learning trivial, uniform patterns, making it much more sensitive to anomalies that break complex attribute correlations.
Why It Works: The Intuition of Coverage
The underlying principle across all these papers is coverage. A standard attention mechanism is "greedy"—it wants to find the single most predictive feature and ignore everything else. Orthogonality acts as a counter-force. It creates a competitive environment where once a feature is "claimed" by one head, other heads are penalized for focusing on it.
This forces the model to explore the "long tail" of features. As Ruoyi Du showed in the context of fine-grained classification, this mechanism effectively "mines" the entire object for subtle cues that a standard model would simply smooth over (Knowledge Transfer Based Fine-grained Visual Classification). By enforcing diversity, we ensure that the multi-head architecture is not just a collection of redundant filters, but a truly multi-faceted representation engine.