ELVIA.Evidence Atlas
ICML 2025ELVIA assessment Major

TypyBench: Evaluating LLM Type Inference for Untyped Python Repositories

Honghua Dong, Jiacheng Yang, Xun Deng, Yuhe Jiang, Gennady Pekhimenko, Fan Long, Xujie Si

ELVIA analysis

Independent review pending

This initial review examines the published proceedings paper, its embedded appendices, and the pinned released evaluation code. A major methodological problem affects the interpretation of TypeCheck: the released procedure checks predicted stub programs separately from original implementations, so the two error counts do not test the same program obligations. An independent, fully typed example passes as a predicted stub yet produces an argument-type error when its predictions are applied to the unchanged implementation. Two local implementation defects concern inherited attributes in TypeSim and an exact-match cache field. The printed model-level arithmetic is reproducible from the supplementary tables. These results establish defects in the evaluated objects and released implementation; they do not determine revised model rankings or identify the code commit used in the historical experiments.

Stub-only checker counts omit original implementation obligations — Counterevidence: Stubs retain useful declaration/import/inheritance checks. Missing-rate is also reported. Neither addresses the complete-signature counterexample. Historical prediction directory contents/experiment commit are not supplied, so historical rankings are not declared reversed.

Problem 1. Stub-only checker counts omit original implementation obligations

Major
Evidence and reasoning

Problem statement

For two base types the paper defines a Jaccard similarity of supported attribute sets after excluding common `object` operations. Ordered generic arguments are averaged positionwise and normalized by the larger arity; union members use a maximum-weight matching, again normalized by the larger cardinality. The root and argument contributions are averaged. These operations yield scores in [0,1][0,1] when the base score does, handle unequal arities as specified, and are symmetric. The published example S(List[int],Sequence[float])=12(0.7+0.6)=0.65S(\mathrm{List[int]},\mathrm{Sequence[float]}) =\tfrac12(0.7+0.6)=0.65 is arithmetically correct. A partial-match score is a similarity heuristic, not a proof of type substitutability; this distinction alone is not counted as a defect.

The supplementary Tables 9–17 contain 5050 rows per model, with 4747 finite TypeCheck entries. Recomputed TypeCheck means include 366.0213366.0213 for GPT-4o, 127.1277127.1277 for Claude-3.5-Sonnet, and 214.6170214.6170 for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are 0.80448,0.80448, 0.78762,0.78762, and 0.79468.0.79468. This is a check of published arithmetic, not a replication of the measurements. The three unavailable checker runs are disclosed in Table 6, rather than silently treated as zero.

Section 4.2 (p. 5) motivates TypeCheck using inconsistencies such as a predicted return type being incompatible with its uses, and interprets counted errors as obstacles to practical use. Section 6.2 (p. 7) compares model error counts with the original repository average of 141.8141.8 and interprets a lower count as stronger consistency. The abstract and conclusion make repository-wide consistency a central contribution.

The released dataflow is decisive. `run.py` mounts the prediction directory. The Docker entry point invokes |scripts/evaluation.py| with that directory. Its `evaluate` function calls |get_repo_similarity(original_repo,prediction_directory)|. In `repo_similarity.py`, the original and prediction directories are passed separately to |get_type_dict_from_repo|. In `helpers.py`, that function copies each input program’s own files to a temporary directory and calls Mypy’s builder. No step inserts predicted signatures into the original function bodies or recreates their call sites. The predictions requested on pp. 7 and 14 are `.pyi` stub files. Ordinary stub files contain signatures but elide implementation logic [mypy].

Consequently the procedure compares E(Poriginal)withE(Spredicted),E(P_{\mathrm{original}})\quad\hbox{with}\quad E(S_{\mathrm{predicted}}), where EE is the selected error count and SS is a stub program. To evaluate compatibility of predicted types with the original uses, the required object is instead E ⁣(Poriginal[predicted annotations]).E\!\left(P_{\mathrm{original}}[ \text{predicted annotations}]\right). These quantities need not agree even for complete, syntactically valid predictions.

Complete syntactically valid predicted stub signatures. Explicit ordinary primitive types, no Any. Original function implementations and call sites fixed. Separate original/prediction checker inputs, as in released dataflow.

