arXiv:2610.17848cs.LGOct 2026

Manuscript Offprint

arXiv:2610.17848

Persistence Positional Encoding: A Minimal Transformer Recipe for Persistence Diagrams

Eunwoo Heo, Ganghyun Kim, Jaejun Yoo

ABSTRACT

Persistence diagrams (PDs) represent multiscale topological information as multi-sets of birth–death pairs (b,d)(b, d). How best to use them with Transformers, however, remains unclear. Connecting PDs to Transformers requires choosing how topological information is tokenized and exposed to self-attention. Prior methods use specialized designs for tokenization, aggregation, Transformer blocks, or attention, but are hard to compare since reported results rarely share PD inputs, splits, or model-selection rules. We instead confine the diagram-specific design to point representation, mapping each birth–death pair through fixed random Fourier features while leaving the Transformer backbone unchanged, and call this recipe Persistence Positional Encoding (PPE). In matched controls on eight TU graph benchmarks (TU8), changing only point representation shifts macro accuracy by 5.49 to 6.47 percentage points (pp), against 0.47 to 1.45 pp from changing the downstream module, identifying point representation as the dominant design variable tested. We further reevaluate vectorizations, kernels, learned representations, and Transformer-based models under one protocol with shared PD inputs, outer folds, and validation-only selection. Among all evaluated PD methods and downstream configurations, PPE achieves the highest mean on most benchmarks, including TU8, ORBIT5K, and MCB-C. Finally, we prove that grid averaging leaves a reconstruction error at any resolution, whereas a Transformer with fixed random Fourier frequencies is almost surely universal. PPE thus offers a minimal, Transformer-native baseline for persistence diagrams, and a common protocol for future comparison.

1 INTRODUCTION

How should a persistence diagram be presented to a Transformer? Persistent homology (PH) is a standard tool in topological data analysis (TDA) (Carlsson, 2009) for characterizing the shape and structure of data across multiple scales, with applications spanning molecular property prediction, protein structure analysis, drug discovery, dynamical systems, materials science, and neuroscience (see Appendix B for related work). Its output is commonly represented as a persistence diagram (PD), a multiset of birth–death pairs that records when topological features appear and disappear. A broad range of methods incorporate PDs into learning pipelines, including fixed summaries—persistence images, landscapes, Betti curves, silhouettes (Adams et al., 2017; Bubenik, 2015; Umeda, 2017; Chazal et al., 2015); kernels—sliced Wasserstein, scale-space, persistence-weighted Gaussian (Carrière et al., 2017; Reininghaus et al., 2015; Kusano et al., 2016); and learned representations—PERSLAY, RationalHat, ATOL (Carrière et al., 2020; Hofer et al., 2019; Royer et al., 2021). Yet for Transformers, which have become general-purpose backbones across modalities, the question above remains open.

The difficulty is that a Transformer does not consume a diagram. It consumes tokens. Using a diagram-level representation as a single token compresses the entire diagram before self-attention is applied, so attention never operates on individual topological features directly. Splitting such a representation into multiple tokens requires an additional choice of how those tokens should correspond to the underlying diagram. Treating each persistence point (b,d)(b, d) as a token is the natural point-level alternative, but raw two-dimensional coordinates are not necessarily an effective input for a Transformer. Using PDs with Transformers therefore involves a nontrivial choice of both tokenization and point representation.

∗^{*}Equal contribution.

Existing Transformer-based PD methods place their diagram-specific design at different stages. PERS-FORMER (Reinauer et al., 2021) keeps standard scaled dot-product attention while adding a learned pointwise embedding, extra residual connections between self-attention layers, and attention pooling against a trainable query. XPERT (Kim, 2024) pixelizes each diagram onto an R×RR \times R grid and partitions it into P×PP \times P patches, so the grid resolution and the patch size must be chosen together before a ViT-style encoder sees the tokens. The Multiset Transformer (MST) (Wang et al., 2024) represents distinct points with explicit multiplicities, adds multiplicity-dependent terms to its attention weights, and uses multiset-specific equivariant blocks and invariant readout. Because each of these changes several parts of the representation, aggregation, or Transformer pipeline at once, a method-level comparison cannot tell which change is responsible for the reported gains (see Appendix B).

