Persistent Topological Features in Large Language Models

Yuri Gardinazzi, Giada Panerai, Karthik Viswanathan, Alessio Ansuini, Alberto Cazzaniga +1 more
2/12/2026

No official code found. Best implementation: RitAreaSciencePark/ZigZagLLMs (19 stars, MIT, last commit 2025-06-20).

Abstract

Understanding the decision-making processes of large language models is critical given their widespread applications. To achieve this, we aim to connect a formal mathematical framework - zigzag persistence from topological data analysis - with practical and easily applicable algorithms. Zigzag persistence is particularly effective for characterizing data as it dynamically transforms across model layers. Within this framework, we introduce topological descriptors that measure how topological features, $p$-dimensional holes, persist and evolve throughout the layers. Unlike methods that assess each layer individually and then aggregate the results, our approach directly tracks the full evolutionary path of these features. This offers a statistical perspective on how prompts are rearranged and their relative positions changed in the representation space, providing insights into the system's operation as an integrated whole. To demonstrate the expressivity and applicability of our framework, we highlight how sensitive these descriptors are to different models and a variety of datasets. As a showcase application to a downstream task, we use zigzag persistence to establish a criterion for layer pruning, achieving results comparable to state-of-the-art methods while preserving the system-level perspective.

View on arXivView PDF

Code Implementations(1)

MIT

Persistent Topological Features in Large Language Models

193Python, Jupyter NotebookOct 11, 20241 years agoMIT

Similar Papers

Cite this paper

@article{gardinazzi2026persistent,
  title  = {Persistent Topological Features in Large Language Models},
  author = {Yuri Gardinazzi and Giada Panerai and Karthik Viswanathan and Alessio Ansuini and Alberto Cazzaniga and Matteo Biagetti},
  year   = {2026},
  eprint = {2410.11042},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2410.11042},
  journal = {ICML 2024 2024}
}

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/2410.11042.svg)](https://codeofpaper.com/paper/2410.11042)

Discussion