acceptodds
Published as a conference paper at NeurIPS 2026

Data-Adaptive Mahalanobis Metric Learning for Cross-Head Attention in Transformers

Zhenke Duan, Xin Li, Jiqun Pan, Xiaofei Dong, Hanwen Ning, Xinyuan Song

Abstract

In this paper, we propose Data-Adaptive Mahalanobis Cross-Head Attention (DAMCHA), a simple and effective attention mechanism that generalizes Multi-Head Attention (MHA) through the lens of metric learning. Standard MHA implicitly learns a static, head-wise Euclidean similarity corresponding to the diagonal blocks of a unified cross-head metric matrix, discarding all off-diagonal interactions across heads. DAMCHA addresses this limitation via two key innovations. First, it learns the full cross-head metric matrix, inducing a Mahalanobis-like similarity that explicitly captures inter-head interactions beyond the restricted block-diagonal structure of MHA. Second, it parameterizes the metric matrix as an input-dependent function, enabling the attention geometry to dynamically adapt to the intrinsic manifold structure of the data rather than remaining fixed after training. We further introduce principled regularization strategies, most notably stack-wise parameter sharing, to ensure computational efficiency and stable optimization. DAMCHA serves as a drop-in replacement for MHA and its variants in various Transformer architectures, delivering superior expressive power and learning performance with comparable or reduced computational overhead. Extensive experiments demonstrate that DAMCHA-based Transformers consistently outperform competing baselines across a range of benchmark tasks. Code is available at https://anonymous.4open.science/r/DAMCHA-3B37.

Keywords:
Sydney

Reviews

Among:
Shape:
123456this paper, Bottom 17%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.00 over 3 reviews, above 17% of the others.
Reviewer_WqVvOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
2
Quality
2
Significance
2
Read review
Summary

This paper proposes a new attention mechanism, Data-Adaptive Mahalanobis Cross Head Attention (DAMCHA). While in standard multi-head attention the softmax score matrix is computed per head between query and key representations, DAMCHA computes scores between each head as well. The main idea behind their mechanism is a cross-head matrix is basically computing score matrices between keys and queries representations of different heads. They parameterize the cross head attention matrix and introduce a learnable function (in practice, another network) which maps each input sequence to a cross-head matrix. The main benefits of DAMCHA that the authors claim in the introduction are: (1) improved modeling of complex dependencies (due to the full cross-head attention matrix), (2) adaptability to distribution shift, (3) bypassing the low-rank bottleneck.

Strengths and weaknesses

To preface this review, I will note that I am not very familiar with the background literature that the authors reference (e.g. DMCHA, THA, MoA) beyond skimming those papers. Therefore, if I have misunderstood something in the paper, I am happy to discuss with the authors and adjust my score.

Strengths:

  1. The theoretical claims seem to be correct. I read the proofs in the appendix and there does not seem to be any immediate issue with the correctness.
  2. The paper is reasonably clear and easy to follow. In particular, the authors provide extensive ablations for each significant part of the DAMCHA mechanism (e.g. the shared parameters and the learned CHM). I also appreciated the experiment where the authors explicitly show that cross-head attention provides a benefit when the task requires coordination across multiple heads (entangled subspaces).

Weaknesses:

  1. The connection to Mahalanobis distance seems a little weak to me. It seems that the main point of this paper is to introduce a way of learning similarities between attention heads and it is not clear to me the connection to the Mahalanobis metric beyond this point. I would appreciate a clearer explanation of the specific advantages of the Mahalanobis framing.
  2. The connection to previous work should be clarified either in the introduction or in the related work. I did not really understand the connection of this paper to previous work, especially to DMCHA. While the authors have a section in their appendix outlining differences between other alternatives to standard multi-head attention, I did not fully understand the difference between DAMCHA and DMCHA. Can an architecture that uses DAMCHA represent or implement an architecture which uses DMCHA? It is not clear why one version might be superior over the other. The empirical improvements also seems small to me (e.g. on CIFAR-10 and CIFAR-100, the difference between the MSE of DAMCHA and DMCHA is at most 0.005).
  3. The claim of adaptability to distribution shift is not currently well supported in the experiments or the theoretical claims. Unless I have missed something, it is not clear where the authors show that DAMCHA is more adaptive to distribution shift. While they point to Figure 3 in their paper, all I see the distribution of some error metric on WMT. It is unclear what kind of distribution shift this is meant to capture, or why this error distribution demonstrates adaptability. In my understanding, adaptability to distribution shift means that we should expect to see, empirically, that the model performs well on a shifted test distribution (i.e. the test distribution differs from the train distribution along some relevant axis like types of images for vision tasks or input length for language).