Proof

Consider this original implementation:

Code: def f() -> int: return 11 def h(x: int) -> int: return x def g() -> int: return h(f())

Predict precisely these three signatures:

Code: def f() -> str: ... def h(x: int) -> int: ... def g() -> int: ...

All functions are present; all parameters and returns use ordinary explicit primitive types; there is no `Any`, missing file, syntax error, external dependency, overload, dynamic dispatch, or untyped body. Thus neither missing predictions nor gradual-typing escape hatches explain the discrepancy. This is a counterexample to the metric’s interpretation, not a claimed member of the curated 50-repository dataset.

The predicted stub is internally type-correct. Applying its signatures to the original bodies instead changes only the return annotation of `f`. The literal return value 11 is an `int`, contradicting the predicted `str`; moreover `h(f())` supplies a declared `str` to a required `int` argument. The latter is an `arg-type` error, explicitly included in Appendix C.2.

An independently written fixture was checked with the already installed Mypy 1.14.1 and Python 3.13.5. The original implementation produced zero errors; the predicted stub produced zero errors; the reannotated implementation produced two errors, `return-value` and `arg-type`. This is an actual finite diagnostic on new reviewer-written programs, not execution of the authors’ evaluator. The paper reports Mypy 1.11.1/Python 3.12,3.12, so this run is not claimed to reproduce that environment. The structural argument does not depend on a version-specific diagnostic: the predicted stub contains none of the original return or call expressions.

□\square

Possible revision

Apply every model's predictions to a fixed implementation/caller corpus, evaluate identical obligations, and separately count parse and annotation failures.

Problem 2. Local symbol names do not equal supported inherited operations

Minor
Evidence and reasoning

Problem statement

For two base types the paper defines a Jaccard similarity of supported attribute sets after excluding common `object` operations. Ordered generic arguments are averaged positionwise and normalized by the larger arity; union members use a maximum-weight matching, again normalized by the larger cardinality. The root and argument contributions are averaged. These operations yield scores in [0,1][0,1] when the base score does, handle unequal arities as specified, and are symmetric. The published example S(List[int],Sequence[float])=12(0.7+0.6)=0.65S(\mathrm{List[int]},\mathrm{Sequence[float]}) =\tfrac12(0.7+0.6)=0.65 is arithmetically correct. A partial-match score is a similarity heuristic, not a proof of type substitutability; this distinction alone is not counted as a defect.

The supplementary Tables 9–17 contain 5050 rows per model, with 4747 finite TypeCheck entries. Recomputed TypeCheck means include 366.0213366.0213 for GPT-4o, 127.1277127.1277 for Claude-3.5-Sonnet, and 214.6170214.6170 for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are 0.80448,0.80448, 0.78762,0.78762, and 0.79468.0.79468. This is a check of published arithmetic, not a replication of the measurements. The three unavailable checker runs are disclosed in Table 6, rather than silently treated as zero.

Section4.1.1 uses supported methods/operations for the base Jaccard score.

Two distinct named ordinary classes. Child inherits Base.read unchanged and adds nothing. No generics, union, Any, or overrides. Supported operations include inherited methods.

Proof

Section 4.1.1 (p. 4) defines base similarity using supported methods and operations. The released |get_type_attributes| returns `TypeInfo.names`, a class’s local symbol table, without traversing its method-resolution order. Consider

Code: class Base: def read(self) -> int: return 11 class Child(Base): pass

Both types support the same inherited operation `read`; the subclass neither adds nor overrides behavior. Excluding common `object` operations, the intended supported-operation sets are both {read}\{\mathrm{read}\} and their Jaccard score is 1.1. In the independently checked Mypy representation, the local names are respectively {read}\{\mathrm{read}\} and ∅.\varnothing. The released formula on those sets yields 1−∣{read}△∅∣∣{read}∩∅∖O∣+∣{read}△∅∣=0,1-\frac{|\{\mathrm{read}\}\triangle\varnothing|} {|\{\mathrm{read}\}\cap\varnothing\setminus O| +|\{\mathrm{read}\}\triangle\varnothing|}=0, where OO is the excluded common-operation set. The string-equality shortcut in |get_type_similarity| does not apply because the two named classes differ. The independent fixture confirms equal effective MRO attribute sets but a local-name score of zero.

