TypyBench: Evaluating LLM Type Inference for Untyped Python Repositories
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
MajorEvidence 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 when the base score does, handle unequal arities as specified, and are symmetric. The published example 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 rows per model, with finite TypeCheck entries. Recomputed TypeCheck means include for GPT-4o, for Claude-3.5-Sonnet, and for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are and 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 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 where is the selected error count and is a stub program. To evaluate compatibility of predicted types with the original uses, the required object is instead 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 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 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 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.
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
MinorEvidence 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 when the base score does, handle unequal arities as specified, and are symmetric. The published example 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 rows per model, with finite TypeCheck entries. Recomputed TypeCheck means include for GPT-4o, for Claude-3.5-Sonnet, and for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are and 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 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 and their Jaccard score is In the independently checked Mypy representation, the local names are respectively and The released formula on those sets yields where 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.
Possible revision
Traverse the effective inherited symbol set before comparing supported operations.
Problem 3. Cached exact-match-without-missing loads the TypeSim key
MinorEvidence 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 when the base score does, handle unequal arities as specified, and are symmetric. The published example 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 rows per model, with finite TypeCheck entries. Recomputed TypeCheck means include for GPT-4o, for Claude-3.5-Sonnet, and for DeepSeek-V3; these agree with Table 2 at its printed precision. The corresponding TypeSim means are and 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 and exact-match-without-missing a cold evaluation correctly stores whereas the reload branch assigns to the exact field. Its absolute error is The example needs only a valid cache containing the separately computed fields with 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.
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.