Questions
  1. I found the ablation exploring the depth of the initial fθf_\theta in Table 3 useful. It seems that the performance of DAMCHA depends heavily on the depth of the initial fθf_\theta. Do the authors anticipate that further gains for DAMCHA can be obtained if we go beyond 9 layers or does the performance of the DAMCHA converge after a certain depth?
  2. I am slightly concerned that the training time chosen for each experimental setting is too low. Table 8 in the appendix shows that only 50 epochs are taken for datasets such as CIFAR-10, CIFAR-100, WMT, and CommonGen. Why do the authors choose 50 epochs for training each network the your experiments? Are there convergence plots for training or validation? As a related point, I wonder if the authors could also provide their settings for hyperparameter tuning.
  3. This is a smaller point but are there error bars for Tables 4, 5, and 6? Given that the authors are proposing an alternative to standard attention, I think it would be important to include error bars wherever possible so we can understand exactly how significant the performance gains are for DAMCHA over other comparable baselines.
  4. Is it possible the clarify the claim of adaptability to distribution shift? What exactly do the authors mean by this and are there more extensive experiments supporting this claim? Or have I misunderstood the theoretical claims and they imply that DAMCHA is adaptive to distribution shift?
  5. I see Table 3 and the analysis in Section D of the appendix which helps clarify the efficiency of DAMCHA, but I am wondering empirically how efficient this method is as the sequence length increases. Is it possible to provide an empirical scaling plots which show latency or memory usage as a function of sequence length? Could the authors also clarify which implementation of standard attention is being used as in the baseline implementation? I think, in practice, optimized variants like FlashAttention are commonly used. Is DAMCHA comparable in practice to such optimized variants? Or is it possible to also adapt DAMCHA so that it can make use of the optimizations introduced previously?
Limitations

Yes

Paper formatting concerns

No

Final justification

Thank you for the detailed response. The authors have addressed my concerns and questions, including those related to distribution shift and positioning of the work. They provided many more experiments that helped me understand the significance of their empirical results and the benefits of DAMCHA. After reading the response as well as the other reviews, I am increasing my score to a 4.

1 comment

We appreciate your valuable comments. We would like to address your concerns carefully. We have completed several additional experiments and prepared more detailed explanations for all the weakness and questions from the reviewer. However, due to the response-length limit, we first focus on the concerns raised in the Weaknesses section. We will continue to address the points listed under Questions during the subsequent discussion period.

Response 1: The Connection to Mahalanobis Distance Is Weak

From our cross-head perspective, conventional attention mechanisms mainly focus on the diagonal blocks of a large metric matrix, whereas DAMCHA additionally incorporates its off-diagonal blocks. This is conceptually similar to the distinction between Euclidean and Mahalanobis distances, where the latter accounts for dependencies across dimensions.

We also acknowledge that a conventional Mahalanobis matrix is typically symmetric, whereas the effective metric generated by DAMCHA is not necessarily symmetric. Therefore, to facilitate understanding rather than claim a strict equivalence, we use the term Mahalanobis-like in the paper and clarify the scope of this analogy.

Response 2: The Relationship and Expressive Capacity of DAMCHA and DCMHA

We thank the reviewer for raising this positioning issue. We understand that “DMCHA” in the review refers to DCMHA. Although the original manuscript provides a comparison in the appendix, we agree that the core distinction between the two methods was not sufficiently explained in the Introduction and Related Work.

Both DAMCHA and DCMHA introduce input-dependent cross-head interactions, but their input dependence operates at different stages and parameterizes different objects. DCMHA first computes the base score matrix of each head through standard query-key projections and then applies an input-dependent Compose module to combine the existing scores or attention weights across heads. In other words, DCMHA dynamically determines how to recombine attention patterns produced by fixed Q/K projections.

DAMCHA instead directly generates an input-dependent effective similarity metric Mi(X)M_i(X) before the attention scores are formed and computes the scores as Si(X)=XiMi(X)Xi⊤/dhS_i(X)=X_iM_i(X)X_i^\top/\sqrt{d_h}. Therefore, DCMHA mainly introduces dynamics into the combination of existing score bases, whereas DAMCHA directly introduces dynamics into the similarity geometry that produces these scores.

Comparison DimensionDCMHADAMCHA
Location of cross-head interactionCombines scores or weights after the base attention scores are formedDirectly generates the similarity metric before attention scores are formed
Input-dependent objectCross-head combination coefficients or Compose operationsComplete input-conditioned metric matrix M(X)M(X)
Source of base similarityHead-wise score matrices produced by standard Q/K projectionsEffective metric directly produced by a metric generator
Expressive spaceDynamic combinations of fixed base score matricesCan generate metrics outside the span of fixed score bases
Low-rank restrictionBase scores still arise from per-head low-rank Q/K factorizationsThe effective metric need not follow the same fixed Q/K factorization
Primary objectiveDynamically reorganize and coordinate existing attention patternsDynamically change the similarity geometry underlying attention patterns

