Uncovering Hierarchical Structure in LLM Embeddings Using Geometric and Topological Measures
The rapid advancement of large language models (LLMs) has driven major advances across scientific domains, yet the hierarchical, geometric, and topological structure of their embedding spaces remains poorly understood. In this work, we introduce a comprehensive framework for evaluating LLM embeddings through six complementary metrics that characterize hierarchy, geometry, and topology. Specifically, $δ$-hyperbolicity and ultrametricity quantify the degree of tree-like structure, while Neighbor Joining evaluates how well pairwise distances support hierarchical reconstruction. The Ollivier-Ricci curvature captures local geometric behavior, persistent homology measures multiscale topological stability, and fractal dimension estimates intrinsic complexity. Applying this framework to embeddings from multiple protein LLMs, we reveal how different models encode hierarchical relationships and structural organization. Evaluating the structure of these embeddings in the representation space helps improve geometry-aware model design. This is critical in domains such as bioinformatics and healthcare, where real-world hierarchical and relational structures matter. Our results demonstrate that geometric and topological analysis provides a guiding lens for understanding and potentially improving the representational quality of LLM embeddings.