An Empirical Study of Large Language Models for Type and Call Graph Analysis in Python and JavaScript - Shivarpatna Venkatesh, Ashwin Prasad; Sunil, Rose; Sabu, Samkutty; Mir, Amir M.; Reis, Sofia; Bodden, Eric (Empirical Software Engineering)
Large Language Models (LLMs) are increasingly being explored for their potential in software engineering, particularly in static analysis tasks. In this study, we investigate the potential of current LLMs to enhance call-graph analysis and type inference for Python and JavaScript programs. We empirically evaluated 24 LLMs, including OpenAI's GPT series and open-source models like LLaMA and Mistral, using existing and newly developed benchmarks. Specifically, we enhanced TypeEvalPy, a micro-benchmarking framework for type inference in Python, with auto-generation capabilities, expanding its scope from 860 to 77,268 type annotations for Python. Additionally, we introduced SWARM-CG and SWARM-JS, comprehensive benchmarking suites for evaluating call-graph construction tools across multiple programming languages. Our findings reveal a contrasting performance of LLMs in static analysis tasks. For call-graph generation, traditional static analysis tools such as PyCG for Python and Jelly for JavaScript consistently outperform LLMs. While advanced models like mistral-large-it-2407-123b and gpt-4o show promise, they still struggle with completeness and soundness in call-graph analysis across both languages. In contrast, LLMs demonstrate a clear advantage in type inference for Python, surpassing traditional tools like HeaderGen and hybrid approaches such as HiTyper. These results suggest that, while LLMs hold promise in type inference, their limitations in call-graph analysis highlight the need for further research. Our study provides a foundation for integrating LLMs into static analysis workflows, offering insights into their strengths and current limitations.

TypeEvalPy: A Micro-benchmarking Framework for Python Type Inference Tools - Shivarpatna Venkatesh, Ashwin Prasad; Sabu, Samkutty; Wang, Jiawei; Mir, Amir M.; Li, Li; Bodden, Eric (Proceedings of the 2024 IEEE/ACM 46th International Conference on Software Engineering: Companion Proceedings)
In light of the growing interest in type inference research for Python, both researchers and practitioners require a standardized process to assess the performance of various type inference techniques. This paper introduces TypeEvalPy, a comprehensive micro-benchmarking framework for evaluating type inference tools. TypeEvalPy contains 154 code snippets with 845 type annotations across 18 categories that target various Python features. The framework manages the execution of containerized tools, transforms inferred types into a standardized format, and produces meaningful metrics for assessment. Through our analysis, we compare the performance of six type inference tools, highlighting their strengths and limitations. Our findings provide a foundation for further research and optimization in the domain of Python type inference.

The Emergence of Large Language Models in Static Analysis: A First Look through Micro-Benchmarks - Shivarpatna Venkatesh, Ashwin Prasad; Sabu, Samkutty; Mir, Amir M.; Reis, Sofia; Bodden, Eric (Proceedings of the 2024 IEEE/ACM First International Conference on AI Foundation Models and Software Engineering)

Enhancing Comprehension and Navigation in Jupyter Notebooks with Static Analysis - Shivarpatna Venkatesh, Ashwin Prasad; Wang, Jiawei; Li, Li; Bodden, Eric (IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER))

Enhancing Comprehension and Navigation in Jupyter Notebooks with Static Analysis - Shivarpatna Venkatesh, Ashwin Prasad; Wang, Jiawei; Li, Li; Bodden, Eric
Jupyter notebooks enable developers to interleave code snippets with rich-text and in-line visualizations. Data scientists use Jupyter notebook as the de-facto standard for creating and sharing machine-learning based solutions, primarily written in Python. Recent studies have demonstrated, however, that a large portion of Jupyter notebooks available on public platforms are undocumented and lacks a narrative structure. This reduces the readability of these notebooks. To address this shortcoming, this paper presents HeaderGen, a novel tool-based approach that automatically annotates code cells with categorical markdown headers based on a taxonomy of machine-learning operations, and classifies and displays function calls according to this taxonomy. For this functionality to be realized, HeaderGen enhances an existing call graph analysis in PyCG. To improve precision, HeaderGen extends PyCG's analysis with support for handling external library code and flow-sensitivity. The former is realized by facilitating the resolution of function return-types. Furthermore, HeaderGen uses type information to perform pattern matching on code syntax to annotate code cells. The evaluation on 15 real-world Jupyter notebooks from Kaggle shows that HeaderGen's underlying call graph analysis yields high accuracy (96.4% precision and 95.9% recall). This is because HeaderGen can resolve return-types of external libraries where existing type inference tools such as pytype (by Google), pyright (by Microsoft), and Jedi fall short. The header generation has a precision of 82.2% and a recall rate of 96.8% with regard to headers created manually by experts. In a user study, HeaderGen helps participants finish comprehension and navigation tasks faster. All participants clearly perceive HeaderGen as useful to their task.
Keywords: static analysis; python; code comprehension; annotation; literate programming; jupyter notebook

Automated Cell Header Generator for Jupyter Notebooks - Shivarpatna Venkatesh, Ashwin Prasad; Bodden, Eric (International Workshop on AI and Software Testing/Analysis (AISTA))

Dynamic Provisioning of Network Services on Heterogeneous Resources - Razzaghi Kouchaksaraei, Hadi; Shivarpatna Venkatesh, Ashwin Prasad; Churi, Amey; Illian, Marvin; Karl, Holger (European Conference on Networks and Communications (EUCNC 2020))

Security Implications Of Compiler Optimizations On Cryptography -- A Review - Shivarpatna Venkatesh, Ashwin Prasad; Handadi, A. Bhat; Mory, Martin (arXiv:1907.02530)
When implementing secure software, developers must ensure certain requirements, such as the erasure of secret data after its use and execution in real time. Such requirements are not explicitly captured by the C language and could potentially be violated by compiler optimizations. As a result, developers typically use indirect methods to hide their code's semantics from the compiler and avoid unwanted optimizations. However, such workarounds are not permanent solutions, as increasingly efficient compiler optimization causes code that was considered secure in the past now vulnerable. This paper is a literature review of (1) the security complications caused by compiler optimizations, (2) approaches used by developers to mitigate optimization problems, and (3) recent academic efforts towards enabling security engineers to communicate implicit security requirements to the compiler. In addition, we present a short study of six cryptographic libraries and how they approach the issue of ensuring security requirements. With this paper, we highlight the need for software developers and compiler designers to work together in order to design efficient systems for writing secure software.