OmniLLP: Enhancing LLM-based Log Level Prediction with Context-Aware Retrieval
作者: Youssef Esseddiq Ouatiti, Mohammed Sayagh, Bram Adams, Ahmed E. Hassan
分类: cs.SE, cs.AI
发布日期: 2025-08-12
💡 一句话要点
提出OmniLLP以提升基于LLM的日志级别预测准确性
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 日志级别预测 大语言模型 语义聚类 开发者所有权 机器学习 软件工程 上下文学习
📋 核心要点
- 现有的基于LLM的日志级别预测方法依赖随机选择的上下文示例,忽视了代码的语义结构和开发者的所有权信息。
- 本文提出OmniLLP框架,通过语义相似性和开发者所有权聚类源文件,优化上下文学习示例的选择,以提高预测准确性。
- 实验结果显示,采用语义和所有权聚类的OmniLLP在多个项目中AUC值提升至0.88至0.96,相较于随机选择示例提高了8%。
📝 摘要(中文)
开发者在源代码中插入日志语句,以捕获维护和调试活动所需的运行时信息。日志级别的选择是日志活动中一个重要但复杂的部分,因为它控制日志的详细程度,从而影响系统的可观察性和性能。尽管基于机器学习的日志级别预测已经取得了一定进展,但现有方法往往依赖随机选择的上下文示例,忽视了现代软件项目中的结构和多样化的日志实践。本文提出了OmniLLP,一个新的日志级别预测增强框架,通过基于语义相似性和开发者所有权聚类源文件,提供更连贯的上下文学习示例,从而提高预测准确性。实验结果表明,所提出的方法在多个项目中显著提升了预测准确性,AUC值达到0.88至0.96。
🔬 方法详解
问题定义:本文旨在解决现有基于LLM的日志级别预测方法中,随机选择上下文示例导致的准确性不足问题。现有方法未能充分利用代码的语义信息和开发者的所有权信号。
核心思路:OmniLLP通过对源文件进行聚类,基于语义相似性和开发者所有权信息,提供更具连贯性的上下文学习示例,从而提升预测的准确性。这样的设计旨在增强模型对特定上下文的理解能力。
技术框架:OmniLLP的整体架构包括两个主要模块:1) 语义聚类模块,通过分析代码的功能目的进行聚类;2) 所有权聚类模块,基于开发者的所有权信息进行聚类。最终,模型从这些聚类中提取上下文示例进行学习。
关键创新:OmniLLP的创新之处在于结合了语义和所有权信号进行聚类,显著提高了日志级别预测的准确性。这一方法与现有随机选择示例的方式有本质区别,后者未能考虑上下文的相关性。
关键设计:在模型训练过程中,采用了特定的损失函数以优化聚类效果,并通过交叉验证选择最佳的聚类参数设置。模型结构方面,利用了先进的LLM架构,以确保能够有效处理复杂的上下文信息。
📊 实验亮点
实验结果表明,OmniLLP在多个项目中实现了0.88至0.96的AUC值,相较于随机选择示例的基线,准确性提升幅度达到8%。这一显著提升验证了语义和所有权聚类在日志级别预测中的有效性。
🎯 应用场景
OmniLLP的研究成果在软件开发和维护领域具有广泛的应用潜力,尤其是在需要高可观察性和可维护性的系统中。通过提供更准确的日志级别预测,开发者能够更有效地进行调试和维护,从而提升软件质量和系统性能。未来,该方法还可以扩展到其他领域,如自动化测试和故障检测。
📄 摘要(原文)
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.