Skip to content

Gluing local contexts into global meaning: a sheaf-theoretic decomposition of Transformer representationsGluing Local Contexts into Global Meaning: A Sheaf-Theoretic Decomposition of Transformer Representations

Hugging Face Daily Papers· arXiv:2610.17117· Bryce Grant, Peng WangCase Western Reserve UniversityIndexed by this site · 27 days ago· Originally publishedAlignment

Quick read

Interpretability

Based on the paper PDF (AI-generated); refer to the original

The authors use a cellular sheaf to decompose the consistency of paraphrase pairs into a content subspace and a context subspace, and report that 20-dimensional H⁰ exceeds the LEACE retained subspace by an average of +17.1 pp on CounterFact retrieval across 8 models.

Questions
Existing interpretability methods do not test whether a representation stays consistent under paraphrase, which makes steering unstable in effectiveness across different models and prompts, and there is no tool to predict in advance which case a model falls into.
Methods
Build a cellular sheaf on a paraphrase graph: nodes hold hidden states, edges connect paraphrase pairs, restriction maps P are learned, the kernel H⁰ of the sheaf Laplacian extracts the content subspace stable across paraphrases, and the spectral complement H¹ captures directions that vary with wording; stacking multiple layers yields a grid with cycles, and harmonic mass diagnoses steering fragility.
Experiments and results
The authors report: the 20-dimensional H⁰ averages +17.1 pp higher than the full-dimensional LEACE-preserved subspace on CounterFact hard retrieval across 8 models; ablating H¹ coordinates affects the output 5.6–26.5× as much as a matched-variation control (9 models); harmonic mass ranks steering fragility across 6 architectures with ρ=0.90.
Limitations and future work
The authors point out: the restriction map depends on architecture and partly on domain; the fragility diagnosis is only a rank correlation over 6 architectures; the node-space H¹ did not transfer to downstream; cycles and holonomy are not significantly different from a shuffled null hypothesis; cross-lingual work was only a probing experiment.
Experimental setupGPT-2 (124M)、Phi-2 et al. · MRPC、PAWS et al. · top-1 retrieval accuracy、fact preservation (%) et al.
Evaluated models
GPT-2 (124M)Phi-2Mistral-7BQwen-2.5-7BOLMo-2-7BGemma-2-9BLlama-2-7BLlama-3-8BLlama-2-13B
Benchmarks
MRPCPAWSQQPCounterFact (ROME)OPUS-100STS-B
Metrics
top-1 retrieval accuracyfact preservation (%)H⁰/H¹ ablation output-change ratioHodge harmonic massSpearman's ρKL divergence ratio
AI summaryResearchers propose decomposing Transformer representations with a cellular sheaf over a paraphrase graph, extracting content subspaces and influence directions on a frozen model without training. The kernel H^0 of the sheaf Laplacian is the content subspace; at 20 dimensions, it outperforms the retained subspace of the concept erasure method LEACE on held-out CounterFact factual retrieval by an average of 17.1 percentage points across eight architectures, and jointly constraining all paraphrases of the same fact adds a further 6.5 percentage points. Ablating the coordinates most variable across paraphrases causes output changes 5.6 to 26.5 times larger than coordinates matched for per-coordinate variability, across nine models ranging from 124M to 13B parameters. Stacking the layers into a grid forms b_1 = N(L-1) algebraic 1-cycles, and the resulting harmonic mass differs by nearly three orders of magnitude across six architectures, with its ordering consistent with steering fragility (Spearman ρ=0.90, one-sided permutation test p=0.014).