A second obstacle compounds the first. Reported results across the PD literature come from different PD inputs, data splits, model-selection procedures, and search budgets, so numbers from different papers are rarely comparable. This lack of comparability has been raised as a barrier to progress in topological machine learning (Barnes et al., 2021; Castilla Rieso et al., 2026). As a concrete example, the released XPERT protocol trains on all non-test samples and reports the maximum test accuracy across epochs. Under such conditions, even the basic question of whether a specialized architecture is needed at all cannot be settled from the literature.

We address both obstacles with a deliberately minimal design and a controlled evaluation. Persistence Positional Encoding (PPE) confines its diagram-specific design to token construction. Each birth-death coordinate (b,d)(b, d) is mapped through fixed random Fourier features and combined with a learnable homology-dimension embedding, while the Transformer blocks, the attention rule, and the CLS readout stay unchanged. This separation lets us ask directly whether the bottleneck in applying Transformer to PDs lies in the representation of persistence points or in the architecture around them. In matched controls on the eight TU graph benchmarks, changing only the point representation shifts macro accuracy by 5.49 to 6.47 percentage points (pp), whereas changing only the downstream module shifts it by 0.47 to 1.45 pp (Table 3). The largest single-dataset gain from the point encoder is 19.5 pp, on DHFR. Among the components varied here, point representation is the dominant design variable.

Fourier feature mappings expose multiple frequency scales before the coordinates reach the downstream network (Tancik et al., 2020; Mildenhall et al., 2020), and this gives the empirical finding a theoretical counterpart. We show that at every resolution, uniform grid averaging leaves a reconstruction error that no decoder can bring below a fixed positive bound (Theorem 1). Information discarded at the grid cannot be recovered downstream, however expressive the model. A Transformer with fixed Fourier frequencies is instead almost surely a universal approximator for continuous functions of persistence diagrams, without prior knowledge of the target frequencies (Theorem 2).

We reevaluate diagram-level vectorizations, kernel methods, learned PD representations, and Transformer-based PD models above on shared prepared PD inputs and outer folds, with model selection based only on validation data for every method. Under this protocol, PPE achieves the highest TU8 macro across all evaluated method–downstream configurations and has the highest mean among the evaluated Transformer-based PD methods on all eleven benchmarks, including 90.68% on ORBIT5K, 6.82 pp above the next-best 83.86%. This includes two larger-scale benchmarks not reported in prior PD–Transformer work, with 69.32 ROC-AUC on ogbg-molhiv (41,127 graphs under its official scaffold split) and 65.79 balanced accuracy on MCB-C (1,745 point-cloud samples), exceeding the next-best Transformer-based method by 1.05 and 9.46 pp, respectively.

One may ask whether PPE is more than Fourier features applied to PD coordinates. The feature map itself follows a standard construction (Tancik et al., 2020). Our contribution is not the feature map in isolation, but showing why this representation choice matters through the matched controls that attribute the gains to point representation rather than to architecture, the theory that explains why grid-based tokenization cannot close the gap, and the unified protocol under which Transformer-based, vectorization, kernel, and learned PD methods are compared on equal terms. Together, these turn a small encoder change into something the field can build on. PPE gives persistence diagrams a Transformer-native interface that requires no PD-specific attention or pooling, so it drops into standard token-based pipelines as they are. The controls and theory tell practitioners which design variable deserves their effort, and the unified protocol offers a common ground on which future PD methods, Transformer-based or not, can be compared. We view this combination, rather than the encoder alone, as the contribution of this work. Our main contributions are as follows:

Method and findings. We introduce PPE, which maps PD points to Fourier features for a standard Transformer. It achieves the highest mean among the evaluated Transformer-based PD methods on all eleven benchmarks, including two larger-scale evaluations, and shows more stable convergence (Figure 2b). Matched TU8 controls show larger gains from changing the point encoding, 5.49–6.47 pp, than from changing the downstream module, 0.47–1.45 pp (Table 3).

Theory. We prove a reconstruction lower bound for uniform grid averaging that holds at every resolution and for every decoder (Theorem 1), and an almost-sure universal approximation result for the PPE Transformer with Fourier frequencies sampled once and kept fixed (Theorem 2).

Unified evaluation. We reevaluate Transformer-based models, vectorization methods, kernels, and learned PD representations on shared PD inputs and outer folds with validation-based model selection (Tables 1 and 2). We further extend the comparison beyond the benchmarks reported in prior PD–Transformer work to the 41,127-graph ogbg-molhiv and MCB-C. PPE attains the highest TU8 macro accuracy among the evaluated method–downstream configurations (Table 2).

References (59)