Co-Evolution of Types and Dependencies: Towards Repository-Level Type Inference for Python Code
Shuo SunShixin ZhangJiwei YanJun YanJian Zhang
Shuo Sun
Shixin Zhang
Jiwei Yan
Jun Yan
Jian Zhang
+5
The paper presents CoType, an LLM-based approach for repository-level Python type inference that co-evolves types and dependencies. It constructs an Entity Dependency Graph (EDG) to capture cross-file type dependencies, then iteratively refines both types and dependencies in the graph. A type-checker-in-the-loop validates and corrects inferences each iteration to reduce error propagation. Evaluated on 12 complex Python repositories, CoType achieves a TypeSim of 0.89 and TypeExact of 0.84, outperforming baselines by 27% and 40% respectively, and removes 92.7% of new type errors introduced by the tool.

arXiv ·
· December 25, 2025