The two methods have partial functional overlap. For example, suppose the pre-softmax composition of DCMHA is written as SiDCMHA(X)=∑jαij(X)Sj(X)S_i^{\mathrm{DCMHA}}(X)=\sum_j\alpha_{ij}(X)S_j(X), where each base score satisfies Sj(X)=XjMjXj⊤S_j(X)=X_jM_jX_j^\top. Under appropriate dimensional alignment, the corresponding linear combination can be interpreted from a metric perspective as Mieff(X)=∑jαij(X)MjM_i^{\mathrm{eff}}(X)=\sum_j\alpha_{ij}(X)M_j. DAMCHA can represent this class of input-dependent pre-softmax metric combinations through its metric generator. Therefore, some pre-softmax composition mechanisms in DCMHA can be viewed as special cases expressible by DAMCHA.

However, we do not claim that DAMCHA can fully reproduce an arbitrary DCMHA architecture. DCMHA may also dynamically combine attention weights after softmax. Because softmax is nonlinear, in general Softmax⁡(∑jαjSj)≠∑jαjSoftmax⁡(Sj)\operatorname{Softmax}(\sum_j\alpha_jS_j)\neq\sum_j\alpha_j\operatorname{Softmax}(S_j). Therefore, an arbitrary post-softmax Compose operation cannot necessarily be represented exactly by a single DAMCHA metric.

Conversely, DCMHA cannot necessarily represent an arbitrary DAMCHA metric. The base scores in DCMHA are still generated by a finite set of fixed Q/K metrics, and their dynamic combinations generally remain within the span of these base score patterns. DAMCHA can instead directly generate input-dependent, off-diagonal, or higher-rank effective metrics outside this fixed basis space. More precisely, the two methods partially overlap at the level of linear pre-softmax composition, but there is no simple bidirectional inclusion relationship between their complete architectures.

This distinction also explains why DAMCHA may outperform DCMHA on some tasks. When the task primarily requires reallocating or combining existing head-wise attention patterns, DCMHA may already be highly effective, and the differences in average metrics such as MSE or NLL may be small. However, when the task requires the similarity itself to change with the current input, such as when two features should be strongly related in one context but weakly related in another, or when the target relationship depends on cross-subspace couplings outside the fixed Q/K score bases, recombining existing scores may be insufficient. DAMCHA can directly alter the attention geometry by generating a new effective metric.

The experimental results are consistent with this interpretation. Compared with DCMHA, DAMCHA achieves relatively moderate improvements in MSE on CIFAR-10 and CIFAR-100, but more substantial improvements in FID, FID@Top-50, and WMT BARTScore, which depend more strongly on complete sample structure and cross-head coordination.

Response 3: The MSE Improvements on CIFAR-10 and CIFAR-100 Are Small

We thank the reviewer for this observation. When considering only MSE, the improvements of DAMCHA over DCMHA are indeed relatively limited. On CIFAR-10, MSE decreases from 0.1264 to 0.1210, an absolute reduction of 0.0054. On CIFAR-100, it decreases from 0.1261 to 0.1232, an absolute reduction of 0.0029.

This result is nevertheless consistent with the primary design objective of DAMCHA. MSE averages the error over individual pixels or prediction positions and mainly measures local numerical reconstruction accuracy. It is less sensitive to the overall structure, visual clarity, and distributional quality of generated samples. DAMCHA is designed to improve the structural consistency and high-quality generation of complete samples through input-dependent cross-head coordination. Its advantages are therefore reflected more directly in FID and FID@Top-50 and need not appear with the same magnitude in average MSE.

DatasetMetricDCMHADAMCHADAMCHA Improvement
CIFAR-10MSE ↓0.12640.12104.27% reduction
CIFAR-10FID ↓366.0802331.89069.34% reduction
CIFAR-10FID@Top-50 ↓105.126963.029540.04% reduction
CIFAR-100MSE ↓0.12610.12322.30% reduction
CIFAR-100FID ↓365.2419314.572213.87% reduction
CIFAR-100FID@Top-50 ↓79.944353.756032.76% reduction

The primary effect of DAMCHA is therefore not simply to uniformly reduce the error of every pixel, but to improve the overall generation distribution and its high-quality region. The relatively small MSE difference does not conflict with the central claim of the paper. Instead, it indicates that the more substantial gains are concentrated in the complete-sample quality that we primarily aim to improve. Importantly, these high-quality generation gains are not obtained by sacrificing average performance.

Response 4: Adaptation to Distribution Shift

