Manuscript Offprint

arXiv:2611.00631

TopoQuant: Topological Framework to Characterize Behavioral Shifts in Quantized Large Language Models

Baha Rababah, Shahzeb Qamar, Lorenz Sparrenberg, Rafet Sifa, Murat Kantarcioglu, Carson K. Leung, Cuneyt Gurcan Akcora

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Baha Rababah¹,², Shahzeb Qamar³, Lorenz Sparrenberg³, Rafet Sifa³

Murat Kantarcioglu⁴, Carson K. Leung¹, Cuneyt Gurcan Akcora⁵

¹ Department of Computer Science, University of Manitoba, Winnipeg, MB, Canada

² Applied Computer Education Department, Red River College Polytechnic, Winnipeg, MB, Canada

³ Bonn-Aachen International Center for IT (b-it), University of Bonn, Bonn, Germany

⁴ Department of Computer Science, Virginia Tech University, Blacksburg, VA, USA

⁵ AI Initiative, University of Central Florida, Orlando, FL, USA

rababahb@myumanitoba.ca, shahzeb.qamar@iais.fraunhofer.de, lsparren@uni-bonn.de, Rafet.Sifa@bit.uni-bonn.de, muratk@vt.edu, Carson.Leung@UMANitoba.ca, cuneyt.akcora@ucf.edu

Abstract—Post-training quantization (PTQ) reduces the computational cost of large language models (LLMs), but it can introduce internal structural and behavioral changes that are not captured by traditional metrics such as accuracy and perplexity. We present TopoQuant, a topological framework that uses topological data analysis (TDA) to quantify structural drift in self-attention weights and relate it to behavioral changes in quantized LLMs. Across four LLM families and multiple quantization levels, we show that topological drift remains stable at moderate compression levels but increases sharply below 4-bit precision, closely tracking declines in attention agreement. Our results reveal a strong relationship between topological drift and attention agreement, indicating that structural changes in model parameters closely reflect behavioral degradation under quantization. We further demonstrate that topological features can accurately predict attention consistency using lightweight machine learning models, achieving R2R^2 scores of up to 0.85. Predicting attention agreement enables efficient assessment of behavioral consistency in quantized LLMs, allowing quantization-induced degradation to be detected without running expensive downstream tasks. The results indicate that topological drift provides an efficient early-warning signal for quantization-induced degradation and can help identify safe compression limits without extensive downstream evaluation.

Index Terms—Post-Training Quantization; Large Language Models; Topological Data Analysis; Persistent Homology; Attention Mechanisms; Behavioral Evaluation; Machine Learning

I. INTRODUCTION

Post-training quantization (PTQ), which reduces the precision of pre-trained large language model (LLM) parameters, has emerged as an effective approach for lowering memory consumption, inference latency, and computational costs during deployment [1, 2]. However, quantization often introduces performance degradation and behavioral drift [3]. Traditional evaluation metrics, such as accuracy, loss, and perplexity, provide only limited insights into how and why quantization affects the model behavior [3, 4].

Understanding these effects requires examining the internal structure of the model, rather than relying solely on down-

stream performance. Topological data analysis (TDA) offers a promising framework for this purpose by characterizing the shape, connectivity, and structural organization of high-dimensional data [5, 6]. Consequently, topological features may reveal quantization-induced changes that remain hidden from conventional statistical metrics.

Attention mechanisms play a central role in transformer-based LLMs by determining which tokens influence model predictions [7]. Prior studies have shown that attention behavior is sensitive to quantization artifacts and closely linked to model behavior [8–10]. Quantization-induced perturbations to the Query, Key, and Value projections can alter attention allocation patterns, even when the overall task accuracy remains stable. Therefore, measuring the attention agreement between full-precision and quantized models provides a sensitive indicator of behavioral drift that may not be detected using aggregate performance metrics alone.

Recent parameter-based quantization evaluation frameworks have attempted to analyze quantization effects directly from model parameters [3, 4]. However, several limitations remain. First, high accuracy can be misleading because quantized models may produce substantially different predictions while maintaining similar aggregate performance. Second, existing approaches primarily rely on aggregate statistical or coordinate-based representations that quantify numerical drift but fail to capture the underlying geometric and structural organization of model parameters. Third, current frameworks [11, 12] lack effective mechanisms for early detection of quantization-induced degradation. Finally, most approaches aggregate Query (QQ), Key (KK), and Value (VV) projections into a single global measure [4], making it difficult to identify which attention components are most affected by quantization.

To address these limitations, we propose TopoQuant, a topological framework for analyzing quantization-induced changes in large language models (LLMs). The framework combines three complementary perspectives: behavioral drift analysis, attention consistency analysis, and topological drift analysis. Attention consistency is quantified using Top-1 agreement and Top-3 Intersection-over-Union (IoU), whereas structural drift is characterized using TDA-based representations. By relating topological changes to attention behavior, TopoQuant provides an interpretable view of how quantization alters the model behavior and internal organization.

TopoQuant analyzes Query (Q), Key (K), and Value (V) projection matrices independently, enabling targeted diagnosis of quantization-sensitive components. We focus on these projections because they directly govern attention formation and token interactions, whereas the Output (O) projection primarily transforms attention outputs after the attention distribution has already been computed. This design allows the framework to identify structural changes before they become apparent in conventional downstream evaluation metrics.

This study investigates LLMs quantized from 8-bit to 2-bit precision and explores whether topological representations can characterize and predict quantization-induced behavioral changes. Our main contributions are:

  • We propose TopoQuant, a topology-aware framework for quantifying quantization-induced structural drift in LLM attention weights using persistence diagrams.

  • We introduce a multi-metric topological analysis pipeline that measures structural changes between base and quantized models across attention projections, blocks, and quantization levels.

  • We link topological drift to attention behavior through Top-1 agreement and Top-3 IoU-based attention consistency analysis.

  • We show that topological drift can identify quantization degradation and determine effective quantization stopping points without exhaustive model evaluation.

  • We develop lightweight machine learning models that predict attention agreement between the base and quantized model directly from topological drift features and LLM characteristics.

  • We evaluate TopoQuant across multiple LLM families and quantization schemes, showing its effectiveness in characterizing and predicting changes in quantization behavior.

References (32)