arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2508.08545cs.SEcs.AI
收藏

OmniLLP:基于上下文感知检索增强的LLM日志级别预测

OmniLLP: Enhancing LLM-based Log Level Prediction with Context-Aware Retrieval

Queen's University(皇后大学);ETS - Québec University(ETS-魁北克大学)

Youssef Esseddiq Ouatiti, Mohammed Sayagh, Bram Adams, Ahmed E. Hassan

AI总结:

针对LLM日志级别预测器依赖随机上下文示例的问题,提出OmniLLP框架,通过结合代码语义相似性和开发者所有权凝聚力进行聚类检索上下文示例,显著提升了预测准确率(AUC达0.88-0.96)。

摘要:

开发人员在源代码中插入日志语句,以捕获与维护和调试活动相关的关键运行时信息。日志级别的选择是日志活动中不可或缺但又棘手的一环,因为它控制着日志的冗长度,进而影响系统的可观测性和性能。近期基于机器学习的日志级别预测研究利用大型语言模型(LLMs)构建日志级别预测器(LLPs),展现出良好的性能提升(AUC在0.64到0.8之间)。然而,当前基于LLM的LLP依赖于随机选择的上下文示例,忽略了现代软件项目中的结构特征和多样化的日志实践。本文提出了一种新颖的LLP增强框架OmniLLP,该框架基于(1)反映代码功能目的的语义相似性,以及(2)开发者所有权凝聚力对源文件进行聚类。通过仅从这些具备语义和所有权感知的聚类中检索上下文学习示例,我们旨在为利用LLM的LLP提供更连贯的提示,从而提高其预测准确性。结果显示,与随机预测器(即从整个项目中随机选择上下文示例)相比,语义和所有权感知聚类在统计学上显著提升了所评估的基于LLM的LLP的准确性(AUC最高提升8%)。此外,我们将语义与所有权信号相结合用于上下文预测的方法,在所有评估项目中取得了0.88到0.96的出色AUC。我们的发现凸显了将软件工程特定上下文(如代码语义和开发者所有权信号)整合到LLM-LLP中的价值,为开发者提供了一种更准确、具备上下文感知能力的日志记录方法,从而增强了系统的可维护性和可观测性。

英文摘要:

Developers insert logging statements in source code to capture relevant runtime information essential for maintenance and debugging activities. Log level choice is an integral, yet tricky part of the logging activity as it controls log verbosity and therefore influences systems' observability and performance. Recent advances in ML-based log level prediction have leveraged large language models (LLMs) to propose log level predictors (LLPs) that demonstrated promising performance improvements (AUC between 0.64 and 0.8). Nevertheless, current LLM-based LLPs rely on randomly selected in-context examples, overlooking the structure and the diverse logging practices within modern software projects. In this paper, we propose OmniLLP, a novel LLP enhancement framework that clusters source files based on (1) semantic similarity reflecting the code's functional purpose, and (2) developer ownership cohesion. By retrieving in-context learning examples exclusively from these semantic and ownership aware clusters, we aim to provide more coherent prompts to LLPs leveraging LLMs, thereby improving their predictive accuracy. Our results show that both semantic and ownership-aware clusterings statistically significantly improve the accuracy (by up to 8\% AUC) of the evaluated LLM-based LLPs compared to random predictors (i.e., leveraging randomly selected in-context examples from the whole project). Additionally, our approach that combines the semantic and ownership signal for in-context prediction achieves an impressive 0.88 to 0.96 AUC across our evaluated projects. Our findings highlight the value of integrating software engineering-specific context, such as code semantic and developer ownership signals into LLM-LLPs, offering developers a more accurate, contextually-aware approach to logging and therefore, enhancing system maintainability and observability.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