Persistence Positional Encoding: A Minimal Transformer Recipe for Persistence Diagrams
Organizations: Graduate School of Artificial Intelligence, Ulsan National Institute of Science and Technology
Abstract
Persistence diagrams (PDs) represent multiscale topological information as multisets of birth-death pairs . 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.
Figures & tables
| (a) Transformer-based comparison | ||||||||||
| Method | ORBIT5K | MUTAG | PROTEINS | COX2 | DHFR | IMDB-B | IMDB-M | NCI1 | NCI109 | TU8 |
| MST | 81.56 5.53 | 78.99 7.90 | 68.10 2.89 | 77.53 1.56 | 60.34 3.53 | 67.78 4.34 | 39.28 3.09 | 65.44 1.28 | 59.97 1.29 | 64.68 |
| Persformer | 76.90 13.58 ∗ | 82.48 6.23 | 71.23 3.18 | 78.16 0.58 | 60.83 0.65 | 67.44 2.75 | 39.63 3.73 | 64.10 3.21 | 64.64 1.66 | 66.06 |
| xPerT | 83.86 1.24 | 83.38 5.75 | 72.29 3.59 | 77.51 3.05 | 75.80 3.27 | 66.48 4.13 | 46.15 3.24 | 66.36 1.14 | 66.56 1.02 | 69.32 |
| PPE (Ours) | 90.68 0.72 | 87.44 3.40 | 72.96 4.61 | 78.70 3.47 | 80.03 3.18 | 70.24 3.33 | 46.60 3.45 | 75.66 1.47 | 74.09 1.66 | 73.22 |
| Method | Learning model | TU8 |
| Transformer-based PD methods | ||
| PPE | Transformer | 73.22 |
| xPerT | Transformer | 69.32 |
| Persformer | Transformer | 66.06 |
| MST | Transformer | 64.68 |
| Learned PD representations | ||
| Varied factor | Point representation | Downstream module | MUTAG | PROTEINS | COX2 | DHFR | IMDB-B | IMDB-M | NCI1 | NCI109 | TU8 |
| Both | Point MLP | Pooled MLP (mean+sum) | 81.38 | 72.58 | 78.08 | 60.32 | 64.28 | 43.56 | 62.46 | 62.84 | 65.69 |
| Point MLP | Transformer | 82.69 | 71.48 | 78.16 | 60.64 | 68.64 | 45.68 | 64.56 | 65.29 | 67.14 | |
| Fixed RFF | Pooled MLP (mean+sum) | 85.74 | 71.61 | 77.46 | 79.85 | 69.00 | 46.43 | 73.64 | 73.58 | 72.16 | |
| Fixed RFF | Transformer | 85.38 | 71.72 | 78.30 | 79.56 | 69.88 | 46.47 | 75.67 | 74.07 | 72.63 | |
| Point representation | Raw coordinates | DeepSets | 80.43 | 71.82 | 78.16 | 60.85 | 63.84 | 39.45 | 62.41 | 62.42 | 64.92 |
| Fixed RFF | DeepSets | 86.08 | 72.09 | 77.55 | 79.37 | 68.56 | 46.67 | 74.08 | 73.22 | 72.20 |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | PI + Transformer | RFF + Transformer | PI RFF |
| MUTAG | 81.70 | 85.38 | 3.68 |
| PROTEINS | 73.22 | 71.72 | +1.50 |
| COX2 | 78.16 | 78.30 | 0.14 |
| DHFR | 60.50 | 79.56 | 19.06 |
| IMDB-B | 50.30 | 69.88 | 19.58 |
| IMDB-M | 43.11 | 46.47 | 3.36 |
| PersLay variant | ORBIT5K | TU8 |
| Image | 81.36 | 71.10 |
| Line/PEQ | 36.49 | 66.31 |
| Landscape | 32.97 | 64.05 |
| Exponential | 27.65 | 65.94 |
| Representation | MUTAG | PROTEINS | COX2 | DHFR | IMDB-B | IMDB-M | NCI1 | NCI109 | TU8 |
| Common MLP head from the persistence-image configuration | |||||||||
| Persistence image | 82.76 6.24 | 73.47 3.66 | 77.39 1.44 | 61.16 0.90 | 65.72 3.44 | 43.27 5.17 | 66.01 2.55 | 65.57 1.77 | 66.92 |
| ATOL | 86.54 4.28 | 71.66 3.54 | 77.65 0.79 | 72.20 5.78 | 67.32 6.46 | 44.03 3.98 | 64.32 1.30 | 66.00 1.57 | 68.71 |
| Persistence landscape | 80.95 10.87 | 66.45 2.08 | 78.08 0.55 | 71.14 5.06 | 64.96 3.06 | 40.99 2.85 | 61.14 1.41 | 60.73 2.22 | 65.56 |
| Persistence silhouette | 66.30 1.34 | 67.53 2.46 | 78.08 0.76 | 60.90 0.40 | 65.44 3.51 | 41.29 2.85 | 56.76 2.19 | 56.98 2.56 | 61.66 |
| Betti curve | 85.19 5.70 | 68.71 2.51 | 77.35 0.89 | 78.18 2.93 | 65.12 2.97 | 40.92 3.37 | 69.49 2.01 | 70.10 1.35 | 69.38 |
| ogbg-molhiv ROC-AUC | |
| Method | Score |
| PersLay | 70.92 0.30 |
| Persistence image + MLP | 70.38 0.42 |
| PPE | 69.32 1.51 |
| xPerT | 68.27 0.71 |
| ATOL + random forest | 67.71 0.74 |
| Method | Val Acc (%) | Test Acc (%) |
| MST | 64.12 7.83 | 50.91 10.34 |
| Persformer | 55.18 9.18 | 52.32 11.19 |
| xPerT | 62.82 9.80 | 54.11 12.62 |
| PPE (Ours) | 77.29 11.71 | 71.97 11.36 |
| Component | Configuration |
| Fourier Feature Encoder | |
| Number of frequencies ( ) | 128 |
| Frequency scale ( ) | 10.0 |
| Output dimension | 256 ( cosine and sine components) |
| Homology-Dimension Embedding | |
| Number of dimensions | 2 ( , ) |
| Dataset | Wall-clock time |
| MUTAG | 3m 28s |
| DHFR | 7m 30s |
| COX2 | 7m 45s |
| IMDB-B | 9m 46s |
| PROTEINS | 22m 4s |
| IMDB-M | 24m 50s |
| Cap per homology component | Balanced accuracy |
| 512 | 65.82 3.59 |
| 1,024 (primary) | 65.79 4.27 |
| 2,048 | 65.10 4.07 |
| Hyperparameter | Range | Distribution |
| learning rate | log-uniform | |
| weight decay | log-uniform | |
| dropout | uniform |
| Method | Hyperparameter | Values |
| PPE a | d_model | |
| nhead | ||
| num_layers | ||
| num_frequencies | ||
| ff_scale | , log-uniform | |
| use_betti_embedding |
| Dataset family | Batch | Warmup epochs | Total epochs | ES patience |
| TU graphs (MUTAG, PROTEINS, COX2, DHFR, IMDB-B/M, NCI1/109) | 64 | 50 | 300 | 20 |
| ORBIT5K | 16 | 50 | 300 | 20 |
| Synthetic donut | 32 | 5 | 400 | 60 |
| Method | ORBIT5K | MUTAG | PROTEINS | COX2 | DHFR | IMDB-B | IMDB-M | NCI1 | NCI109 |
| PersLay | 87.7 1.0 | 89.8 | 74.8 | 80.9 | 80.3 | 71.2 | 48.8 | 73.5 | 69.5 |
| Persformer | 91.2 0.8 | 89.9 2.1 | — | — | — | — | — | — | — |
| xPerT | 87.0 0.7 | 91.0 5.2 | 75.7 3.8 | 84.4 3.5 | 81.9 2.9 | 72.6 3.4 | 50.0 2.0 | — | — |
| MST (Ord., no clustering) | — | 89.25 0.77 | 72.92 0.47 | 81.20 1.04 | 74.12 0.37 | 70.76 0.47 | 45.44 0.35 | 69.12 0.17 | 66.38 0.40 |