Skip to main content
QUICK REVIEW

[论文解读] Large language models can be zero-shot anomaly detectors for time series?

Sarah Alnegheimish, Linh Nguyen|arXiv (Cornell University)|May 23, 2024
Topic ModelingComputer Science被引用 3
一句话总结

本文提出 SigLLM,一种框架,使大型语言模型(LLMs)能够通过零样本提示和预测实现时间序列数据中的异常检测。结果表明,通过基于预测的检测流程(Detector),LLMs 的表现优于传统方法,F1 分数显著高于直接提示方法,尽管仍比最先进深度学习模型低约 30%。

ABSTRACT

Recent studies have shown the ability of large language models to perform a variety of tasks, including time series forecasting. The flexible nature of these models allows them to be used for many applications. In this paper, we present a novel study of large language models used for the challenging task of time series anomaly detection. This problem entails two aspects novel for LLMs: the need for the model to identify part of the input sequence (or multiple parts) as anomalous; and the need for it to work with time series data rather than the traditional text input. We introduce sigllm, a framework for time series anomaly detection using large language models. Our framework includes a time-series-to-text conversion module, as well as end-to-end pipelines that prompt language models to perform time series anomaly detection. We investigate two paradigms for testing the abilities of large language models to perform the detection task. First, we present a prompt-based detection method that directly asks a language model to indicate which elements of the input are anomalies. Second, we leverage the forecasting capability of a large language model to guide the anomaly detection process. We evaluated our framework on 11 datasets spanning various sources and 10 pipelines. We show that the forecasting method significantly outperformed the prompting method in all 11 datasets with respect to the F1 score. Moreover, while large language models are capable of finding anomalies, state-of-the-art deep learning models are still superior in performance, achieving results 30% better than large language models.

研究动机与目标

  • 探究大型语言模型(LLMs)是否可在无需微调的情况下作为时间序列数据的零样本异常检测器。
  • 解决将为自然语言设计的 LLM 适配时间序列数据的挑战,该任务需要序列理解与异常定位能力。
  • 开发一种将时间序列转换为 LLM 友好的文本表示的框架,同时保留时间语义。
  • 比较两种不同范式:直接提示(Prompter)与基于预测的异常检测(Detector)。
  • 评估基于 LLM 的异常检测在实际应用中的可行性、成本与性能,相较于现有基线模型。

提出的方法

  • SigLLM 包含一个时间序列转文本的模块,将数值型时间序列转换为可逆的、描述性的字符串表示,适用于 LLM 输入。
  • Prompter 流程通过自然语言指令直接提示 LLM,识别输入序列中的异常段。
  • Detector 流程利用 LLM 的自回归预测能力,预测未来值,然后通过计算预测值与实际值之间的残差来检测异常。
  • 该框架支持与 OpenAI 和 HuggingFace 托管的 LLM 集成,实现无需模型微调的零样本推理。
  • 由于 LLM 上下文长度限制,采用滑动窗口处理长序列,尽管这会引入计算开销。
  • 后处理策略被识别为减少误报的关键,尤其是在 Prompter 方法中。
Figure 2: General principle of how machine learning models find anomalies in an unsupervised setting. Step 1: Apply a sequence of preprocessing operations and train a machine learning model to learn the pattern of the data. This is the most time-consuming step; Step 2: Use the trained model to gener
Figure 2: General principle of how machine learning models find anomalies in an unsupervised setting. Step 1: Apply a sequence of preprocessing operations and train a machine learning model to learn the pattern of the data. This is the most time-consuming step; Step 2: Use the trained model to gener

实验结果

研究问题

  • RQ1大型语言模型是否可在无需任何微调的零样本设置下检测时间序列数据中的异常?
  • RQ2基于提示与基于预测的 LLM 方法在时间序列异常检测中的性能表现如何比较?
  • RQ3LLMs 在性能上相对于最先进深度学习和经典异常检测模型是表现更优还是更差?
  • RQ4使用 LLM 进行时间序列异常检测的实际限制是什么,特别是在延迟和成本方面?
  • RQ5训练数据的记忆化如何影响基于 LLM 的异常检测,以及哪些缓解措施是有效的?

主要发现

  • 在评估的全部 11 个数据集上,基于预测的 Detector 方法比基于提示的 Prompter 方法在 F1 分数上高出 135%。
  • 使用 Detector 流程的 LLM 表现优于 Anomaly Transformer 模型,并超过移动平均基线模型。
  • 尽管零样本性能表现强劲,LLM 仍比最先进深度学习模型在 F1 分数上低约 30%。
  • Prompter 方法的平均推理成本为每条信号 1.69 美元,而 Detector 方法为每条信号 4.30 美元,表明计算成本更高。
  • Detector 的推理时间几乎是 Prompter 的两倍,离线设置下平均耗时在每条信号 30 至 120 分钟之间。
  • 研究发现,由于 LLM 上下文长度限制,必须使用滑动窗口,这限制了可扩展性和效率,尤其在多变量时间序列中。
Figure 3: Visualizing the output of large language models ( GPT and Mistral ) under different variations of the transformation process. Each row depicts the exchange-2_cpm_results signal from the AdEx dataset, where the x-axis shows the timestamp and the y-axis is the signal value. The first row ind
Figure 3: Visualizing the output of large language models ( GPT and Mistral ) under different variations of the transformation process. Each row depicts the exchange-2_cpm_results signal from the AdEx dataset, where the x-axis shows the timestamp and the y-axis is the signal value. The first row ind

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。