In the image-generation experiments, “distribution” refers to the distribution of generated samples relative to the target real-data reference distribution, rather than an OOD shift between the training distribution and an unseen test distribution. More precisely, the reference is the distribution of real samples in a pretrained feature space, while FID is the metric used to quantify the distance between the generated and reference distributions.

FID is not an ordinary pointwise error metric. It measures the distance between the generated and real-sample distributions in a pretrained feature space by comparing their means and covariances. Its form is dFID=∥μr−μg∥22+Tr⁡(Σr+Σg−2(ΣrΣg)1/2)d_{\mathrm{FID}}=\|\mu_r-\mu_g\|_2^2+\operatorname{Tr}(\Sigma_r+\Sigma_g-2(\Sigma_r\Sigma_g)^{1/2}), where (μr,Σr)(\mu_r,\Sigma_r) and (μg,Σg)(\mu_g,\Sigma_g) denote the feature-distribution statistics of the real and generated samples, respectively. Therefore, the distributional improvement discussed in the paper means that samples generated by DAMCHA achieve a lower FID under the same reference standard and that their feature distribution is closer to the real-data distribution.

To prevent “distribution-shift adaptation” from being interpreted as robustness to unseen test domains, we will replace this expression in the revised manuscript with more precise terms such as “improved modeling of the target generation distribution” or “input-conditional adaptation of generation geometry.”

The lower FID values achieved by DAMCHA on CIFAR-10 and CIFAR-100 indicate that its generated samples are closer to the target distribution at the feature-distribution level, rather than merely having lower individual pixel errors. This supports our claim regarding generation-distribution modeling and input-conditioned geometry. Thanks very much for your kind help.

Reviewer_t6ujOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
2
Quality
3
Significance
3
Read review
Summary

This paper proposes a new multi-head attention (MHA) mechanism, called DAMCHA, that aims to overcome limitations of standard MHA. Conventional MHA variants typically learn static, head-wise Euclidean similarity, which restricts modeling of interactions across attention heads and do not adapt to input structure. In contrast, DAMCHA learns a full cross-head, Mahalanobis-type similarity, parameterized as an input-dependent function, allowing the similarity structure to dynamically adapt to the data. The method learns similarity matrices via a functional mapping instead of standard linear query–key projections, thereby addressing the low-rank bottleneck commonly associated with those projections. The authors further introduce stack-wise parameter sharing to control model complexity and mitigate overfitting. The proposed method is evaluated empirically on a range of tasks, including text and image generation, token-level pretraining and classification with multiple baselines and ablation studies.

Strengths and weaknesses

The paper addresses the important problem of enriching attention mechanisms to capture both intra-head and cross-head interactions in an input-adaptive manner. The use of a full cross-head Mahalanobis-type similarity, combined with functional mappings for the similarity matrices, is a reasonably novel and interesting approach that directly targets the low-rank bottleneck of traditional query–key projections. The introduction of stack-wise parameter sharing is a practical design choice that keeps the model from becoming prohibitively expensive. It also helps reduce overfitting risk while still benefiting from richer similarity structure. Empirically, the paper presents extensive experiments across diverse domains (text and image) and settings (generation, token-level pretraining, and classification) along with ablation studies, which provide reasonably strong support for the claimed benefits of the proposed method.

The main weakness is that the related work section feels incomplete, given the breadth of the attention literature. In particular, the discussion of prior work on input-adaptive similarity, learning similarity matrices (including functional mappings/different ways of parameterizing or factorizing query–key similarity) is relatively limited, making it hard to clearly position DAMCHA against closely related ideas. Similarly, the paper does not sufficiently clarify its relationship to existing approaches that also consider cross-head interaction mechanisms; a more explicit comparison to those methods, either in the related work or other sections in the main paper, would help contextualize the technical novelty. On the empirical side, although ablations are included, some results raise questions: for example, in Table 4 (Section 5.3), it is not obvious why the “w/o f(x) and share” configuration is not consistently worse than “w/o share,” and this deserves clarification and possibly deeper analysis. Overall, while the method is promising, the paper would benefit from a more thorough positioning within the literature and clearer analysis of some ablation results.

Questions
  1. In Line 108, should the dimension of Mi,j(X)M_{i,j}(X) be d×dd \times d instead of dh×dhd_h \times d_h as currently written, or is there a specific reason for using dhd_h?
  2. In Table 4 (ablation study in section 5.3), could you explain why “w/o f(x) and share” configuration is not consistently worse than “w/o share” across all settings? Is there an underlying interaction effect that explains this pattern?
Limitations

yes, in the checklist. The authors can have a dedicated limitations section in the main paper to discuss them.

Paper formatting concerns

none

Final justification

The clarifications provided regarding positioning of the paper with prior work and the ablations are helpful. Including these in the revision along with modifying the model details to maintain consistency of the dimensionality will improve the paper. I maintain my opinion of leaning towards acceptance with a score of 4.

