TypeProbe: Recovering Type Representations from Hidden States of Pre-trained Code Models
Not on the map. Why?
Abstract (arXiv)
State-of-the-art code models achieve impressive performance, yet the extent to which they internally encode type information remains poorly understood. We probe the residual streams of pretrained code models for internal type representations using a parallel dataset of Java and Python code examples. Our results show that cross-lingual type representations emerge even from untyped code. Moreover, we test whether hidden states linearly encode the result type implied by typed function application by training probes on one language to infer argument and result types in the other. Finally, we find that this structure is partly robust to lexical perturbations and cross-language syntactic variations. To the best of our knowledge, prior work on interpretability of code models has not directly targeted formal type semantics or cross-lingual type representations. We release our code and datasets.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 12 of its 14 references that are in the map. First posted on arXiv 9 Jul 2026.
Builds on
12 of 14 references.
References · 12
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2016Understanding intermediate layers using linear classifier probescited by 1,353
- 2022Toy Models of Superpositioncited by 971
- 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 876
- 2019Designing and Interpreting Probes with Control Taskscited by 640
- 2023Towards Best Practices of Activation Patching in Language Models: Metrics and Methodscited by 359
- 2023SantaCoder: don't reach for the stars!cited by 170
- 2019Investigating Multilingual NMT Representations at Scalecited by 68
- 2025Type-Constrained Code Generation with Language Modelscited by 35
- 2016Massively Multilingual Word Embeddingscited by 26
- 2022Probing Pretrained Models of Source Codecited by 26
- 2024Understanding How CodeLLMs (Mis)Predict Types with Activation Steeringcited by 5
Built on by
Not cited yet.