Visualizing LLM Latent Space Geometry Through Dimensionality Reduction

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Ning, Alex, Rangaraju, Vainateya, Kuo, Yen-Ling
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866912801358872576
author Ning, Alex
Rangaraju, Vainateya
Kuo, Yen-Ling
author_facet Ning, Alex
Rangaraju, Vainateya
Kuo, Yen-Ling
contents Large language models (LLMs) achieve state-of-the-art results across many natural language tasks, but their internal mechanisms remain difficult to interpret. In this work, we extract, process, and visualize latent state geometries in Transformer-based language models through dimensionality reduction. We capture layerwise activations at multiple points within Transformer blocks and enable systematic analysis through Principal Component Analysis (PCA) and Uniform Manifold Approximation and Projection (UMAP). We demonstrate experiments on GPT-2 and LLaMa models, where we uncover interesting geometric patterns in latent space. Notably, we identify a clear separation between attention and MLP component outputs across intermediate layers, a pattern not documented in prior work to our knowledge. We also characterize the high norm of latent states at the initial sequence position and visualize the layerwise evolution of latent states. Additionally, we demonstrate the high-dimensional helical structure of GPT-2's positional embeddings and the sequence-wise geometric patterns in LLaMa. We make our code available at https://github.com/Vainateya/Feature_Geometry_Visualization.
format Preprint
id arxiv_https___arxiv_org_abs_2511_21594
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Visualizing LLM Latent Space Geometry Through Dimensionality Reduction
Ning, Alex
Rangaraju, Vainateya
Kuo, Yen-Ling
Machine Learning
Large language models (LLMs) achieve state-of-the-art results across many natural language tasks, but their internal mechanisms remain difficult to interpret. In this work, we extract, process, and visualize latent state geometries in Transformer-based language models through dimensionality reduction. We capture layerwise activations at multiple points within Transformer blocks and enable systematic analysis through Principal Component Analysis (PCA) and Uniform Manifold Approximation and Projection (UMAP). We demonstrate experiments on GPT-2 and LLaMa models, where we uncover interesting geometric patterns in latent space. Notably, we identify a clear separation between attention and MLP component outputs across intermediate layers, a pattern not documented in prior work to our knowledge. We also characterize the high norm of latent states at the initial sequence position and visualize the layerwise evolution of latent states. Additionally, we demonstrate the high-dimensional helical structure of GPT-2's positional embeddings and the sequence-wise geometric patterns in LLaMa. We make our code available at https://github.com/Vainateya/Feature_Geometry_Visualization.
title Visualizing LLM Latent Space Geometry Through Dimensionality Reduction
topic Machine Learning
url https://arxiv.org/abs/2511.21594