X-LogSMask: Expand Transformer for Graph-Structured Data

Leyan Li, Rennong Yang, Zhenxing Zhang, Liping Hu
7/2/2026
cs.LGcs.AI
transformer-attention

Official code: LiLeyan-0120/X-LogSMask (1 star, MIT, last commit 2026-01-28).

Abstract

Transformers have become general-purpose architectures, but their all-to-all self-attention is poorly matched to graph data, whose interactions are sparse, structured and multi-scale. Existing Graph Transformers address this mismatch through structural encodings, hybrid message-passing modules or learned attention constraints, often introducing additional complexity and limited interpretability.

Show full abstract

Here we introduce X-LogSMask, an explainable multi-head logarithmic structural mask that injects symmetrically normalized graph topology directly into attention logits. The logarithmic transform converts structural connectivity into a topology-aware gating signal, suppressing unsupported node interactions while preserving feature-dependent attention. By assigning different powers of the normalized adjacency matrix to different attention heads, X-LogSMask gives each head a defined structural radius and supports multi-hop information propagation within a single layer. We further show that a standard Transformer encoder can be interpreted as one-step message passing on a complete graph, motivating X-LogSMask as a topology-constrained alternative to unrestricted self-attention. Across 20 node-, edge- and graph-level benchmarks, Transformers equipped with X-LogSMask achieve state-of-the-art performance on 13 datasets and remain competitive in a lightweight one-layer configuration. These results show that simple, interpretable structural masks can make self-attention an effective graph-learning operator without changing the Transformer architecture. The code is available at https://github.com/LiLeyan-0120/X-LogSMask.

View on arXivView PDF

Code Implementations(1)

MIT

X-LogSMask (Explainable Multi-head Logarithmic Structural Mask), a concise and interpretable modification to the self-attention matrix that injects graph topology as an additive structural bias while retaining the discriminative effect of multiplicative attention.

10Dec 19, 202510 months agoMIT

Similar Papers

Cite this paper

@article{li2026xlogsmask,
  title  = {X-LogSMask: Expand Transformer for Graph-Structured Data},
  author = {Leyan Li and Rennong Yang and Zhenxing Zhang and Liping Hu},
  year   = {2026},
  eprint = {2607.01553},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.01553v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.01553.svg)](https://codeofpaper.com/paper/2607.01553)

Discussion