LLM4TS
00 分钟
2024-4-10

Position Paper

Position Paper: What Can Large Language Models Tell Us about Time Series Analysis
notion image
感觉这篇position paper挺水的,也就是说明了LLMs在当下处理TS时出现的问题
  • LLM的在time series中的作用
    • notion image
      1. 【通过增加外部知识来数据增强】as effective data and model enhancers, augmenting time series data and existing approaches with enhanced external knowledge and analytical prowess;
      1. 【使用推理能力来完成预测任务】as superior predictors, utilizing their extensive internal knowledge and emerging reasoning abilities to benefit a range of prediction tasks;
      1. 【作为agent】as next-generation agents, transcending conventional roles to actively engage in and transform time series analysis.
  • 时间序列分析问题
    • 主要的分析信息 inter-temporal and/or inter-variable relationships in time series
    • 解决 forecasting, classification, anomaly detection, and imputation 的问题
    • 经历了四个阶段
        1. statistical models:从stationarity and seasonality信息中得到启发
        1. deep neural networks:极度依赖于先验知识来捕捉non-linear and long-term dependencies
        1. pre-trained models:通过diverse, large-scale time series data进行训练,解决复杂问题
        1. LLM-centric models:能够用于general question answering, interpretable predictions, and complex reasoning
  • LLM-assisted Enhancer for Time Series
    • data-based enhancer:增加数据的解释性,同时也可以提供多样的辅助数据进行理解(enriching time series data context and improving model robustness)
    • model-based enhancer:使用对比学习、prompt engineering的方式,获取external knowledge and domain-specific contexts
    • 劣势:需要一个efficient, accountable, and universally adaptable plug-and-play solutions
  • LLM-centered Predictor for Time Series
    • outperforming most domain-specific models in few-shot and zero-shot scenarios,但是没有利用好in-context learningchain-of-thought reasoning
      notion image
    • Tuning-Based Predictor
      • notion image
        使用FPT等技术可以融合time-series(需要使用lightweight adaptation layers来encode)和text的信息,但是 modifications that disrupt the parameters of the original LLMs, potentially leading to catastrophic forgetting
    • Non-Tuning-Based Predictor
      • notion image
        LLM tokenizers, not designed for numerical values(LLM的tokenizer不适合处理连续数值变量,很难捕捉数值中的关联),在LLMTime中有专门设置tokenizer来解决这个问题
    • Others
      • 重新搭建模型进行训练,适用于特定的用途
  • LLM-empowered Agent for Time Series
    • 上述办法牺牲了LLMs的interactive capabilities,这个功能能够使得LLM当作agent,通过prompt engineering来解决TS中的问题
      可以很好的理解common-sense behaviors,更好的提供interpretation和truthfulness;但是对于复杂的patterns理解不够
      【未来研究方向】
      notion image
      1. 将TS上的features与语言(linguistic)上的元素进行对齐,使得LLM有更好的表征
      1. 将text embedding与TS features更好的融合,以充分适应LLM的长处
      1. 告知LLMs使用提前训练好的TS models来辅助解决问题(用户交互层面上)
  • LLM agent的其他研究道路
    • Hallucination Problem(幻觉)
      • 目前的解决方案包括两种:
        1. 定义到reliable的prompts
        1. 依靠dependable 指导数据集对模型进行微调
        需要设计有效的prompt格式来完成TSA任务
    • Alignment with Human
      • 需要让agent不断地获取新的数据来更新自己的知识库

TIME-LLM [ICLR’ 24]

  • LLM用于预测任务的优势:Generalizability(capabilities for few-shot/one-shot task),Data efficiency(when historical data is limited),Reasoning(innate reasoning),Multimodal knowledge(联合多个知识库),Easy optimization(训练一次,不用调整超参)
  • 优势在于不直接编辑输入TS成相应的输入format,也不对LLM的backbone进行finetune
