Prompt Less, Infer More: Static Analysis-Guided LLM Type Annotation for Python
Abstract
Type annotations improve the maintainability and reliability of Python programs, but many real-world projects remain under-annotated because manual annotation is time-consuming and error-prone. Recent neural and LLM-based type inference systems can recover missing annotations, yet they often trade accuracy for efficiency. Existing approaches often fail to exploit project-wide type evidence, or do so inefficiently through unnecessary model calls and noisy prompts. We present SALT, an LLM-based type inference system guided by static analysis. SALT integrates static analysis with LLM inference to resolve types statically, prioritize LLM queries, and construct concise type-aware context. To demonstrate the effectiveness of SALT, we evaluated it on 12 real-world Python projects. SALT achieves the best accuracy among the evaluated systems and reduces estimated LLM cost by up to 78.5% compared with a strong coding-assistant baseline. It also shows similar cost savings with the frontier model GPT-5.5, demonstrating that SALT remains effective with strong LLMs.
Create a lesson
Metadata
- Comments
- Accepted at ICSE 2027
Related papers
When Static Reachability Says No: Checking Joern-Based Negative Verdicts for Python Against Execution
Shared title terminologycs.SEArtur Zięba-Kozarzewski, Bartosz Grzegorzewski
Interrupt-Aware Static Detection of Deadlocks in Rust Operating Systems
Shared title terminologycs.SEYuzhi Li, Hongliang Tian, Chengjun Chen et al.
AEGIS: Evidence-Guided Set Decisions for Requirement-to-Code Traceability
Shared title terminologycs.SEZhiyao Wang, Yiming Peng, Munan Li et al.
Landscape and Taxonomy of Prompt Engineering Patterns in Software Engineering
Shared title terminologycs.SEYuya Sasaki, Hironori Washizaki, Jialong Li et al.
Agentic Root Cause Reasoning and Localization of Unsoundness in Static Call Graph Analysis
Shared title terminologycs.SEMohammad Rafieian, Michael Hicks, Shiyi Wei
The Defect Is in the Arithmetic Between the Files: Static Detection of Exactly-Once Violations in Payment Pipelines
Shared title terminologycs.SEAbhishek Sharma