1 comment

Response 1: Incomplete Related Work and Insufficiently Clear Positioning of Novelty

We agree that metric learning is a well-established and widely used paradigm. However, to the best of our knowledge, attention mechanisms have not previously been examined from this perspective. Although the underlying tool is not new, the perspective is novel, and the proposed attention mechanism is both simple and effective. We also agree that the mechanism-level comparison currently presented in the appendix should be moved forward to the Introduction and Related Work sections. The revised manuscript will include the following mechanism-level comparison:

MethodLocation of Cross-Head InteractionInput-DependentDirectly Changes the Similarity MetricMain Limitation
THAMixes head logits/weights before or after softmaxNoNoRetains fixed low-rank Q/K metrics
DCMHADynamically combines existing scores/weightsYesPartiallyThe combination is based on fixed Q/K score bases
ColMHAShares or decomposes Q/K projectionsNoReparameterization onlyThe metric remains static
MoAPerforms token-level head routingYesNoEach selected head still constructs its similarity independently
MMAUses fixed head-specific masksNoNoChanges visible positions rather than similarity geometry
DAMCHADirectly generates the effective metric before score formationYesYesCan generate metrics beyond the span of fixed Q/K metric bases

In particular, the pre-softmax linear score composition in DCMHA can be written as M‾i(X)=∑jαi,j(X)Mj\overline{M}_i(X)=\sum_j\alpha{i,j}(X)M_j. Such a composition can be represented by DAMCHA. However, because of the nonlinearity of softmax, arbitrary post-softmax compositions in DCMHA cannot necessarily be reproduced exactly by DAMCHA. Conversely, DAMCHA can generate full-rank or explicitly cross-head metrics that do not belong to the span of the fixed Q/K metric bases.

Response 2: The Two Ablations in Table 4 Do Not Exhibit a Consistent Ordering

We thank the reviewer for noting this phenomenon. The original manuscript’s statement that “the two components each provide consistent improvements” is not sufficiently precise. The two ablations are not strictly nested models, nor do they differ by only one factor:

  • w/o (f(x))+share removes both input-dependent metric generation and cross-layer sharing, resulting in a static cross-head metric independently learned at each layer;
  • w/o share retains input-dependent metric generation but assigns an independent generator to each layer;
  • DAMCHA retains both input-dependent metric generation and cross-layer sharing.

Therefore, the first two variants reflect different trade-offs between capacity and regularization, and they should not be expected to exhibit a fixed monotonic ordering across all datasets and metrics.

ConfigurationInput-Dependent MetricCross-Layer SharingComplexityMain Risk
w/o (f(x))+shareNoNoLowerA static metric may introduce larger approximation bias
w/o shareYesNoHighestMore parameters may cause layer-wise metrics to diverge or overfit
DAMCHAYesYesModerateSharing prevents excessive divergence among generators

In fact, the relationship between the f(x)f(x) generator and the sharing mechanism is inherently joint. The sharing mechanism is introduced to control the parameter cost of f(x)f(x) and preserve computational feasibility and scalability. Under the w/o share setting, metric-learning generators are independently learned at different layers without a parameter-sharing constraint. This substantially increases model capacity and may lead to overfitting, thereby causing larger performance degradation on some datasets.

These observations show that sharing is not merely an optional auxiliary component, but an indispensable design that ensures the feasibility and effective learning of f(x)f(x). The two components therefore form a joint mechanism, which further supports the validity of our design.

Response 3: Whether the Dimension in Line 108 Is Incorrect

We thank the reviewer for pointing out this notation issue. The dimension of each metric block in Line 108, Mi,j(X)∈Rdh×dhM_{i,j}(X)\in\mathbb{R}^{d_h\times d_h}, is intentional. The complete cross-head metric matrix is constructed as an h×hh\times h block matrix, and since d=hdhd=hd_h, the full matrix satisfies M(X)∈Rd×dM(X)\in\mathbb{R}^{d\times d}.

However, the reviewer correctly identified that the subsequent score equation in the main text directly uses X∈RL×dX\in\mathbb{R}^{L\times d} together with mi(X)∈Rdh×dhm_i(X)\in\mathbb{R}^{d_h\times d_h}. Under the current notation, the product Xmi(X)X⊤Xm_i(X)X^\top is therefore dimensionally invalid. This was not intended to indicate a different dimensional design; rather, the main text omitted an explicit notation for the head-local representation.

