Automated File-Level Logging Generation for Machine Learning Applications using LLMs: A Case Study using GPT-4o Mini
Mayra Sofia Ruiz Rodriguez, SayedHassan Khatoonabadi, Emad Shihab

TL;DR
This study evaluates GPT-4o mini's ability to generate file-level log statements in machine learning Python projects, highlighting its potential and current limitations such as overlogging and misalignment with conventions.
Contribution
It is the first to systematically assess LLMs for file-level logging in ML applications, revealing both capabilities and challenges.
Findings
Logs placed similarly to humans in 63.91% of cases
High overlogging rate of 82.66%
Challenges include overlogging at function boundaries and misalignment with conventions
Abstract
Logging is essential in software development, helping developers monitor system behavior and aiding in debugging applications. Given the ability of large language models (LLMs) to generate natural language and code, researchers are exploring their potential to generate log statements. However, prior work focuses on evaluating logs introduced in code functions, leaving file-level log generation underexplored -- especially in machine learning (ML) applications, where comprehensive logging can enhance reliability. In this study, we evaluate the capacity of GPT-4o mini as a case study to generate log statements for ML projects at file level. We gathered a set of 171 ML repositories containing 4,073 Python files with at least one log statement. We identified and removed the original logs from the files, prompted the LLM to generate logs for them, and evaluated both the position of the logs…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