An alternative definition based strictly on declarations would make the calculation internally coherent, but would not be the paper’s stated supported-operation definition. Method-name overlap also omits signatures and effects; that separate design limitation is not needed for this counterexample. Assessment: Minor for the demonstrated bounded implementation discrepancy. The extent to which inherited user-defined classes contributed to the historical aggregate scores is not established. Computing effective supported attribute sets would address this specific mismatch; complete semantic similarity and historical numerical recovery are not thereby verified.

□\square

Possible revision

Traverse the effective inherited symbol set before comparing supported operations.

Problem 3. Cached exact-match-without-missing loads the TypeSim key

Minor
Evidence and reasoning

Problem statement

For two base types the paper defines a Jaccard similarity of supported attribute sets after excluding common `object` operations. Ordered generic arguments are averaged positionwise and normalized by the larger arity; union members use a maximum-weight matching, again normalized by the larger cardinality. The root and argument contributions are averaged. These operations yield scores in [0,1][0,1] when the base score does, handle unequal arities as specified, and are symmetric. The published example S(List[int],Sequence[float])=12(0.7+0.6)=0.65S(\mathrm{List[int]},\mathrm{Sequence[float]}) =\tfrac12(0.7+0.6)=0.65 is arithmetically correct. A partial-match score is a similarity heuristic, not a proof of type substitutability; this distinction alone is not counted as a defect.

The supplementary Tables 9–17 contain 5050 rows per model, with 4747 finite TypeCheck entries. Recomputed TypeCheck means include 366.0213366.0213 for GPT-4o, 127.1277127.1277 for Claude-3.5-Sonnet, and 214.6170214.6170 for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are 0.80448,0.80448, 0.78762,0.78762, and 0.79468.0.79468. This is a check of published arithmetic, not a replication of the measurements. The three unavailable checker runs are disclosed in Table 6, rather than silently treated as zero.

Released evaluator exports separate TypeSim and exact-match fields for all and nonmissing cases.

Existing cache has both scalar fields. TypeSim and exact scores differ. Cache branch executed.

Proof

In |scripts/evaluation.py|, `evaluate` saves both |repo_overall_score_wo_missing| and |repo_overall_score_wo_missing_exact|. On a cache hit, however, the variable for the latter is assigned the former dictionary key. The resulting CSV and printed exact-match-without-missing output can change merely because the evaluation is repeated.

For a cache containing TypeSim-without-missing u=0.9u=0.9 and exact-match-without-missing v=0.6,v=0.6, a cold evaluation correctly stores v,v, whereas the reload branch assigns uu to the exact field. Its absolute error is 0.3.0.3. The example needs only a valid cache containing the separately computed fields with u≠v;u\ne v; the same synthetic score pair is permitted by a partial-credit metric versus exact matching. No author pickle was loaded and no author function was executed.

The cold branch calculates and saves the correct field; the defect is specifically the reload branch. The published main exact-match-by-depth results do not automatically inherit this error, since their depth dictionaries are loaded separately. Assessment: Minor. Replacing the lookup with the exact-match key repairs this local dataflow, but no full author evaluation was rerun and no claim is made that the published tables used the faulty cached scalar.

□\square

Possible revision

Read the repo_overall_score_wo_missing_exact cache key.

Supporting record & provenance

Work status

Current version

Version 1

Minhao Liu · Initial report · Version 1

Independent review pending

Original claim and review scope

We then use the Jaccard index to measure functional similarity, where two types are similar if they share most of the same methods and operations.

Published ICML 2025 proceedings PDF (PMLR 267); PDF p. 4

Actual review scope

The recorded inspection concerns these source locations: PDF pp. 5,7; Figs.1,9-10 and p. 14 prompts; released repo_similarity.py:get_repo_similarity, helpers.py:get_type_dict_from_repo, evaluation.py:evaluate, Dockerfile entry point.; PDF p. 4; released type_similarity.py:get_type_attributes,_get_type_info_similarity,get_type_similarity; scripts/evaluation.py:evaluate cache load and cache save blocks, CSV overall_score_wo_missing_exact output.

Submit an author revisionContribute a review