Login | Register

Automated File-Level Logging Generation for Machine Learning Applications using LLMs: A Case Study using GPT-4o Mini

Title:

Automated File-Level Logging Generation for Machine Learning Applications using LLMs: A Case Study using GPT-4o Mini

Ruiz Rodriguez, Mayra Sofia (2025) Automated File-Level Logging Generation for Machine Learning Applications using LLMs: A Case Study using GPT-4o Mini. Masters thesis, Concordia University.

[thumbnail of RuizRodriguez_MASc_S2026.pdf]
Preview
Text (application/pdf)
RuizRodriguez_MASc_S2026.pdf - Accepted Version
Available under License Spectrum Terms of Access.
576kB

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 and log level, variables, and text quality of the generated logs compared to human-written logs. In addition, we manually analyzed a representative sample of generated logs to identify common patterns and challenges.

We find that the LLM introduces logs in the same place as humans in 63.91% of cases, but at the cost of a high overlogging rate of 82.66%. Furthermore, our manual analysis reveals challenges for file-level logging, which shows overlogging at the beginning or end of a function, difficulty logging within large code blocks, and misalignment with project-specific logging conventions. While the LLM shows promise for generating logs for complete files, these limitations remain to be addressed for practical implementation.

Divisions:Concordia University > Gina Cody School of Engineering and Computer Science > Computer Science and Software Engineering
Item Type:Thesis (Masters)
Authors:Ruiz Rodriguez, Mayra Sofia
Institution:Concordia University
Degree Name:M.A. Sc.
Program:Software Engineering
Date:June 2025
Thesis Supervisor(s):Shihab, Emad
ID Code:995928
Deposited By: Mayra Sofia Ruiz Rodriguez
Deposited On:04 Nov 2025 18:23
Last Modified:04 Nov 2025 18:23
All items in Spectrum are protected by copyright, with all rights reserved. The use of items is governed by Spectrum's terms of access.

Repository Staff Only: item control page

Downloads per month over past year

Research related to the current document (at the CORE website)
- Research related to the current document (at the CORE website)
Back to top Back to top