Researchers propose decomposing Transformer representations with a cellular sheaf over a paraphrase graph, extracting content subspaces and influence directions on a frozen model without training. The kernel H^0 of the sheaf Laplacian is the content subspace; at 20 dimensions, it outperforms the retained subspace of the concept erasure method LEACE on held-out CounterFact factual retrieval by an average of 17.1 percentage points across eight architectures, and jointly constraining all paraphrases of the same fact adds a further 6.5 percentage points. Ablating the coordinates most variable across paraphrases causes output changes 5.6 to 26.5 times larger than coordinates matched for per-coordinate variability, across nine models ranging from 124M to 13B parameters. Stacking the layers into a grid forms b_1 = N(L-1) algebraic 1-cycles, and the resulting harmonic mass differs by nearly three orders of magnitude across six architectures, with its ordering consistent with steering fragility (Spearman ρ=0.90, one-sided permutation test p=0.014).

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors aim to address the problem that interpretability methods do not test whether a representation is consistent under paraphrase, using the sheaf Laplacian to decompose the representation into a content part and a sub-context part.

    Core problem: existing interpretability methods do not test whether a representation stays consistent under paraphrase; the authors formalize this problem as local-to-global consistency and use a cellular sheaf to decompose, on a frozen model without training, a content subspace stable across contexts and a subspace that varies with wording.

    • Problem setting: a Transformer entangles the meaning and the wording of a sentence—synonymous sentences have different representations. The authors say this becomes a problem for steering: some methods work on some models and fail or even degrade performance on others, and within the same model steerability also varies with the prompt, while there is currently no tool to predict in advance which case a model falls into.
    • Shortcomings of existing methods: the authors say existing techniques either decompose representations into features, or test whether a presupposed property is linearly decodable, or compare two representation spaces, but none of them addresses consistency across different contexts.
    • Core observation: each paraphrase pair is a local witness indicating that two activations should be consistent; combining all local witnesses should form a global consensus. This corresponds exactly to the gluing condition of a sheaf.
    • Method proposed in the paper: build a cellular sheaf on the paraphrase graph, use the kernel H⁰ of the sheaf Laplacian to give the content subspace and the spectral complement (H¹ directions) to give the directions that vary with context; stack multi-layer activations into a grid to produce algebraic 1-cycles, and use the model-derived harmonic mass as a diagnostic quantity for steering fragility. Everything is read off a frozen model and requires no training.
  2. What related research exists?

    Related work falls into four categories: sheaf methods in machine learning, subspace interpretability, invariance/self-supervised objectives, and steering and linear representations; the authors state that this paper differs in both the stalk setting and the objective.

    Sheaf methods in machine learning

    • Hansen and Ghrist (2019) developed the spectral theory of the sheaf Laplacian; Hansen and Gebhart (2020) proposed sheaf neural networks, which were subsequently used for heterophilic graphs, predictive coding, and learning restriction maps.
    • The authors name the closest parallel work: Krasnovsky (2025) proposed using a sheaf inconsistency score to measure circuit coherence, and Javidnia (2026) used the Fisher metric and holonomy to construct context atlases. The authors state that the difference lies in the stalk (paraphrase graph nodes carry hidden states, with restriction maps using PCA/CCA/contrastive) and the objective (post-hoc H⁰/H¹ decomposition for retrieval and steering).

    Subspace interpretability

    • Sparse autoencoders, probes, causal abstraction, CKA/SVCCA, DAS, and LEACE target individual features or whole-space comparisons. The authors state that what they want is to split each representation space into two parts, one identical across contexts and one varying, and that LEACE is suited to erasing paraphrase/non-paraphrase concepts, whereas this paper seeks the complementary subspace that varies least within pairs.

    Invariance and self-supervised objectives

    • Contrastive (SimCLR, InfoNCE) and non-contrastive (BYOL, Barlow Twins, DCCA) invariance objectives achieve paired-view consistency during training; the authors state that this paper reads out invariance on a frozen model via ker(LF). The log det Cov regularizer in §7 shares geometry with the decorrelation terms of VICReg and Barlow Twins.

    Steering and linear representations

    • Activation addition, representation engineering, and their variants (including PIXEL) add directions; Da Silva et al. (2025) showed across 36 models that steering reliability depends on the model, and Tan et al. (2024) showed that it is unreliable across inputs, and §5.4 connects this to harmonic mass. The linear representation hypothesis has been questioned by Engels et al. (2025) and Makelov et al. (2024), and the authors state that their per-coordinate variance-matched control only partially addresses this concern.

    Baselines and benchmarks: retrieval baselines are LEACE (full-dimensional and 20D), PCA-20, Random-20, and LDA, NCA, CCA, PLS, W-PCA in the appendix; steering baselines are random, full style (CAA), mean-of-differences, variance top-k, Fisher LDA, PIXEL. Benchmarks are MRPC, PAWS, QQP, CounterFact (ROME), STS-B, OPUS-100.

    The authors state that this paper extends their non-archival workshop version, and that the multi-layer grid, relational hypergraph, harmonic mass diagnostic, and held-out LEACE protocol are all new.

  3. How does the paper address this problem?

    Build a cellular sheaf on the paraphrase graph, represent it with the kernel and spectral complement decomposition of the sheaf Laplacian; multi-layer stacking produces cycles, and harmonic mass is used to diagnose fragility.

    Overall idea: treat each paraphrase pair as an edge, place hidden states on nodes, and learn a restriction map P that maps activations into a shared k-dimensional edge space; the low-energy eigenspace of the sheaf Laplacian LF gives the content subspace H⁰ that is stable across paraphrases, while the high-energy eigenspace (H¹ directions) captures directions that vary with wording, all computed on a frozen model.

    Construction on the single-layer matching graph

    • Sheaf setup: node stalks are R^d (hidden states), edge stalks are R^k (k≪d) as the shared comparison space, and the restriction map is P^⊤. The matching graph has 2N nodes and N edges.
    • Three choices of restriction map: joint PCA (the top k principal components of paired activations), CCA, contrastive Fisher (solving CW w = λCT w, taking the largest generalized eigenvector, with the direction opposite to LDA, so that P faces maximum within-pair variance). The authors call P the only tunable knob.
    • Laplacian and decomposition: the empirical sheaf Laplacian in edge space is LF = 1/N∑i Δi(k)(Δi(k))⊤, i.e. the second-moment matrix after projecting the within-pair differences; H⁰ takes the lowest m eigenvectors and the H¹ directions take the highest m, then are pulled back into hidden space by P. The eigenproblem is k×k (k=128), independent of hidden dimension, so the cost is the same for 124M and 13B models.
    • Proposition 3.1: on a matching graph with a single shared P and identity transport, LF degenerates to the projected within-pair covariance P^⊤CW P; on this basis the authors say the content lies in the kernel of the within-pair difference covariance, independent of P. The matching graph is acyclic, so the algebraic H¹=0, and "H¹ directions" is only a mnemonic name for high disagreement (Remark 3.3).

    Multi-layer matching grid and harmonic mass

    • Grid construction: nodes are (sentence, layer) pairs, horizontal edges connect paraphrase pairs within a layer, and vertical edges connect the same sentence in adjacent layers via Procrustes transport; N pairs and L layers give b1 = N(L−1) algebraic 1-cycles, and each square cycle asks "whether the inter-layer transformation commutes with paraphrase equivalence".
    • Model-derived cochain and harmonic mass: the edge cochain ω is formed from inter-layer differences via Procrustes transport; harmonic mass is the fraction of ω's energy in the kernel of the Hodge 1-Laplacian. If transport is identity then ω has no harmonic component, and the authors say it is precisely the fitted transport that makes the mass depend on the model. The expected harmonic fraction of a random Gaussian cochain is b1/|E| = 0.25 (L=2), as a random-probe reference.
    • Relation hypergraph: the second construction produces cycles from relational structure: the paraphrases of each fact form a cycle and each relation forms a cycle; with nf=60, np=5, nr=6, dim H¹=66.

    Steering and evaluation method

    • Steering vectors: given a style direction Δ, construct (a) Δ with the H⁰ component removed, or (b) projected onto the top m H¹ directions and weighted by eigenvalue; all steering vectors are normalized to α = 0.3‖h̄‖.
    • Key parameters: edge dimension k=128 (capturing ≥98% of paired variance), 20 eigenvectors each for H⁰/H¹, layer ℓ≈2L/3 for retrieval, ℓ=⌊5L/8⌋ for steering, and the restriction map learned from 200 MRPC paraphrase pairs.
  4. What experiments did the paper conduct?

    Across 9 models: 20-dimensional H⁰ retrieval exceeds LEACE by an average of +17.1 pp; H¹ ablation influence is 5.6–26.5× the control; harmonic mass ranking and steering fragility have ρ=0.90.

    Experimental setup

    • Models tested: 9 Transformers, 124M to 13B parameters: GPT-2 (124M), Phi-2, Mistral-7B, Qwen-2.5-7B, OLMo-2-7B, Gemma-2-9B, Llama-2-7B, Llama-3-8B, Llama-2-13B.
    • Datasets: MRPC (200 pairs to learn restriction maps; 666 sentences for functional validation), PAWS (334 sentences), QQP (cross-domain transfer, n=300), CounterFact/ROME (retrieval on 500 facts with a 70/30 split, ntest=150; steering n=1000/model; topology construction uses 60 facts×5 paraphrases), OPUS-100 (cross-lingual probe), STS-B (MLST).
    • Metrics and criteria: retrieval is top-1 accuracy (hard setting uses same-relation distractors); steering is fact retention rate (greedy decoding of 50 tokens, proportion of outputs containing the target entity) and style change rate; functional validation is the ratio of output L2 change from ablating H¹ coordinates to that from variance-matched control coordinates.
    • Statistics: bootstrap 95% CI (1000 resamples), McNemar paired test, Cohen's d/h; Spearman and holonomy use exact one-sided permutation tests.
    • Functional validation protocols: protocol a uses 1000 sentences, 64 coordinates, a single layer L/2, and measures logits; protocol b uses 100 sentences, 20 coordinates, three depths, and measures the final hidden state.

    Main results

    held-out CounterFact hard retrieval (top-1 %, same-relation distractors, k=20 dimensions, ntest=150; per Table 2):

    Swipe horizontally to read the table

    ModelFullH⁰ (20D)LEACE-fullLEACE-20DPCA-20Rand-20
    GPT-243.185.343.128.924.639.1
    Mistral-7B77.787.177.736.834.559.2
    OLMo-2-7B81.382.881.340.935.762.3
    Phi-269.187.169.138.837.255.1
    Qwen-2.5-7B49.464.149.436.837.543.7
    Gemma-2-9B54.477.954.432.327.543.5
    Llama-2-7B68.280.468.225.722.350.7
    Llama-3-8B72.788.072.728.224.455.9
    • The authors report that 20-dimensional H⁰ exceeds the full-dimensional LEACE retained subspace on all 8 models, with gaps from +1.5 pp (OLMo-2) to +42.2 pp (GPT-2), averaging +17.1 pp; the gap versus LEACE-20D is 27–60 pp (average +48.0 pp).
    • The authors state that the GPT-2 gap is largest because the residual stream of smaller models concentrates paraphrase content into a lower-dimensional shared subspace.
    • Appendix B.5 (Table 12): H⁰ exceeds all label-free baselines (+9 to +36 pp), but is below LDA and NCA, which use fact labels, on 5 of the 8 models.

    Functional validation of H¹ (causal influence)

    • Setup: coordinates are ranked by mean absolute within-pair difference, the top m are H¹ coordinates, and the control is per-coordinate variance-matched middle coordinates (the control's total variance is only 0.13–0.53 of the H¹ group's); after zeroing, the ratio of output L2 change is measured.
    • Results: the ratio across 9 models ranges from 5.62× (Llama-3-8B) to 26.5× (Llama-2-13B), and all 95% CIs exclude 1 (Table 3, Figure 2); the authors note that some ratios reflect the larger total variance removed by the H¹ group.
    • Feature-basis ablation (Appendix B.6, Table 13): directly projecting out the sheaf H¹ feature basis gives a next-token KL change of 17.8× (GPT-2) to 398× (Mistral-7B, median across layers) that of a same-dimensional random subspace; the authors note that the random control was not matched on activation energy.
    • Behavioral effect (Appendix B.7, Table 14): after ablating H¹, fact recall drops from 46.7% to 0.0% (Mistral-7B) and from 47.3% to 4.7% (Llama-2-7B), while matched random ablation keeps recall at baseline; GPT-2 recalls only 15% without assistance, and the authors state that its evidence in this row is the weakest.

    Harmonic mass and steering fragility

    • Harmonic mass: at L=2, the model-derived harmonic mass across 6 architectures ranges from 0.0001 (Mistral-7B, Qwen-2.5-7B) to 0.079 (Llama-2-7B), spanning nearly 3 orders of magnitude, with a reference value of 0.25 (Table 1, 30 MRPC pairs, k=8).
    • Relation to fragility: the 3 architectures with the lowest mass are exactly the 3 with the highest fact retention under random steering, Spearman ρ=0.90, exact one-sided permutation p=0.014 (720 orderings); the only rank inversion (Qwen-2.5-7B vs. Llama-3-8B, 34.3% vs. 36.0%) is within sampling error.
    • Steering comparison (Table 4, α=0.3, n=1000): on the fragile Llama-2-7B, random steering leaves only 4.2% fact retention, versus 31.0% for contrastive sheaf (McNemar p<10⁻⁷⁰);稳健的 Mistral-7B 上 CCA sheaf 41.6% 与随机 39.4% 统计打平(p=0.19);Llama-3-8B 上随机与 PIXEL 最高(36.0–38.8%);Llama-2-13B 各方法相近(29.6–32.7%,p>0.07).

    Other ablations and analyses

    • Multi-paraphrase cycles (Table 10): cycle-constrained H⁰ is +3.2 to +9.5 pp higher than pairwise H⁰ (average +6.5 pp, 8 architectures); an edge-count-matched acyclic path control recovers most of the gain (+7.7 pp), and cycles add only a further +0.5 pp, which is not significant on any of the 8 models, so the authors conclude that the gain comes from joint constraints rather than cycles themselves.
    • Restriction map ablation (Table 11): random P (74.2%) and identity P (77.5%) retain most of the H⁰ retrieval (PCA-P 81.6%), and the authors state that the content lies in the kernel of the within-pair difference covariance and is independent of P.
    • Cross-domain transfer (Table 9): cross-domain P averages 55–60%, about 25 pp lower than same-domain P (81.6%).
    • m sweep (Table 19): m∈[20,80] is a plateau, m=40 is +4 to +6 pp higher than m=20; at m=128=k it degrades to 36–53%.
    • Cross-lingual probe (Table 15): on English-French translation pairs in Llama-3-8B, 20-dimensional H⁰ retrieval is 76–78%, and the EN→FR direction exceeds the full 4096-dimensional hidden state (59%).
    • Negative results: the node-space H¹ operationalization does not transfer to retrieval (36.3%, below the random baseline, Appendix B.13); cycle holonomy is not significantly different from a shuffled null (p=0.10–0.33, Appendix B.12); the cycle/transition terms of MLST are neutral to slightly negative as a training signal (Appendix B.15).
  5. What are some points that can be further explored?

    The authors list limitations including the domain dependence of the restriction maps, the rank correlation over only 6 architectures, and the node-space H¹ not transferring, and propose future directions such as cross-modal restriction maps.

    Limitations and future directions pointed out by the authors

    • The restriction map depends on architecture and partly on domain (§7 Limitations): cross-corpus P loses about 25 pp (Appendix B.1); the authors suggest training P on in-domain data when the downstream retrieval domain is fixed.
    • Limited working range (§7): the advantage range of sheaf steering is α∈[0.10, 0.15]; on robust models, at α=0.30 random steering ties with it.
    • Node-space H¹ did not transfer, and cycle holonomy is not significant (§7): the node-space H¹ operationalization did not transfer to retrieval or steering (Appendix B.13); cycle holonomy is not significantly different from a shuffled-paraphrase null hypothesis (Appendix B.12).
    • The fragility diagnosis is only a rank correlation (§7): ρ=0.90 is only across 6 architectures, and the authors say more architectures are needed to treat it as a predictor.
    • Cross-dimension graphs and cross-lingual work are left for the future (§7, Appendix B.8): connecting activations of different dimensions (text and image encoders, models of different widths) requires per-node maps Pv of different widths, which the authors leave for future work; cross-lingual work was only a probing experiment, and a full cross-lingual study is future work; logical equivalence and dialogue continuation fit the same template but have not yet been attempted.
    • The PIXEL comparison is a simplified port (Appendix C.4 checklist): it uses a single global direction and no per-question gating; no empirical comparison was made with Angular Steering or MSRS (the authors call them orthogonal frameworks).

    Scope of experimental coverage

    • The models tested are 9 open-source architectures (124M–13B); the main retrieval table covers 8 of them (Llama-2-13B is not in Table 2), and the steering comparison covers 4 (Llama-2-7B, Llama-3-8B, Mistral-7B, Llama-2-13B).
    • Harmonic mass and fragility ranking are based on 6 architectures, 30 MRPC pairs, L=2; Appendix A.2 repeats this with k∈{64,128}, and the robust/fragile grouping is maintained.
    • Sample sizes: retrieval ntest=150 facts; steering n=1000/model (200 for Phi-2); functional validation 1000 sentences (4 models) or 100 sentences (5 models); harmonic mass one forward pass per model.
    • All evaluations are automated metrics (top-1, fact retention rate, KL, L2 change); the paper used no human evaluation or LLM judging.
    • Models above 7B use 4-bit quantization (bitsandbytes); the paper does not report an ablation of quantization on the results.
  6. Summarize the main content of the paper

    The authors use the sheaf Laplacian to decompose paraphrase consistency into a content kernel H⁰ and a spectral complement H¹, used respectively for retrieval, localizing causal influence, and diagnosing steering fragility.

    An interpretability paper: it formalizes "whether a representation is consistent under paraphrase" as a gluing condition on a cellular sheaf, and on a frozen model, without training, decomposes the representation into a content subspace stable across wordings and a subspace that varies with wording.

    • Problem: the authors state that existing interpretability methods do not test cross-context consistency, so steering methods are unstable across models and prompts, and there is no tool to predict a model's steering fragility in advance.
    • Method: build a cellular sheaf on a paraphrase graph; the kernel H⁰ of the sheaf Laplacian gives the content subspace, and the spectral complement (H¹ directions) captures directions that vary with wording; stacking multi-layer activations into a grid yields b1=N(L−1) algebraic 1-cycles, and the model-derived harmonic mass measures the degree to which inter-layer transformations fail to commute with paraphrase equivalence.
    • Retrieval results: the 20-dimensional H⁰ exceeds the full-dimensional LEACE retained subspace by an average of +17.1 pp on held-out CounterFact hard retrieval across 8 models (85.3% vs. 43.1% on GPT-2, Table 2); jointly constraining all paraphrases of a fact adds a further +6.5 pp (Table 10).
    • Causal influence: ablating the coordinates that vary most under paraphrase (a coordinate-level proxy for H¹) affects the output by 5.6–26.5× that of a variance-matched control (9 models, Table 3); ablating H¹ reduces fact recall in 7B models to 0–5%, while matched random ablation keeps the baseline (Table 14).
    • Fragility diagnostic: harmonic mass across 6 architectures spans nearly 3 orders of magnitude, and its ranking is rank-correlated with fact retention under random steering at ρ=0.90 (p=0.014); on the fragile Llama-2-7B, contrastive sheaf steering retains 31.0% of facts, versus only 4.2% for random steering (Table 4).
    • The authors' conclusions and boundaries: the authors state that the kernel, spectral complement, and harmonic mass come from the same paraphrase graph, and that models can be screened before a steering sweep; they also acknowledge that the restriction maps depend on architecture and domain, that the diagnostic is only a rank correlation over 6 architectures, and that the node-space H¹ does not transfer downstream.
Read originalhuggingface.co