notion image
  • input transformation
      1. 将多个相关联的TS拆分成独立的TS进行处理
      1. 每个TS都需要使用RevIN来实现instance normalization,来mitigate TS distribution shift
      1. 将每个TS划分成为长度为的,水平stride为的(不)重叠的patches(获得local semantic information&reducing computational burdens)
        1. notion image
      1. 将这些Patch映射到维度
  • Patch Reprogramming(将TS转化成NLP)
    • notion image
      text prototypes中只有少数发挥作用,与描述TS的词高度相关,patch需要由不同的prototypes来表示
      text prototypes中只有少数发挥作用,与描述TS的词高度相关,patch需要由不同的prototypes来表示
    • 背景:目的是使得TS与NLP对齐
      • 实现模态迁移的常用方法是对于input samples加噪(对噪声处理),使得不需要修改参数以完成任务迁移。(但这是需要两个模态之间有explicit&learnable transformations,允许直接编辑input的形式,如声学→TS,cross-domain images)
    • 想到将TS映射到pre-trained word embeddings
      • 考虑到词汇表太大,故只取一小部分(与时间有关的描述)形成pre-trained prototype,再结合形成一些定义好的patch
        再使用多头交叉注意力机制来构成之间的关系
        notion image
        之后再通过线性映射到hidden dimension中输入的维度
  • Prompt-as-Prefix
    • notion image
      第一种会以自然语言的形式输出预测值0.6,但(1)LLM处理高精度数字时敏感度低,不能进行长时间预测;(2)LLM的training dataset不同,需要对于数字的呈现进行定制化处理
      notion image
      第二种(prompt-as-prefix)包括dataset context(基本信息),task instruction(对于patch embedding在特定任务上的转化),input statistics(如trends&lags促进模型推理)
  • pre-trained and frozen LLM【frozen】
    • Llama和GPT-2是embedding-visible LM,这里默认使用Llama-7B
      the backbone language model remains intact
  • output projection
    • 丢弃前缀部分,得到输出表示,flatten+linear project得到最终预测
  • 实验
    • notion image
    • setteing用的thuml中的库
    • cite了【NIPS‘23】One fits all: Power general time series analysis by pretrained LM(GPT4TS)的结果
    • 还会包括few-shot forecasting(只使用前5%或10%的数据进行训练)
  • 不足:
      1. dataset description并不总是有效的
      1. patching operation将TS分割时会丧失对于subtle variation的表达性

STG-LLM

哈?就是将时序信息融合了一下,用了encoder-decoder的架构来解决问题,他空间数据的保留是一点(具体实现)也没提到啊,就只说了下面,这里的relationship是如何捕捉的?
In this way, each token contains complete temporal semantic information, and the relationship between tokens can accurately express the spatial semantic information.
对于处理Electricity这样的没有图结构的数据集效果更好(有图结构的比不过PDFormer),感觉是它并没有捕捉到图结构
Different from existing methods, STG-LLM can achieve superior performance without prior knowledge (predefined graph structure, DTW matrix, Kshape clus-tering, etc.) and complex model design, which shows STG-LLM’s strong ability to capture spatial-temporal dependencies
  • Spatial-Temporal Graph Tokenizer
    • 有原始输入:以及text optional promp
    • 通过LLM的tokenizer后可以产生表示L个时间点
    • 同时,在time-of-the-day和day-of-the-week提取的,之后得到最后tshi'ke时刻的
    • 最后将这些信息concat起来,形成token输入LLM:
  • Spatial-Temporal Graph Adapter
    • 就是线性的encoder-decoder
    • 映射到维度,使得token的维度与LLM的一致,也可以在一定程度上可以捕获令牌内时间的semantics:
    • LLM的输入:
    • LLM的输出:
    • 之后使用从而获得后P步的预测值
  • 使用GPT-2作为LLM的底座
notion image
结果是不如精心设计的PDFormer的

ST-LLM [ICLR’ 24 rejected]

FPT(pretrained transformer)对于处理长时间预测有不足【FFN+MHA都是冻结的】 PFA(partially frozen attention)专门设计用于traffic prediction【前面与FPT相同,后面解冻MHA】
notion image
前面的feed forward layer被frozen之后可以保存pretrained knowledge;后面的multi-head attention unfrozen可以增强对于spatial-temporal dependencies的捕获。
  • Spatial-Temporal Embedding and Fusion
    • notion image
      【input】现有原始输入
      【historical P timesteps】使用pointwise convolution将其转化为
      【temporal】使用linear layer将day,week的数据编码为,将两者求和有
      【spatial】使用adaptive(就是带激活函数的)将input转化为
      notion image
      最后使用fusion convolution模块将此类embedding都融合,得到
      notion image
  • Partially Frozen Attention (PFA) LLM
    • notion image
    • 前面同FPT,后面将multi-head attention部分解冻,以捕捉时空依赖性(?)
    • 在前F层中有如下的信息传递
      • 表示第i层的中间表示,表示第i层的最终表示
        notion image
    • 在后U层中有如下
      • notion image
    • 最后将通过regression convolution,对于后S timesteps的Y进行预测
