acceptodds
Under review as a conference paper at ICLR 2027

SPECTRAL SHAPE RESIDUAL: A LIGHTWEIGHT SPECTRAL DIAGNOSTIC FOR ATTENTION WEIGHT MATRICES

Abstract

We introduce the , a lightweight metric computed directly from the query and key weight matrices of attention layers - no forward pass, no training data needed. SSR measures how similar the singular value distributions of and are: when they match perfectly, SSR is zero. We study SSR across four settings organized as a analytical framework (toy vs. production LLM; static snapshot vs. training dynamics) - a design that systematically covers the conditions under which spectral weight-space signals can arise. In toy transformers trained on modular arithmetic, SSR falls sharply during training, dropping below 50% of its peak value 200-1,900 steps the model generalizes - making SSR an early warning signal - and converges to near-machine precision once grokking is complete. In production LLMs (LLaMA-3-8B, Gemma-4-31B-IT), SSR decreases systematically with layer depth, and RL-distilled models (DeepSeek-R1-Distill-Qwen-14B) show lower SSR than their base model (Qwen2.5-14B-Instruct) in 45 out of 48 layers. In OLMoE-1B-7B pretraining, 18.8% of attention heads show persistent monotonic decline in SSR before grokking completes, concentrated in deep layers (L10–L13); the median SSR of these heads falls 40% below its peak 582B tokens before grokking completes. SSR requires only one SVD per attention head and no evaluation data, making it deployable as a zero-overhead structural health monitor directly inside training pipelines. For both pre-training (does the model grok?) and post-training (does RL alignment shift spectral structure?), SSR provides a continuous signal without running a single forward pass.

Primary area:
interpretability and explainable AI
Keywords:
mechanistic interpretability, attention mechanism, transformer circuits, representation learning

Reviews

Among:
Shape:
1234this paper, Bottom 2%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.33 over 3 reviews, above 2% of the others.
Reviewer_uPWuOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
1
Read review
Paper summary

The authors define spectral shape residual (SSR) as a distance between the normalized singular-value distributions of the query and key projection matrices. In small transformers trained on modular arithmetic, SSR declines near grokking. The paper also identifies declining trends in a chosen set of heads from one OLMoE run and examines differences across layers and model pairs in published language-model checkpoints.

Critical strengths
  1. SSR is straightforward to calculate and reproduce without a set of evaluation examples (Section 3). The OLMoE analysis includes every one of the six head-trend groups, notably the 74 heads whose values keep diverging (Table 2), rather than restricting the report to favorable cases.
  2. The small-scale training studies and the Pythia null comparison offer a basis for investigating when changes in spectra coincide with shifts in training. They are useful observations even though they fall short of validating prediction.
Critical weaknesses
  1. Functionally identical attention can have different SSR values. Under the appropriate matrix convention, an invertible change of basis A permits WQ to become A WQ and WK to become A^{-T} WK without changing QK^T; the individual singular spectra, and hence SSR, can nevertheless change. The authors should examine this symmetry and assess whether SSR carries information beyond the geometry of a chosen parameterization. The present statistic alone cannot establish the interpretations of “Q/K coordination” or “structural health.”
  2. The warning-signal argument rests on little data and on choices made after observing trends. Q2 includes only three seeds. In Q3, 36 of 192 heads are chosen by their behavior before grokking, and the median of those heads is assessed using a 40% cutoff after a 50% cutoff was not attained (pp. 7–8). In addition, 74 heads continue to diverge, and five Pythia runs do not show a general decline. The authors should define both the cutoff and head-selection procedure in advance, then evaluate them on independent runs with and without grokking.
Questions for authors
  1. How does SSR change under a basis transformation that preserves attention outputs? After controlling for a functionally equivalent parameterization, do the reported relationships with generalization remain?
  2. With the rule fixed before evaluation, can SSR anticipate grokking across new models or seeds, and what false-positive rate does it produce on runs without grokking? This result would affect my view of its monitoring value.
1 comment

Response to the Parameterization Symmetry Concern

We agree with the reviewer that SSR is not invariant under all reparameterizations that preserve the attention function. In particular, under the transformation

WQ′=AWQ,WK′=A−TWK,W_Q' = AW_Q, \qquad W_K' = A^{-\mathsf T}W_K,

