[论文解读] Interpretable Online Log Analysis Using Large Language Models with Prompt Strategies
本文提出 LogPrompt,一种新颖的可解释性在线日志分析框架,利用大型语言模型(LLMs)结合先进的提示策略——自提示、思维链和上下文提示——在无需领域微调的情况下,实现了日志解析与异常检测的最先进性能。LogPrompt 通过高级提示策略使 LLM 性能最高提升 380.7%,相比现有方法在数千条日志上微调的模型,性能最高提升 55.9%,同时生成的人工评分解释具有高度可读性与实用性(4.42/5)。
Automated log analysis is crucial in modern software-intensive systems for facilitating program comprehension throughout software maintenance and engineering life cycles. Existing methods perform tasks such as log parsing and log anomaly detection by providing a single prediction value without interpretation. However, given the increasing volume of system events, the limited interpretability of analysis results hinders analysts' comprehension of program status and their ability to take appropriate actions. Moreover, these methods require substantial in-domain training data, and their performance declines sharply (by up to 62.5%) in online scenarios involving unseen logs from new domains, a common occurrence due to rapid software updates. In this paper, we propose LogPrompt, a novel interpretable log analysis approach for online scenarios. LogPrompt employs large language models (LLMs) to perform online log analysis tasks via a suite of advanced prompt strategies tailored for log tasks, which enhances LLMs' performance by up to 380.7% compared with simple prompts. Experiments on nine publicly available evaluation datasets across two tasks demonstrate that LogPrompt, despite requiring no in-domain training, outperforms existing approaches trained on thousands of logs by up to 55.9%. We also conduct a human evaluation of LogPrompt's interpretability, with six practitioners possessing over 10 years of experience, who highly rated the generated content in terms of usefulness and readability (averagely 4.42/5). LogPrompt also exhibits remarkable compatibility with open-source and smaller-scale LLMs, making it flexible for practical deployment. Code of LogPrompt is available at https://github.com/lunyiliu/LogPrompt.
研究动机与目标
- 解决自动化日志分析中可解释性有限的问题,现有方法仅提供预测结果而无解释依据。
- 克服日志分析模型在在线场景中因新领域中日志稀缺或未见而导致的性能下降问题。
- 开发一种高度自适应的零样本日志分析方法,消除对领域微调的需求,实现新服务的即时部署。
- 通过生成人类可读且具备逻辑依据的解释,提升程序理解与运维决策能力。
- 通过经验丰富的实践者进行严格的人工评估,验证基于 LLM 的日志分析在有效性与可解释性方面的表现。
提出的方法
- 采用三种专用提示策略:自提示(自动生成任务描述)、思维链(分步推理)和上下文提示(少样本示范),引导 LLM 完成日志分析任务。
- 将提示策略应用于日志解析与日志异常检测任务,使 LLM 能够提取模板与变量,或对日志进行正常/异常分类。
- 设计一种提示工程流水线,根据日志内容与任务需求动态构建上下文感知的提示。
- 采用零样本推理方式使用 LLM,避免任何领域微调,确保对新领域与未见日志类型的适应能力。
- 通过结构化提示引导 LLM 生成逻辑严谨且语义清晰的解释。
- 通过优化提示设计以提升效率与性能,确保与开源及小规模 LLM 的兼容性。
实验结果
研究问题
- RQ1在无需领域微调的情况下,高级提示策略是否能显著提升 LLM 在日志解析与异常检测中的性能?
- RQ2基于 LLM 的日志分析模型在包含新领域未见日志的在线场景中,其泛化能力如何?
- RQ3生成的解释在提升可解释性与支持经验丰富的运维工程师程序理解方面有多有效?
- RQ4如思维链与上下文学习等提示工程策略,是否能提升 LLM 在日志分析中预测的可靠性与可追溯性?
- RQ5在真实运维场景中,LLM 生成解释的可解释性与传统黑箱日志分析模型相比如何?
主要发现
- LogPrompt 在日志解析与异常检测任务中均达到最先进性能,相比在数千条领域内日志上训练的现有方法,性能最高提升 55.9%。
- 与简单提示相比,使用高级提示策略后,LLM 在日志分析中的性能最高提升 380.7%。
- 六位经验丰富的实践者参与的人工评估显示,LogPrompt 生成的解释具有高度实用性与可读性,平均得分为 4.42/5。
- LogPrompt 在在线场景中展现出强大的泛化能力,即使在无领域训练数据的情况下仍能保持高精度。
- 该方法与开源及小规模 LLM 兼容,可在多样化的基础设施环境中实现实际部署。
- 研究证实,通过生成解释实现的可解释性显著提升了运维决策能力,包括根本原因分析与误报检测。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。