The correct definition is to first write the input as X=Concat⁡(X1,…,Xh)X=\operatorname{Concat}(X_1,\ldots,X_h), where Xi∈RL×dhX_i\in\mathbb{R}^{L\times d_h}. Each cross-head metric block satisfies Mi,j(X)∈Rdh×dhM_{i,j}(X)\in\mathbb{R}^{d_h\times d_h}. After aggregating the iith block row, we obtain M‾i(X)=∑j=1hMi,j(X)∈Rdh×dh\overline{M}i(X)=\sum_{j=1}^{h}M_{i,j}(X)\in\mathbb{R}^{d_h\times d_h}. Accordingly, the score of the ii-th attention head should be written as Si(X)=1dhXiM‾i(X)Xi⊤∈RL×LS_i(X)=\frac{1}{\sqrt{d_h}}X_i\overline{M}_i(X)X_i^\top\in\mathbb{R}^{L\times L}.

This formulation is also consistent with the notation Xi∈RL×dhX_i\in\mathbb{R}^{L\times d_h} used in the complexity analysis in the appendix. In other words, the block dimension in Line 108 is correct; what needs to be corrected is the imprecise use of XX as shorthand for XiX_i in the subsequent score equation. If the full input X∈RL×dX\in\mathbb{R}^{L\times d} is retained instead, then the corresponding effective metric must indeed have dimension d×dd\times d.

We will unify the relevant notation across the main text, figures, and appendix in the revised manuscript and explicitly distinguish the dimensions of the complete CHM and the head-local metric blocks.

We sincerely appreciate your great efforts, valuable comments and kind help for our paper.

Reviewer_76A5OpenReview ↗
Rating
4
Clarity
3
Confidence
5
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper introduces DAMCHA, an attention mechanism that generalizes standard multi-head attention by explicitly modeling cross-head similarities. The authors introduce a Cross-Head Metric Matrix and interpret conventional MHA as learning only its block-diagonal part. They then propose learning a full cross-head metric, using an input-dependent function to adapt it to each sample, and computing attention scores through generalized quadratic forms. Experiments on image and text generation, GPT-2 language modeling, ViT classification report consistent gains over MHA.

Strengths and weaknesses

Strengths:

  • Interpreting standard MHA as a block-diagonal metric and proposing a joint Mahalanobis-type metric over all heads is interesting and gives the method a coherent geometric motivation.

  • The paper includes extensive experiments and ablation studies. The method is evaluated across multiple settings, including autoregressive generation, GPT-2 language modeling, ViT image classification, and synthetic tasks.

  • The experiments show that DAMCHA improves over standard MHA across the evaluated settings.

Weaknesses:

  • A direct empirical efficiency comparison against plain MHA appears to be missing from Table 2; moreover, the text mentions throughput, but Table 2 reports only memory, GFLOPs, and latency.

  • Empirical robustness for some main experiments is missing. The paper’s own checklist states that the main generation and language-modeling results do not report error bars or other measures of statistical significance; the paper attributes this to compute constraints. Such uncertainty reporting is provided only for the synthetic experiments.

  • The empirical gains are not uniformly strong across all metrics. While the improvements are meaningful on FID, BARTScore, and several Top-50 metrics, some average metrics change only modestly for instance, the improvement in MSE is relatively small.

Questions
  1. Could the authors provide a direct empirical efficiency comparison against plain MHA and clarify the throughput reporting in Table 2? The text states that Table 2 includes memory usage, GFLOPs, latency, and throughput, but the table appears to report only memory, GFLOPs, and latency.

  2. Could the authors comment more explicitly on where DAMCHA provides the largest practical benefit, and in what regimes the gains are relatively small?

  3. Theorem C.2 appears to rely on fairly strong assumptions. Could the authors clarify how essential these assumptions are, how well they align with realistic settings, and whether the result can be established under weaker assumptions?

Limitations

Yes

Paper formatting concerns

NA

Final justification

The detailed rebuttal and follow-up experiments addresses most my questions. The direct efficiency comparison with standard MHA, including throughput, addresses my first concern. The repeated CIFAR-10 and CommonGen experiments address my concern about empirical robustness, and the discussion of metric-dependent gains and applicable regimes clarifies where DAMCHA is useful. I also found the clarification of Theorem C.2 under weaker, approximate conditions helpful. I therefore maintain my recommendation to accept the paper and have increased my confidence level to 5.

1 comment

Response 1: Table 2 Omits MHA, and the Main Text Mentions Throughput Without Reporting It

We thank the reviewer for pointing out that throughput is missing from Table 2. We recorded this metric in the original experiments, but removed it because latency and throughput are correlated to some extent and because of the manuscript’s page limit. We now provide the throughput results below. DAMCHA achieves higher throughput than THA, DCMHA, MMA, and MoA while maintaining relatively low GFLOPs and memory overhead. Its throughput is also comparable to that of ColMHA. This further demonstrates that DAMCHA’s performance improvement does not result from a substantial increase in computational cost, but instead provides a competitive quality-efficiency trade-off. Due to time constraints, we will provide the MHA results later during the response period.