the product WQ⊤WKW_Q^\top W_K remains unchanged, whereas the individual singular-value spectra of WQ′W_Q' and WK′W_K' generally differ from those of the original matrices. Consequently, SSR can change even when the represented attention function remains unchanged.

This is an important property of SSR, but it does not invalidate the quantity we define or compute. SSR is intended as a parameterization-dependent, paired weight-space spectral descriptor, not as an invariant of the attention function. Its purpose is to quantify the discrepancy between the normalized singular-value spectra of the query and key projection weights in a given model parameterization.

We do not claim that SSR uniquely characterizes the underlying attention function, nor that a low or high SSR value alone establishes functional coordination or structural health. We will clarify this interpretation and its limitations in the revised manuscript. The parameterization dependence limits the scope of what SSR can represent, but does not prevent it from serving as a descriptive statistic for analyzing the spectral structure of a given checkpoint and its evolution under the training parameterization being studied.

Response to the Pythia Comparison

The reviewer raises a valid concern about the interpretation of our Pythia results. We analyzed five Pythia model scales (160M, 410M, 1B, 1.4B, and 2.8B), using their publicly available training checkpoints. These are five model sizes, rather than five independent training runs or random-seed replications.

Our analysis found monotonically increasing SSR trajectories and no Q/K-aligning heads in these five models under our measurement and classification procedure. However, we agree that this observation alone does not establish that the models did not undergo grokking. In particular, our Pythia analysis was not designed to independently identify grokking transitions through task-specific generalization measurements.

We therefore agree that our original statements were too strong. Specifically, the claims that this null result establishes SSR convergence as a grokking-specific signal and confirms that SSR-leading behavior requires a grokking-type phase transition go beyond what the Pythia experiment can support.

We will revise this discussion to present Pythia as a descriptive comparison: in the five examined model scales, SSR increased throughout the available checkpoints, in contrast to the aligning-head behavior observed in our OLMoE analysis. This contrast is an interesting observation, but it should not be interpreted as evidence that SSR convergence is exclusive to grokking or that the absence of SSR-leading behavior rules out grokking.

The intended conclusion is narrower: SSR exhibits different temporal patterns across the examined training trajectories, motivating further investigation into how these patterns relate to independently established generalization transitions.

Reviewer_13MCOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
2
Soundness
1
Read review
Paper summary

The paper introduces spectral shape residual (SSR), defined as the normalized mean absolute difference of two matrices singular values. The paper advocates for the introduction of SSR metrics into training pipelines as a "zero overhead structural health monitor". The finds that in multiple model training settings the SSR of some query/key projections in self attention layers begins to decrease before the model exhibits grokking behavior. The paper also claims that in several open weight model checkpoints SSR metrics decrease systematically with layer depth and that checkpoints trained using RL exhibit lower SSR metrics than the pre-RL base model checkpoints.

Critical strengths

The SSR metric is simple and easy to understand.

Critical weaknesses

Unsupported Claims:

The paper advocates for the deployment of SSR metric collection into training pipelines. Quoting the last paragraph of the paper, in the conclusion section: "SSR requires only one SVD per attention head and no evaluation data, making it deployable as a zero overhead structural health monitor directly inside training pipelines—no forward pass, no evaluation set required. In practice, SSR supports three use cases: (1) training health monitoring—if SSR stops decreasing while training loss is still high, the model may be stuck before grokking; (2) model quality screening—abnormally high SSR in deep layers relative to shallow layers indicates potential attention degradation, detectable from weights alone; and (3) fine-tuning comparison—SSR profiles can distinguish fine-tuning strategies without running downstream benchmarks, as demonstrated by the R1 vs. Qwen comparison in Q4. Whether the question is “is pre-training grokking?” or “is RL alignment shifting the spectral structure of attention?”, SSR provides a continuous answer from the weights alone."

Claim (1) relies on the experiments showing that some SSR metrics decrease before grokking occurs during the course of training. However, these experiments do not show that a failure of SSR to decrease corresponds with a model being unable to perform grokking. Furthermore the relevant experiment in Q3 has a major methodological problem: the set of heads used to demonstrate the early warning signal behavior is selected using information not available during claimed warning time. The heads are selected using information from before and after the advent of grokking, so it would be impossible to select them in a procedure intended to predict grokking in advance.

