On the Representations of Entities in Auto-regressive Large Language Models
Victor Morand, Josiane Mothe, Benjamin Piwowarski
TL;DR
This paper probes how named entities are represented inside autoregressive LLMs by introducing entity mention reconstruction and the Entity Lens, an extension of the logit lens to decode multi-token mentions. Using task vectors trained per layer, the authors demonstrate that entities are encoded in distributed representations that can be decoded into complete mentions, with context enabling near-perfect copying. They show that entity representations are influenced by frequency rather than token length, and that averaging or linear cleaning can yield better decodability than last-token embeddings. The work further extends to relation decoding, showing that simple linear transformations can extract relational signals between entities, and provides an actionable visualization tool for inspecting what entities the model associates at different layers. Overall, the findings reveal an entity representation space within LLMs, with implications for interpretability, knowledge retrieval, and controllable generation.
Abstract
Named entities are fundamental building blocks of knowledge in text, grounding factual information and structuring relationships within language. Despite their importance, it remains unclear how Large Language Models (LLMs) internally represent entities. Prior research has primarily examined explicit relationships, but little is known about entity representations themselves. We introduce entity mention reconstruction as a novel framework for studying how LLMs encode and manipulate entities. We investigate whether entity mentions can be generated from internal representations, how multi-token entities are encoded beyond last-token embeddings, and whether these representations capture relational knowledge. Our proposed method, leveraging _task vectors_, allows to consistently generate multi-token mentions from various entity representations derived from the LLMs hidden states. We thus introduce the _Entity Lens_, extending the _logit-lens_ to predict multi-token mentions. Our results bring new evidence that LLMs develop entity-specific mechanisms to represent and manipulate any multi-token entities, including those unseen during training. Our code is avalable at https://github.com/VictorMorand/EntityRepresentations .
