Characterizing Large Language Model Geometry Helps Solve Toxicity Detection and Generation
Randall Balestriero, Romain Cosentino, Sarath Shekkizhar
Abstract
Large Language Models (LLMs) drive current AI breakthroughs despite very little being known about their internal representations. In this work, we propose to shed the light on LLMs inner mechanisms through the lens of geometry. In particular, we develop in closed form the intrinsic dimension in which the Multi-Head Attention embeddings are constrained to exist and the partition and per-region affine mappings of the feedforward (MLP) network of LLMs' layers. Our theoretical findings further enable the design of novel principled solutions applicable to state-of-the-art LLMs. First, we show that, through our geometric understanding, we can bypass LLMs' RLHF protection by controlling the embedding's intrinsic dimension through informed prompt manipulation. Second, we derive interpretable geometrical features that can be extracted from any (pre-trained) LLM, providing a rich abstract representation of their inputs. We observe that these features are sufficient to help solve toxicity detection, and even allow the identification of various types of toxicity. Our results demonstrate how, even in large-scale regimes, exact theoretical results can answer practical questions in LLMs. Code: https://github.com/RandallBalestriero/SplineLLM
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 2f802573-0c08-4459-8d56-14721da7d220Cited by top-tier papers4
- A Survey on Efficient Large Language Model Training: From Data-centric PerspectivesJunyu Luo, Bohan Wu, Xiao Luo, Zhiping Xiao et al.ACL 2025 · 12 citations
- NerVE: Nonlinear Eigenspectrum Dynamics in LLM Feed-Forward NetworksNandan Kumar Jha, Brandon ReagenICLR 2026 · 4 citations
- Characterizing the Discrete Geometry of ReLU NetworksBlake Gaines, Jinbo BiICLR 2026 · 2 citations
- TTVD: Towards a Geometric Framework for Test-Time Adaptation Based on Voronoi DiagramMingxi Lei, Chunwei Ma, Meng Ding, Yufan Zhou et al.ICLR 2025
Builds on19
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Attention is not all you need: pure attention loses rank doubly exponentially with depthYihe Dong, Jean-Baptiste Cordonnier, Andreas LoukasICML 2021 · 522 citations
- Understanding Dimensional Collapse in Contrastive Self-supervised LearningLi Jing, Pascal Vincent, Yann LeCun, Yuandong TianICLR 2022 · 467 citations
Related papers
- Quantifying Large Language Model Attacks Through the Lens of Model CognitionXiuming Liu, Chaoxiang He, Xuanran Yu, Jichen Chai et al.USENIX Security 2026
- Self-Regularization with Sparse Autoencoders for Controllable LLM-based ClassificationXuansheng Wu, Wenhao Yu, Xiaoming Zhai, Ninghao LiuKDD 2025
- The Shape of Adversarial Influence: Characterizing LLM Latent Spaces with Persistent HomologyAideen Fay, Inés García-Redondo, Qiquan Wang, Haim Dubossarsky et al.ICLR 2026 · 8 citations
- Learning Safety Constraints for Large Language ModelsXin Chen, Yarden As, Andreas KrauseICML 2025
- Toxicity Detection for FreeZhanhao Hu, Julien Piet, Geng Zhao, Jiantao Jiao et al.NeurIPS 2024 · 20 citations