For claim (2) the paper studies how SSR corresponds with layer depth, but never establishes a link between SSR metrics in deep layer and model quality. Furthermore it is never defined how "abnormally high" SSR observations should be defined.

For claim (3) the paper finds that two released model checkpoints have different SSR properties, but this does not establish SSR profiles as a signature of different fine tuning strategies, and the paper does not have any controlled results comparing different fine tuning strategies.

Finally, the claim that SSR is "zero overhead" is clearly false, since it requires the computation of singular values for every Q/K projection in the model.

Apparent Errors in the Text

On lines 207-208 the paper claims the llama model linear fit has slope −0.03 ×10−3/layer, but the caption of figure 4 says that the llama model's linear fit has slope slope = −2.1 × 10−4/layer, an apparent contradiction.

In figure 4b and table 5, the paper describes the sliding window layers of Gemma-4-31B-IT as having 16 query heads and 8 KV heads, but the officially released config (https://huggingface.co/google/gemma-4-31B-it/raw/main/config.json) shows 32 query heads and 16 KV heads. This mismatch could impact the calculation of SSR metrics if it is replicated in the code.

The paper identifies Qwen2.5-14B-Instruct as the base model of DeepSeek-R1-Distill-Qwen-14B, but the base model used to train DeepSeek-R1-Distill-Qwen-14B is actually the non instruction tuned Qwen2.5-14B checkpoint. The official huggingface model card https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B links the base qwen checkpoint, not the instruction tuned checkpoint.

Apparent Errors in Supplementary Code

The Gemma model attention head mismatch described above seems to be present in the code: in p4-lab3-gemma_scan.py the string given to get_dh_from_norm() already ends in ".self_attn", but another "self_attn" component still gets appended which causes the weight lookup to fail and the fallback defaults to a head dim of 512 for the sliding-window layers. Because of this the code computes singular values for larger merged matrices that correspond to combinations of head projections, rather than the correct computation of each head's spectra separately.

When attempting to replicate the layer level statistics using p4-lab3-llama_head_metrics.csv from the supplemental materials I found that the paper’s two-stage GQA median procedure gives Pearson r of approximately -0.305, not the reported r=-0.921. This impacts the reliability of a central empirical result in the paper. Code I used to calculate pearson r:

import pandas as pd
from scipy.stats import linregress

df = pd.read_csv("p4-lab3-llama_head_metrics.csv")

ssr_by_layer = (
    df.groupby(["layer", "kv_head"])["ssr"].median()
      .groupby("layer").median()
)

fit = linregress(ssr_by_layer.index, ssr_by_layer.values)
print(fit.rvalue)  # -0.304933815295242
print(fit.slope)   # -3.20846673387097e-05
Questions for authors

Please double check the pipeline used to generate the p4-lab3-llama_head_metrics.csv dataset and/or publish the code used to generate the r=-0.921 statistic.

3 comments

Response to Unsupported Claims

We sincerely thank the reviewer for this careful and constructive assessment. We particularly appreciate that the reviewer examined not only the conceptual claims but also the experimental methodology and implementation details. The concerns raised here are valid: several statements in our original manuscript went beyond what our current experiments establish. We agree that the scope of the claims must be narrowed, and we will revise the manuscript accordingly.

(1) Training health monitoring and grokking.

We agree that our experiments do not establish SSR as a predictor of whether or when grokking will occur. In particular, the reviewer correctly identifies an important limitation in Q3: the persistent-aligning heads are classified using their trajectories over the full observation period, including information after grokking. Consequently, this retrospective classification cannot be used as an online head-selection procedure at the claimed early-warning time.

We will revise the interpretation of Q3 to make this distinction explicit. The observed results support a more limited conclusion: in the studied settings, the temporal evolution of SSR in some attention heads exhibits an association with the training period preceding grokking. They do not establish a prospective early-warning system, nor do they show that a failure of SSR to decrease implies that grokking will not occur. We will remove statements suggesting these predictive capabilities.

(2) Model quality screening.

We agree that our experiments do not establish a relationship between deep-layer SSR and model quality. Our layer-wise checkpoint analysis characterizes spectral differences across network depth, but does not validate SSR as a model-quality indicator or establish a threshold for identifying abnormally high SSR.

We will therefore remove the model-quality-screening use case from the manuscript. We will retain the layer-wise analysis only as a descriptive characterization of the spectral structure of the examined checkpoints.

(3) Fine-tuning strategy comparison.

We agree that comparing two released checkpoints, one before and one after RL distillation, does not establish that SSR can generally distinguish fine-tuning strategies. The comparison is observational rather than a controlled experiment across multiple fine-tuning strategies.

We will narrow this claim to a descriptive observation: the examined checkpoints exhibit different layer-wise SSR profiles. We will no longer present this result as evidence that SSR can distinguish fine-tuning strategies or replace downstream evaluations.

(4) Computational overhead.

We also agree that describing SSR as a "zero-overhead" monitor is inaccurate. Although SSR requires neither input data nor a forward pass, computing the singular values of the query and key projection matrices incurs computational cost.

We will replace "zero overhead" with more precise language: SSR is a data-free, no-forward-pass spectral diagnostic that operates directly on model weights. We will also clarify that it requires SVD computation and is therefore not computationally free.

Overall, we appreciate the reviewer for identifying the gap between our empirical observations and the broader applications suggested in the original conclusion. We will revise the claims throughout the abstract, introduction, experimental discussion, and conclusion to ensure that the manuscript presents SSR as a lightweight spectral descriptor with preliminary empirical associations, rather than as an already validated predictive or model-quality monitoring system.

Response to Apparent Errors in the Text

We thank the reviewer for carefully checking the numerical consistency and model configurations reported in the manuscript. We confirm that the issues identified are genuine, and have corrected them as follows.

(1) Inconsistent LLaMA-3-8B regression slope (Lines 207–208 and Figure 4).

We thank the reviewer for identifying the inconsistency between the main text and the caption of Figure 4. The correct slope is −0.03×10−3-0.03 \times 10^{-3}/layer. The discrepancy in the original figure caption was a labeling error. We have corrected the Figure 4 caption and revised the corresponding wording in the manuscript to ensure consistency.

(2) Incorrect Gemma-4-31B-IT attention head configuration (Figure 4b and Table 5).

We thank the reviewer for identifying the incorrect head configuration. The sliding-window attention configuration was incorrectly reported as 16 query heads and 8 KV heads. We have corrected the head dimensions in the scanning pipeline, regenerated the per-head SSR measurements, and recomputed the corresponding layer-wise statistics. Specifically, we rewrote p4-lab3-gemma_scan_13mc.py and generated a new p4-lab3-gemma_head_metrics.csv. We then regenerated Figure 4 and updated the corresponding descriptions in the manuscript.

(3) Incorrect base model identification for DeepSeek-R1-Distill-Qwen-14B.

We thank the reviewer for catching this model-identification error. The correct base model is Qwen2.5-14B (the base checkpoint), rather than Qwen2.5-14B-Instruct. We corrected the model selection and reran the analysis using the Qwen2.5-14B base checkpoint. Specifically, we reran check-5-laws-all-model.py with --model-dir C:\Qwen2.5-14B, generating a new check-5-laws-all-model_Qwen2.5-14B.csv. We then regenerated Figure 4 using ssr_iclr27_fig4_q4_llm_static.py and updated the corresponding model descriptions and discussion in the manuscript.

Response to Apparent Errors in Supplementary Code

We appreciate the reviewer for examining the supplementary implementation in detail and identifying the issue in the Gemma scanning pipeline.

(1) Gemma attention-weight lookup and SVD dimensions.

We confirm that the reviewer correctly identified a bug in the original p4-lab3-gemma_scan.py. The attention module path passed to get_dh_from_norm() already contained .self_attn, while the function appended another .self_attn component. This caused the intended weight lookup to fail and triggered the fallback head dimension. Consequently, the original implementation did not correctly perform the intended per-head spectral analysis for the affected sliding-window layers.

We have corrected the module-path handling and rewritten the scanning script as p4-lab3-gemma_scan_13mc.py. Using the corrected implementation, we regenerated p4-lab3-gemma_head_metrics.csv, recomputed the per-head SSR measurements, and regenerated Figure 4. The corresponding model configuration and methodological descriptions have also been corrected in the manuscript.

(2) Reproducibility of the LLaMA-3-8B Pearson correlation.

We thank the reviewer for providing a concrete reproduction procedure and identifying the discrepancy. We checked the public p4-lab3-llama_head_metrics.csv against the two-stage GQA pseudo-bulk median aggregation described in the paper. Following this procedure gives a Pearson correlation of approximately −0.305-0.305, rather than the originally reported −0.921-0.921.

We acknowledge that the originally reported correlation could not be reproduced from the released CSV using the stated aggregation procedure. We have corrected the reported statistic and the corresponding interpretation in the manuscript to reflect the reproducible result. We appreciate the reviewer for providing the code that made this discrepancy straightforward to identify.

Thanks for your response. I appreciate your effort to address my concerns, but retracting/revising the claims of the original paper make me wonder what the contributions are at this point. It seems that SSR may have some correlation with grokking behavior, but it is not predictive, and in general it declines over the course of training. Couldn't it be that SSR simply declines with loss, or due to repeated optimization steps, and that these two things also correspond to grokking behavior? The link between SSR and grokking is still unclear to me, and the finding that SSR decline is associated with grokking because both develop over the course of training does not seem useful or important. The descriptive claim that two different checkpoints have different SSR profiles does not seem notable, unless a convincing reason is given why we should expect otherwise and that this result is a surprise.

Could you re state revised core claims/central results, and why they are useful/important/surprising? Currently I am inclined to keep my score.

Reviewer_A1JZOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
1
Soundness
1
Read review
Paper summary

In this paper, authors have proposed Spectral Shape Residual (SSR) metric to understand the learning dynamics, just by Eigen-decompostion (SVD) of Query and Key weight matrix. Authors have used this metric across different settings through pre-training and post-training (RL) stage, and showed the utility of SSR metric by analyzing their respective learning dynamics.

Critical strengths

The experiments are conducted across a diverse range of model families, including LLaMA-3-8B , Gemma-4-31B, DeepSeek-R1, Qwen-14B and OLMoE-1B-7B. Also, the SSR metric bases analysis is compute-efficient, as it does not require any forward pass.

Critical weaknesses

The paper's motivation is not at all clear, why we need SSR metric when we already have well-known diagnostic methods for analyzing the training dynamics. Similar approach for analyzing the QK weight matrices, through Eigen-decomposition and SVD, are used in prior work (e.g.[1], [2] ), which are neither discussed nor compared with in the paper.

Moreover, the writing needs substantial improvement.

[1] Bao et al., Self-attention Networks Localize When QK-eigenspectrum Concentrates, ICML 2024

[2] Hu et al., Eigenspectrum Analysis of Neural Networks without Aspect Ratio Bias. ICML 2025

Questions for authors

Can SSR metric predict the training instability before it actually starts ? Figure 5 in paper [3] showed the occurrence of NaNs at different stages of training, which is tuned by varying the negative slope of LeakyReLU in the norm-free GPT-2 (125M) models. If SSR metric can predict the training instability in advance, it would its usability.

[3] Jha et al., ReLU’s Revival: On the Entropic Overload in Normalization-Free Large Language Models, ATTRIB Workshop at NeurIPS 2024.

2 comments

Response to the Related Work and the Distinction of SSR

We thank the reviewer for pointing us to these relevant works. However, we respectfully believe that the comparison needs to distinguish more carefully between the underlying matrix objects and the spectral statistics being studied. The cited works investigate different mathematical quantities, and therefore do not directly address the specific question that SSR is designed to characterize.

1. Bao et al. (ICML 2024): the spectrum of a composite QK matrix is not the paired spectra of the individual projections.

Bao et al. study the eigenspectrum of the composite matrix WQ⊤WKW_Q^\top W_K, and investigate how its spectral properties relate to attention localization and evolve during training. SSR, in contrast, does not perform spectral analysis on WQ⊤WKW_Q^\top W_K. It independently computes the singular-value spectra of the two projection matrices, WQW_Q and WKW_K, normalizes the resulting spectra, and measures their shape discrepancy:

We propose the Spectral Shape Residual (SSR): the mean absolute difference between the ℓ2- normalized singular value spectra of WQ and WK in each attention head (formal definition in pdf Section 3, Eq. 1). SSR costs one SVD per head—negligible compared to any forward pass.

These are fundamentally different mathematical objects and statistics:

  • Matrix object: Bao et al. analyze a matrix product, WQ⊤WKW_Q^\top W_K; SSR analyzes WQW_Q and WKW_K separately.
  • Spectral quantity: Bao et al. analyze eigenvalues of the composite matrix; SSR compares the normalized singular values of the two individual projection matrices.
  • Diagnostic target: The former characterizes the spectral properties of the combined QK transformation; the latter quantifies the discrepancy between the spectral shapes of the query and key projections themselves.

The spectrum of a matrix product does not, in general, determine the two individual singular-value spectra or their discrepancy. Consequently, analyzing WQ⊤WKW_Q^\top W_K is not mathematically equivalent to computing SSR. Although both works involve Q/K-related spectral quantities and their training dynamics, they address distinct questions. We acknowledge Bao et al.'s contribution to the former, while SSR focuses specifically on the latter.

2. Hu et al. (ICML 2025): general weight-spectrum characterization is not a paired QK spectral discrepancy.

Hu et al. investigate empirical spectral densities (ESDs) and heavy-tailedness in general neural-network weight matrices, with particular attention to aspect-ratio bias and more reliable spectral estimation. Their work concerns how to characterize the spectrum of an individual weight matrix.

SSR addresses a different question: given a paired query-key projection, how different are the shapes of their normalized singular-value spectra? It is not an ESD estimator, a heavy-tailedness measure, or an aspect-ratio correction method. Even if the same SVD machinery is used, the resulting statistics and their intended interpretations are different.

Thus, Hu et al. provide relevant background on weight-space spectral analysis, but their method does not quantify the paired spectral-shape discrepancy defined by SSR.

In summary, the cited works establish the broader relevance of spectral analysis in neural networks, but neither of these two methods computes the statistic introduced in this paper. The distinction is not merely one of terminology or implementation: it concerns the matrix being analyzed and the mathematical quantity being measured. We will make these distinctions explicit in the related-work discussion to avoid conflating composite-matrix eigenspectrum analysis, general weight-matrix spectral characterization, and paired QK spectral-shape comparison.

Response to Jha et al. and the Suggested NaN Experiments

We appreciate the reviewer for pointing us to Jha et al. (NeurIPS 2024 ATTRIB Workshop), which studies entropy-related behavior and training instability in normalization-free language models, including the occurrence of NaNs under different activation settings.

We agree that investigating whether weight-space spectral statistics such as SSR are associated with training instability would be an interesting direction. In particular, studying whether SSR changes systematically before numerical instability occurs could extend the current work beyond its focus on grokking-related training dynamics.

However, this is a distinct research question from the one addressed in the present paper. Jha et al. study activation and attention-entropy behavior in normalization-free models, whereas our current work investigates the spectral-shape discrepancy between query and key projection weights. Establishing a relationship between SSR and NaN occurrence would require a separate, controlled experimental study, including systematic variation of architectural and activation parameters and repeated measurements of instability onset.

We therefore view the suggested norm-free GPT-2 and LeakyReLU experiments as a valuable extension, rather than a necessary validation of the claims made in this paper. Importantly, we do not claim that SSR predicts NaN occurrence or training instability. We will clarify the scope of our claims accordingly and include this potential direction in the discussion of future work.

Clarification of the Motivation and Scope

Our motivation is not to replace existing training-dynamics, activation-based, or weight-spectrum diagnostics. Rather, we introduce a lightweight, data-free descriptor that captures a specific aspect of attention-weight structure: the spectral-shape discrepancy between paired query and key projections.

Unlike diagnostics that require input samples, activation statistics, or forward-pass measurements, SSR can be computed directly from the projection weights. This makes it complementary to existing methods, rather than a substitute for them. Our experiments explore its behavior during grokking and across model layers and checkpoints; they do not establish SSR as a universal training-health or model-quality predictor.

We will revise the motivation and related-work discussion to state this scope more precisely.

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

Related papers

Loading the map…

Discussion (0)

Sign in to comment.