通过降维可视化大模型隐空间几何,发现注意力与MLP输出的分离结构。
Visualizing LLM Latent Space Geometry Through Dimensionality Reduction
- 用PCA和UMAP分析Transformer层间激活,揭示隐空间几何
- 发现中间层中注意力与MLP输出明显分离,且首位置隐状态范数高
- 揭示GPT-2位置嵌入的螺旋结构,适合关注模型可解释性的研究者
大语言模型在众多自然语言任务中表现卓越,但其内部机制仍难解释。本文通过降维方法提取并可视化基于Transformer的语言模型中的隐状态几何结构。我们在Transformer块内多个位置捕获层间激活,并利用主成分分析(PCA)和统一流形近似与投影(UMAP)进行系统分析。实验涵盖GPT-2与LLaMa模型,发现显著的隐空间几何模式:中间层中注意力组件与MLP组件输出存在清晰分离,这一现象此前未见报道;同时观察到初始序列位置隐状态范数较高,并可视化了隐状态的逐层演化过程。此外,还揭示了GPT-2位置嵌入的高维螺旋结构及LLaMa的序列级几何特征。代码已公开于https://github.com/Vainateya/Feature_Geometry_Visualization,配套博客详见https://iclr-blogposts.github.io/2026/blog/2026/vis-llm-latent-geometry/。
原文摘要 · Abstract (English)
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. A better formatted blog-post with identical content is available at https://iclr-blogposts.github.io/2026/blog/2026/vis-llm-latent-geometry/.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。