notion image

SSIP-LLM

semantic space informed prompt learning with LLM
将语义空间与TS embedding space对齐
notion image
  • Time Series Tokenization
    • 使用Seasonal Trend decomposition using Loess (STL)将TS分解成为long-term trend & seasonal & residual component
      之后使用RevIN对三个数据进行归一化处理
      notion image
      转化成patched tokens,之后将三者concat再project到
  • Semantic Space Informed Prompting
    • notion image
      之前是有template-based andfixed prompts来处理TS,本文提出了从semantic space的角度来看这个问题。(不是word embedding)
      这就是TIME-LLM的word prototypes,都是对原始的word embedding 进行mapping的操作得到一个较小的集合,这里叫做semantic anchors;之后Time-LLM使用attention的方法将TS融合到prototypes中
      使用余弦相似度的方式获取与最接近的k个semantic anchors embedding,并将其作为prefix来增强输入
      notion image
  • Backbone and Fine-tuning Strategy
    • 使用GPT-2作为LLM backbone进行处理
      仅仅对positional embedding layer和layer-normalization laye进行finetune
notion image

ClusterLLM [EMNLP’23]

CCF-B conference
notion image
直接使用API则无法接触到embedding,从而实现聚类,但可以考虑将LLM作为guide对于聚类进行指引
 
notion image
  • 分成了两个层面:perspective:grouping criterion (i.e. topic, intent, emotion);granularity:scope of clusters
  • 使用triplet questions 来查看两个候选项中哪个与anchor instance更接近:<does A better correspond to B than C>
  • Triplet Task for Perspective
    • 构建一个的包含三个句子元组,使用prompt LLM选取中与更接近的部分,prompt由task instruction与构成
      notion image
      1. 通过entropy找到most ambiguous instance作为anchors【粒度未知】
        1. notion image
          使用instancewise soft assignment来为该概率分布赋值
      1. 对于每一个anchor从其最接近的两个集群中抽取两个
        1. 从K个最接近的中随机取两个sentence

Ideas?

  1. 将空间信息以另一种方式整合进去,以提升LLM的性能(不是单纯的输入各样[day,week]的temporal的信息;可以考虑研究另一种reprogram的方法;或是使用图的思路,将adj_matrix看作一张image(inspired by Timesnet)?)
    1. backbone or data argumentation(蒸馏器)
  1. Kriging本质也是需要使用周围的node来对其进行imputation,然后在KCP中也可以看到说有聚类的这么一个操作,或许可以考虑借助GPT从语言层面上进行聚类,再进行进一步的特征提取(参考Cluster-LLM)【找到更好的语义邻居】
  1. 对于few-shot来说,LLM占据优势,想到KITS中节点alpha=0.5,而常规的节点说不定可以设置成10%-15%,应验到few-shot;当然 也可以考虑zero-shot的迁移实验(但需要考虑adj的调整问题)
  1. [S2IP-LLM]中有提到patching operation将TS分割时会丧失对于subtle variation的表达性,故现有的方法时从day&week的角度聚合temporal,或采用STL将TS分解为seasonal/trend/residual,是否可以考虑使用之前的如基于FFT的方法提取时序特征【目的应该是学到unobserved的时序特征】

Waiting List

GATGPT: A Pre-trained Large Language Model with Graph Attention Network for Spatiotemporal Imputation(LLM for imputation but overlooks the temporal representation)

Notes

  1. 现有的CV、多模态的LM一般是需要使用paired cross-modality来辅助调整
  1. 现有的方法中attention-based可以不使用adj就可以建模动态空间的相关性(取代了排列不变、局部联通、组合的GCN-based)

评论
Loading...