MethodCifar10Cifar100CommonGenWMT
THA2289.62263.12215.51096.0
DCMHA1800.61778.21806.7981.8
ColMHA2237.12252.32266.92068.3
MMA479.7454.4309.3180.4
MoA1961.71952.21953.61181.7
DAMCHA2068.32081.72081.22053.9

Response 2: The Main Generation and Language Modeling Experiments Lack Error Bars

We conducted additional repeated experiments to further validate the reliability of our conclusions.

CIFAR-10 Results:

MethodMSE ↓FID ↓FID@Top-50 ↓
MHA0.1262 ± 0.0009359.4200 ± 4.7692.1400 ± 3.28
THA0.1355 ± 0.0012367.2100 ± 5.02107.8600 ± 4.06
DCMHA0.1265 ± 0.0008365.7300 ± 4.41104.5200 ± 3.72
ColMHA0.1274 ± 0.0009365.1100 ± 4.66119.4800 ± 4.85
MMA0.1291 ± 0.0010360.1400 ± 5.1885.4200 ± 3.09
MoA0.1572 ± 0.0015369.0300 ± 5.2799.3100 ± 4.11
DAMCHA0.1212 ± 0.0006332.4700 ± 3.6263.5800 ± 2.21

CommonGen Results:

MethodNLL ↓BARTScore ↑BARTScore@Top-50 ↑
MHA5.7580 ± 0.036-5.9290 ± 0.048-4.2560 ± 0.031
THA5.2310 ± 0.025-5.6350 ± 0.022-3.7490 ± 0.019
DCMHA5.2780 ± 0.022-5.6710 ± 0.018-3.8150 ± 0.021
ColMHA5.2230 ± 0.023-5.6770 ± 0.019-3.7970 ± 0.020
MMA5.2980 ± 0.029-8.0810 ± 0.061-6.2240 ± 0.049
MoA5.2940 ± 0.027-5.6840 ± 0.020-3.7930 ± 0.022
DAMCHA5.2190 ± 0.017-5.6110 ± 0.013-3.7390 ± 0.015

These results allow us to more accurately distinguish the gains reflected by different types of metrics. On CIFAR-10, DAMCHA shows clear advantages in both overall generation quality, as measured by FID, and high-quality generation, as measured by FID@Top-50. On CommonGen, although the NLL difference relative to DCMHA is relatively small, the advantages in BARTScore and BARTScore@Top-50 remain consistent.

Due to time constraints, we are unable to complete the additional GPT-2 and ViT experiments during the response period. However, we will provide the corresponding results and further discussion in a subsequent revision.

Response 3: The Improvements Are Uneven Across Different Metrics

We thank the reviewer for this observation. We agree that the magnitude of improvement is not entirely consistent across different metrics. DAMCHA is not designed solely to uniformly reduce local reconstruction errors or token-level losses across all samples. Instead, through input-dependent cross-head coordination, it aims to more effectively generate samples with more complete structures, greater semantic consistency, and higher overall quality.

For this reason, in addition to reporting sample-averaged metrics, we specifically evaluate the Top-50 high-quality samples ranked by generation likelihood. All methods use the same sample-selection and evaluation protocols. Therefore, the Top-50 results can directly reflect the quality differences among different attention mechanisms in high-confidence generation regions. The experimental results show that DAMCHA’s advantages in FID, BARTScore, and their corresponding Top-50 metrics are generally more pronounced than its advantages in average metrics such as MSE and NLL. This is precisely the central effect that the paper aims to verify: DAMCHA’s input-dependent cross-head metric not only improves the overall generation distribution, but is particularly beneficial for producing high-quality and high-confidence outputs.

At the same time, DAMCHA does not obtain its advantage on high-quality samples by sacrificing average performance. DAMCHA still achieves consistent improvements in average metrics such as MSE and NLL, and the synthetic-data experiments also support this conclusion.

Response 4: In Which Scenarios Does DAMCHA Provide the Greatest Benefits?

DAMCHA is most suitable for the following scenarios:

  1. When there is a strong demand for high-quality samples, since DAMCHA can increase the probability of generating high-quality outputs;
  2. When the target relationship simultaneously depends on multiple feature subspaces;
  3. When different attention heads need to collaborate, compensate for one another, or dynamically modulate one another;
  4. When the input contains heterogeneous semantic information, visual structures, or contextual patterns;
  5. When the evaluation focuses on the consistency of complete samples rather than only local token- or pixel-level errors.

When the relevant dependencies can be sufficiently represented within a single head, cross-subspace coupling is weak, or the task structure is relatively simple, standard MHA may already be sufficient, and the improvement provided by DAMCHA may be limited. We will add this discussion of the applicable scenarios and scope to the main text.

