NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Zero-Dimensional Attention Topology for Linguistic Acceptability

Saeed AlMarriarXiv 2026

In the quest to understand the "black box" of Large Language Models, researchers have increasingly turned to Topological Data Analysis (TDA). The idea is intuitive: if we treat the attention patterns in a Transformer as a graph, perhaps the "shape" of these interactions reveals deep linguistic structures.

However, a recent paper by Saeed AlMarri, "Zero-Dimensional Attention Topology for Linguistic Acceptability," provides a sobering reality check. By rigorously testing a specific topological representation against simpler baselines, the study suggests that more complexity doesn't always lead to better insights—and sometimes, your fancy topological features are just a complicated way of counting words.

TL;DR

This study evaluates whether zero-dimensional persistent homology ($H_0$) summaries of BERT's attention layers can improve the classification of grammatical "acceptability." The results show that these topological features actually underperform compared to simpler attention statistics and the original BERT model, while also revealing that they inadvertently encode basic information like sentence length.

What Problem Does This Paper Address?

Transformer models like BERT rely on attention mechanisms, which can be viewed as directed, weighted graphs where tokens are nodes and attention weights are edges. Previous studies suggested that the topology of these graphs—their connectivity, loops, and clusters—could be a powerful proxy for linguistic phenomena.

The author tackles a critical question: Does a topological representation actually provide a predictive advantage over simpler summaries of attention, or does it just capture "noise" and basic sentence properties? To answer this, the paper focuses on "linguistic acceptability" (determining if a sentence is grammatically valid), using the well-known CoLA benchmark.

Methods

The study design, summarized in Figure 1, follows a rigorous comparative framework:

Figure 1: Study design. The attention-feature readouts use the filtered downstream training set and are compared on the same evaluation sentences as the baselines. Their results are reported aggregates; BERT and length-control results are recalculated from the accompanying records. ID and OOD denote the in-domain and out-of-domain labeled validation partitions.
  1. Feature Extraction: Using a pre-trained bert-base-cased model, the author extracted attention matrices from all 144 heads (12 layers × 12 heads).
  2. Topological Representation ($H_0$): The attention matrices were symmetrized to create undirected graphs. The author then applied zero-dimensional persistent homology. In simple terms, this tracks how connected components in the graph merge as you vary an edge-weight threshold. These merge values are mathematically equivalent to the weights in a Minimum Spanning Tree (MST).
  3. Summarization: For each head, the distribution of these merge values was summarized into 10 features (mean, variance, quantiles, entropy, etc.), resulting in a 1,440-dimensional vector per sentence.
  4. Baselines:
  5. Attention Statistics: A simpler 576-feature set including mean row entropy and asymmetry.
  6. BERT: The raw predictions from the fine-tuned model.
  7. Length Controls: Simple counts of tokens and characters to see if models are just "cheating" by using sentence length.

Datasets

The evaluation used the Corpus of Linguistic Acceptability (CoLA), which contains sentences labeled by linguists as acceptable or unacceptable.

  • Training: 8,517 sentences.
  • Evaluation: 521 In-Domain (ID) and 497 Out-of-Domain (OOD) validation sentences.
  • The author performed extensive "data-integrity filtering" to remove duplicates and conflicting labels that often plague NLP benchmarks.

Key Insights and Ideas

  • The "Length" Trap: One of the most striking findings is a mathematical proof showing that the $H_0$ representation perfectly retains token-count information. Specifically, the number of tokens $n$ can be recovered from the mean and sum of the merge values. This warns researchers that TDA features might appear successful simply because they are acting as a proxy for sentence length.
  • Loss of Directionality: By symmetrizing the attention matrices to perform standard TDA, the representation discards "directional circulation." If Token A attends to Token B, but B does not attend to A, this specific $H_0$ construction treats them as a simple mutual connection, losing potentially vital linguistic nuance.
  • Uncertainty and Source Sensitivity: The author found that uncertainty estimates for model performance are highly sensitive to the "sampling unit." Resampling by the original linguistic source of the sentences (e.g., a specific linguistics textbook) produced much wider error bars than simple sentence-level resampling, as seen in Figure 4.
Figure 4: Sensitivity of BERT uncertainty estimates to the resampling unit (N). Each interval uses 2,000 percentile-bootstrap replicates. Source resampling draws source codes with replacement and retains all sentences from each selected code, producing a variable sample size.

Key Results

The primary metric used was the Matthews Correlation Coefficient (MCC). As shown in Figure 2, the topological representation struggled:

Figure 2: MCC on matched primary evaluation sentences. Open markers denote reported attention-feature results; filled markers denote BERT scores recalculated from saved predictions. Error bars are marginal 95% sentence-bootstrap intervals. Their overlap is not a paired test.
  • Out-of-Domain (OOD): BERT achieved an MCC of 0.545, while the simpler attention statistics hit 0.508. The $H_0$ topological representation lagged behind at 0.438.
  • In-Domain (ID): Interestingly, simple attention statistics (0.639) actually outperformed the full BERT model (0.599) in this specific setup, but $H_0$ (0.585) still remained the weakest of the three.
  • Paired Contrasts: Figure 3 highlights that the performance gap between $H_0$ and BERT is statistically significant in the out-of-domain setting.
Figure 3: Reported paired MCC contrasts (R). Negative values favor the comparator. The out-of-domain BERT contrast excludes zero under the recorded sentence-bootstrap procedure; the out-of-domain attention- statistics contrast narrowly includes zero.

Limitations and Future Work

The author is careful to note that these results don't "debunk" TDA in NLP, but rather define the limits of this specific approach.

  • Dimensionality: This study only looked at $H_0$ (connectivity). Higher-dimensional homology ($H_1$, $H_2$), which captures loops and "voids" in the attention space, might still hold untapped predictive power.
  • Directed Topology: Future work should explore topological methods that don't require symmetrizing the attention matrix, thereby preserving the directed nature of how tokens "look" at each other.
  • Scope: The study was limited to one English dataset and one BERT checkpoint. Testing across different languages and model architectures (like Llama or Mistral) remains an open path.

In conclusion, while the "shape" of attention is a fascinating concept, this paper serves as a reminder that in machine learning, the simplest explanation—or the simplest feature set—is often the hardest to beat.

Summary updated

BibTeX
@misc{almarri2026zero,
  author = {Saeed AlMarri},
  title = {{Zero-Dimensional Attention Topology for Linguistic Acceptability}},
  year = {2026},
  eprint = {2611.22312},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.22312},
}
Figure