REVIEW 3 major objections 15 references
Code models encode type information as linear directions that transfer between Java and Python, even from untyped code.
Reviewed by Pith at T0; open to challenge. T0 means a machine referee read the full paper against a public rubric. the ladder, T0–T4 →
T0 review · grok-4.5
2026-07-10 09:07 UTC pith:RSY3VFDZ
load-bearing objection Solid empirical probing paper: parallel Java/Python design shows linear type directions that transfer from untyped code, with honest limits and released artifacts. the 3 major comments →
TypeProbe: Recovering Type Representations from Hidden States of Pre-trained Code Models
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
SantaCoder and CodeLlama develop linearly decodable type representations in their residual streams that transfer across Java and Python. These representations appear even when probes are trained solely on untyped Python, and they encode not only argument types but also the result type implied by typed function application. The structure is only partly disrupted by adversarial renaming that makes identifiers contradict true types.
What carries the argument
Layer-wise linear probes on the residual-stream activation at the fill-in-the-middle token, scored by selectivity against a per-token random-label control, trained and transferred across parallel Java, typed-Python, and untyped-Python partitions.
Load-bearing premise
That strong linear-probe selectivity on a synthetic parallel corpus with randomized names is enough to show the residual stream encodes formal type semantics rather than leftover regularities of the generated data.
What would settle it
Train the same probes on real open-source Java and Python corpora with natural identifier distributions and re-measure cross-lingual transfer and adversarial robustness; collapse of selectivity or of zero-shot transfer would falsify the claim that the recovered directions are formal type representations.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper uses layer-wise linear probes on residual-stream activations (at the FIM token) of SantaCoder-1.1B and CodeLlama-7B to recover type information from a programmatically generated parallel corpus of Java and Python programs (typed/untyped partitions with independently randomized identifiers). It reports that type labels (argument type, application-result type, and function choice) are linearly decodable, that probes trained on one language transfer zero-shot to the other (including from untyped Python), that selectivity peaks in mid-to-late layers, and that the signal is only partly robust to adversarial identifier renaming that systematically contradicts true types. Code and datasets are released.
Significance. If the central claim holds—that residual streams encode abstract, cross-lingual type structure (including a simple form of typed function application) even from untyped code—the work would be a clear advance for code-model interpretability. Prior probing of code models has largely targeted syntax/identifiers rather than formal type semantics; the parallel-corpus design, adversarial renaming, control-task selectivity, and public release of code/data are genuine strengths that make the empirical findings reusable and falsifiable. The results could also motivate hybrid type-constrained decoding that exploits internal representations rather than purely external checkers.
major comments (3)
- §2.1 (Dataset and Design) and Evaluation Metrics: the claim that high selectivity demonstrates encoding of formal type semantics (rather than residual statistical regularities of the synthetic distribution) is not fully secured. Even after independent identifier/literal randomization, every example is built from the same type-compatible skeletons with unique input types and uniformly distributed pairs; operators, literals and control-flow patterns that systematically co-vary with type (e.g., +1 with int, .length()/len with String/list) remain available. The per-token randomized-label control destroys only label–activation associations, not these structural co-occurrences. Consequently, non-trivial zero-shot transfer (pyUnt o Java) and Task-2 selectivity may still reflect synthetic distributional regularities. A stronger control (e.g., type-preserving but operator/literal-scrambled progra
- Tables 1–3 and §2.2 (Task 2): the interpretation of Application Result prediction as evidence that hidden states “linearly encode the result type implied by typed function application” overstates what the probe recovers. Because candidates always have unique input types and the call site is of the fixed form b:τb=f_⟨FIM⟩(a), success on Task 2 can be achieved by recovering τa and looking up the matching signature rather than performing a genuine compositional inference step. Disentangling these two routes (e.g., by introducing overloaded candidates or multi-argument functions) is required for the stronger semantic claim.
- Limitations (§4) and experimental scope: all positive results rest on a closed set of four base types plus homogeneous lists, two languages, and purely synthetic programs of bounded complexity. While the authors correctly flag this, the central claim of a “cross-lingual type manifold” is currently supported only inside this narrow distribution; without at least one experiment on real, multi-file code or a richer type system the generality of the finding remains untested and the paper’s title/abstract over-reach.
Circularity Check
No circularity: purely empirical linear-probe study with independent controls, adversarial partitions, and cross-lingual transfer; no definitional reductions or fitted-as-prediction steps.
full rationale
The paper's load-bearing claims (linearly decodable cross-lingual type representations, including result types of typed function application, that emerge even from untyped Python and are partly robust to adversarial renaming) rest entirely on measured selectivity of linear probes trained and evaluated on held-out folds of a programmatically generated parallel corpus. Selectivity is defined as task accuracy minus a per-token randomized-label control; peak layers, absolute drops under adversarial renaming, and zero-shot transfer (e.g., pyUnt-trained probes on Java) are reported as empirical outcomes, not derived by construction from fitted parameters. There are no equations equating a claimed prediction to an input by definition, no parameters fitted to a subset and then re-presented as predictions of a closely related quantity, no load-bearing self-citations of uniqueness theorems or ansätze, and no renaming of a known empirical pattern. The synthetic-data construction and residual co-occurrence regularities raise validity questions about what the probes recover, but those are correctness/generalization concerns, not circularity of the derivation chain. The work is self-contained against its own benchmarks.
Axiom & Free-Parameter Ledger
free parameters (1)
- probe learning rate / weight decay / epochs
axioms (4)
- domain assumption Linear probe selectivity above a randomized-label control indicates that the residual stream linearly encodes the probed property.
- domain assumption Base types and list containers of Java and Python can be placed in a direct operational correspondence (str↔String, list[T]↔List<T>, etc.).
- ad hoc to paper The post-residual activation at the FIM token is a sufficient locus for recovering type information relevant to the masked call.
- ad hoc to paper Independent randomization of identifiers and literals per partition eliminates lexical shortcuts that would otherwise allow probes to succeed without type structure.
invented entities (1)
-
cross-lingual type manifold
no independent evidence
read the original abstract
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.
Figures
Reference graph
Works this paper leans on
-
[1]
Alain, G., Bengio, Y.: Understanding intermediate layers using linear classifier probes. In: 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Workshop Track Proceedings. OpenReview.net (2017),https://openreview.net/forum?id=HJ4-rAVtl
work page 2017
-
[2]
Allal, L.B., Li, R., Kocetkov, D., Mou, C., Akiki, C., Ferrandis, C.M., et al.: Santacoder: don’t reach for the stars! (2023),https://arxiv.org/abs/2301.03988
work page internal anchor Pith review Pith/arXiv arXiv 2023
-
[3]
Ammar, W., Mulcaire, G., Tsvetkov, Y., Lample, G., Dyer, C., Smith, N.A.: Massively multilingual word embeddings (2016),https://arxiv.org/abs/1602. 01925
work page 2016
-
[4]
Belinkov, Y.: Probing classifiers: Promises, shortcomings, and advances. Computa- tional Linguistics48(1), 207–219 (Mar 2022).https://doi.org/10.1162/coli_a_ 00422,https://aclanthology.org/2022.cl-1.7/
-
[5]
Cardelli, L., Wegner, P.: On understanding types, data abstraction, and polymor- phism. ACM Comput. Surv.17(4), 471–523 (Dec 1985).https://doi.org/10. 1145/6041.6042,https://doi.org/10.1145/6041.6042
-
[6]
Transformer Circuits Thread (2022), https:// transformer-circuits.pub/2022/toy_model/index.html
Elhage, N., Hume, T., Olsson, C., Schiefer, N., Henighan, T., Kravec, et al.: Toy models of superposition. Transformer Circuits Thread (2022), https:// transformer-circuits.pub/2022/toy_model/index.html
work page 2022
-
[7]
In: Inui, K., Jiang, J., Ng, V., Wan, X
Hewitt, J., Liang, P.: Designing and interpreting probes with control tasks. In: Inui, K., Jiang, J., Ng, V., Wan, X. (eds.) Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP). pp. 2733–
work page 2019
-
[8]
https://doi.org/10.18653/v1/D19-1275
Association for Computational Linguistics, Hong Kong, China (Nov 2019). https://doi.org/10.18653/v1/D19-1275
-
[9]
Kudugunta, S.R., Bapna, A., Caswell, I., Arivazhagan, N., Firat, O.: Investigating multilingual nmt representations at scale (2019),https://arxiv.org/abs/1909. 02197
work page 2019
-
[10]
In: Belinkov, Y., Mueller, A., Kim, N., Mohebbi, H., Chen, H., Arad, D., Sarti, G
Lucchetti, F., Guha, A.: Understanding how CodeLLMs (mis)predict types with activation steering. In: Belinkov, Y., Mueller, A., Kim, N., Mohebbi, H., Chen, H., Arad, D., Sarti, G. (eds.) Proceedings of the 8th BlackboxNLP Workshop: Analyzing and Interpreting Neural Networks for NLP. pp. 358–397. Association for Computational Linguistics, Suzhou, China (No...
work page 2025
-
[11]
Mündler, N., He, J., Wang, H., Sen, K., Song, D., Vechev, M.: Type-constrained code generation with language models. Proc. ACM Program. Lang.9(PLDI) (Jun 2025).https://doi.org/10.1145/3729274
-
[12]
https://github.com/ TransformerLensOrg/TransformerLens(2022)
Nanda, N., Bloom, J.: Transformerlens. https://github.com/ TransformerLensOrg/TransformerLens(2022)
work page 2022
-
[13]
Rozière,B.,Gehring,J.,Gloeckle,F.,Sootla,S.,Gat,I.,Tan,X.E.,etal.:Codellama: Open foundation models for code (2024),https://arxiv.org/abs/2308.12950
work page internal anchor Pith review Pith/arXiv arXiv 2024
-
[14]
Fine-grained prediction of reading comprehension from eye movements,
Troshin, S., Chirkova, N.: Probing pretrained models of source codes. In: Bast- ings, J., Belinkov, Y., Elazar, Y., Hupkes, D., Saphra, N., Wiegreffe, S. (eds.) Proceedings of the Fifth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP. pp. 371–383 (2022).https://doi.org/10.18653/v1/ 2022.blackboxnlp-1.31
-
[15]
Zhang, Z., Nanda, N.: Towards best practices of activation patching in language models: Metrics and methods. In: International Conference on Learning Representa- tions (ICLR) (2024), https://proceedings.iclr.cc/paper_files/paper/2024/ file/06a52a54c8ee03cd86771136bc91eb1f-Paper-Conference.pdf 12 G. Gorgone, F. Carcassi A Confusion Matrices: Task1 (Java,py...
work page 2024
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.