English

Differential syntactic and semantic encoding in LLMs

Computation and Language 2026-05-29 v5 Artificial Intelligence Machine Learning Computational Physics

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 information in LLM representations.

Keywords

Cite

@article{arxiv.2601.04765,
  title  = {Differential syntactic and semantic encoding in LLMs},
  author = {Santiago Acevedo and Alessandro Laio and Marco Baroni},
  journal= {arXiv preprint arXiv:2601.04765},
  year   = {2026}
}

Comments

Published as conference paper at ICML 2026

R2 v1 2026-07-01T08:55:48.950Z