Response 5: Whether the Assumptions of Theorem C.2 Are Necessary and Whether the Result Holds Under Weaker Conditions

The basic non-inferiority of DAMCHA relative to MHA follows from the function-class inclusion relationship: S⋆MHA⊊S⋆DAMCHA\mathcal{S}^{\star}{\mathrm{MHA}}\subsetneq\mathcal{S}^{\star}{\mathrm{DAMCHA}}. Therefore, at the level of the ideal function-class risk, we have RDAMCHA⋆≤RMHA⋆R_{\mathrm{DAMCHA}}^{\star}\leq R_{\mathrm{MHA}}^{\star}. This conclusion does not depend on all the strong assumptions in Theorem C.2.

The assumptions of a unique optimum, quadratic growth, context identifiability, and exact generator realizability are mainly introduced to derive the following explicit strict lower bound: RMHA⋆−RDAMCHA⋆≥μ2inf⁡Mi∈L∗dh∑⋆c=1Kπc∑i=1h∣Mi−Mi,c⋆∣F2R_{\mathrm{MHA}}^{\star}-R_{\mathrm{DAMCHA}}^{\star}\geq\frac{\mu}{2}\inf_{M_i\in\mathcal{L}*{d_h}}\sum^{\star}{c=1}^{K}\pi_c\sum_{i=1}^{h}|M_i-M_{i,c}^{\star}|_F^2.

These conditions can be weakened:

  1. The unique optimum can be replaced by a set of optimal solutions;
  2. The quadratic-growth condition is only required to obtain an explicit lower bound expressed in terms of the Frobenius distance;
  3. Exact context identification and exact generator realizability can be replaced by approximate conditions.

If the generator has a risk approximation error of ϵ\epsilon for the context-optimal mappings, then RDAMCHA⋆≤∑c=1Kπcrc(Mc⋆)+ϵR_{\mathrm{DAMCHA}}^{\star}\leq\sum_{c=1}^{K}\pi_c r_c(M_c^{\star})+\epsilon.

As long as the irreducible mismatch of the best static low-rank metric is greater than ϵ\epsilon, DAMCHA can still achieve a strict advantage. We will revise the discussion surrounding Theorem C.2 to clearly distinguish the general non-inferiority result from the stronger assumptions required to derive the explicit strict lower bound.

We sincerely appreciate your great efforts, valuable comments and kind help for our paper.

Comments on the paper

1 comment
Meta-review

Summary:

The paper reinterprets multi-head attention as learning a static, block-diagonal similarity metric over the joint head space, and proposes DAMCHA, which relaxes both restrictions: it learns the full cross-head metric matrix and makes it input-dependent. The metric is produced by a functional mapping (a network shared across layers) instead of the standard linear query–key projections, thereby addressing the low-rank bottleneck associated with those projections; each head's effective metric is obtained by row-summing its blocks. The main claims are improved modeling of complex dependencies via the full cross-head structure, adaptability to distribution shift, and bypassing the low-rank bottleneck. The methodology is supported by theoretical results, several experiments across different tasks and ablation studies.

Strengths:

  • The input-dependent metric is a sensible, well-motivated idea, and interpreting standard MHA as a block-diagonal metric gives the method a geometric framing.
  • Learning similarity matrices via a functional mapping rather than query–key projections is a novel approach around the low-rank bottleneck.
  • Stack-wise parameter sharing is a practical design choice that keeps cost manageable and reduces overfitting risk while retaining the richer similarity structure.
  • Extensive experiments over several settings, with ablation studies, showing improvements on a number of scores.
  • The theoretical support appears sound.

Weaknesses:

  • Empirical evidence has gaps: no direct efficiency comparison against plain MHA, no robustness experiments, and gains that are not consistent across metrics; with error bars missing and small margins over DCMHA, the improvements could be attributable to random seeds.
  • It is unclear when and why the approach is better. The authors should comment explicitly on where DAMCHA provides the largest practical benefit and in which regimes gains are small.
  • The related work is relatively limited, and the differences from prior cross-head methods — in both mechanism and performance, DCMHA especially — are not entirely clear; explicit comparison is needed to contextualize the technical novelty.
  • The connection to Mahalanobis metric learning is unclear beyond structural resemblance.
  • The claim of adaptability to distribution shift is not supported by the experiments or the theoretical results.
  • Some empirical results raise questions.

Overall:

The paper is generally well-written and proposes an interesting formulation of multi-head attention, with a natural extension to an input-dependent structure of greater capacity, supported by extensive experiments and ablation studies. While the method is promising, the paper would benefit from more thorough positioning within the literature and stronger empirical validation — above all error bars, since the reported gains could be due to random seeds. The Mahalanobis motivation and the claimed adaptability to distribution shift should also be better supported .

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.