Differential syntactic and semantic encoding in LLMs
Santiago Acevedo, Alessandro Laio, Marco Baroni

TL;DR
This paper investigates how Large Language Models encode syntactic and semantic information, revealing that these are linearly and differentially encoded across layers, with implications for understanding model representations.
Contribution
It demonstrates that syntax and semantics are linearly encoded in LLMs and can be decoupled, providing new insights into their internal representation structure.
Findings
Syntactic and semantic information can be extracted by averaging and subtracting centroid vectors.
Syntax and semantics are differentially encoded across layers.
Linear manipulations significantly affect sentence similarity based on syntax and semantics.
Abstract
We study how syntactic and semantic information is encoded in inner layer representations of Large Language Models (LLMs), focusing on the very large DeepSeek-V3. We find that, by averaging hidden-representation vectors of sentences sharing syntactic structure or meaning, we obtain vectors that capture a significant proportion of the syntactic and semantic information contained in the representations. In particular, subtracting these syntactic and semantic ``centroids'' from sentence vectors strongly affects their similarity with syntactically and semantically matched sentences, respectively, suggesting that syntax and semantics are, at least partially, linearly encoded. We also find that the cross-layer encoding profiles of syntax and semantics are different, and that the two signals can to some extent be decoupled, suggesting differential encoding of these two types of linguistic…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Generative Adversarial Networks and Image Synthesis · Computational and Text Analysis Methods
