A Graph-Theoretical Framework for Analyzing the Behavior of Causal Language Models

Rashin Rahnamoun, Mehrnoush Shamsfard


Abstract
Recent progress in natural language processing has popularized causal language models, but their internal behavior remains poorly understood due to the high cost and reliance on large-scale benchmarks in existing analysis methods. To address these challenges, we introduce a graph-theoretical framework for analyzing causal language models. Our method constructs graphs from model outputs by linking high-probability token transitions and applies classical metrics to capture linguistic features of model behavior. Based on previous works, none have examined or applied graph analysis from this perspective. For the first time, a macroscopic view of the overall behavior of a language model is provided by analyzing the mathematical characteristics of small sample graphs derived from the generated outputs. We first discuss the metrics theoretically, then demonstrate how they work through experiments, followed by some applications of this graph-theoretical framework in natural language processing tasks. Through experiments across training steps and model sizes, we demonstrate that these metrics can reflect model evolution and predict performance with minimal data. We further validate our findings by comparing them with benchmark accuracy scores, highlighting the reliability of our metrics. In contrast to existing evaluation methods, our approach is lightweight, efficient, and especially well-suited for low-resource settings. Our implementation codes are available at this GitHub repository.
Anthology ID:
2025.emnlp-main.1014
Volume:
Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing
Month:
November
Year:
2025
Address:
Suzhou, China
Editors:
Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, Violet Peng
Venue:
EMNLP
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
20053–20084
Language:
URL:
https://preview.aclanthology.org/ingest-emnlp/2025.emnlp-main.1014/
DOI:
Bibkey:
Cite (ACL):
Rashin Rahnamoun and Mehrnoush Shamsfard. 2025. A Graph-Theoretical Framework for Analyzing the Behavior of Causal Language Models. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 20053–20084, Suzhou, China. Association for Computational Linguistics.
Cite (Informal):
A Graph-Theoretical Framework for Analyzing the Behavior of Causal Language Models (Rahnamoun & Shamsfard, EMNLP 2025)
Copy Citation:
PDF:
https://preview.aclanthology.org/ingest-emnlp/2025.emnlp-main.1014.pdf
Checklist:
 2025.emnlp-main.1014.checklist.pdf