10 분 소요

0. Introduction

Paper link

TimesFM은 시계열 예측을 LLM처럼 다루려는 논문이지만, 단순히 텍스트 LLM을 시계열에 가져다 붙인 논문은 아니다. 이 논문이 흥미로운 이유는 시계열 foundation model을 만들 때 무엇을 token으로 볼 것인지, decoder-only training을 어떤 식으로 유지할 것인지, 그리고 horizon이 정해져 있지 않은 zero-shot forecasting에서 autoregressive decoding을 어떻게 줄일 것인지를 꽤 명확하게 설계했기 때문이다.

기존 time-series forecasting은 대체로 두 방향이었다. 하나는 ARIMA, ETS, Prophet 같은 local model을 각 series에 맞게 fit하는 방식이고, 다른 하나는 DeepAR, N-BEATS, PatchTST, TiDE 같은 deep model을 특정 dataset이나 domain에 맞춰 train하는 방식이다. TimesFM은 이 사이에서 다른 질문을 던진다. 충분히 다양한 time-series corpus로 미리 학습한 단일 모델이, 처음 보는 domain과 granularity에서도 바로 쓸 만한 forecast를 낼 수 있는가.

한 줄 요약: TimesFM은 시계열을 contiguous patch 단위의 token으로 바꾸고, decoder-only causal Transformer가 다음 patch를 예측하도록 pretrain해, 다양한 context length, horizon length, temporal granularity에서 zero-shot forecasting을 가능하게 하려는 time-series foundation model이다.

이 논문을 지금 볼 가치가 있는 이유는 다음과 같음.

  • Forecasting이 task-specific supervised model에서 reusable foundation model로 이동할 수 있는지 보여주는 초기 기준점이다.
  • LLM식 decoder-only 구조를 그대로 복사하지 않고, input patch length와 output patch length를 다르게 두는 식으로 시계열에 맞게 변형한다.
  • Synthetic data, public real-world data, patch masking, per-series normalization, context tuning 같은 실무적 recipe가 비교적 명확하게 나온다.

이 논문의 핵심 메시지는 단순하다. 시계열 foundation model의 본질은 거대한 Transformer가 아니라, forecasting에 맞는 tokenization과 decoding unit을 어떻게 정의하는가에 있다. TimesFM은 patch를 token으로 쓰되, language model처럼 한 token씩 생성하지 않고 긴 output patch를 예측함으로써 forecasting task의 horizon 구조를 반영한다.

1. Problem Setting

1-1. Problem definition

  • 이 논문이 겨냥하는 문제는 general purpose zero-shot forecaster를 만드는 것이다.
  • 입력은 과거 time-series context이고, 출력은 future horizon이다.
  • 핵심 목표는 특정 dataset에 맞춰 새로 train하지 않고, 미리 학습된 단일 모델이 처음 보는 time-series에 대해 바로 forecast를 생성하는 것이다.
  • 논문은 task를 대략 다음처럼 본다.
\[context x[1:t] -> forecast x[t+1:t+h]\]
  • 여기서 어려운 점은 $t$와 $h$가 고정되어 있지 않다는 것이다.
  • Forecasting dataset마다 context length, prediction horizon, sampling frequency, scale, seasonality가 모두 다르다.
  • TimesFM은 이 다양성을 하나의 pretrained model이 흡수할 수 있는지 검증한다.

1-2. Why previous approaches are insufficient

  • Local statistical model은 각 series에 fit해야 하므로 대량의 heterogeneous dataset을 한 번에 다루는 foundation model 관점과 거리가 있다.
  • Global supervised model은 여러 series를 함께 학습하지만, 보통 특정 dataset이나 domain에 맞춘 training cycle이 필요하다.
  • PatchTST나 N-BEATS는 transfer 가능성을 보여줬지만, 논문 기준으로는 수많은 dataset에 out-of-the-box로 적용되는 단일 pretrained model을 목표로 하지는 않았다.
  • GPT-3, LLaMA 계열 LLM을 prompt로 time-series forecaster처럼 쓰는 접근은 흥미롭지만, numeric sequence를 text로 serialize해야 하고 cost가 크며, time-series 전용 inductive bias가 부족하다.
  • TimeGPT-1은 유사한 방향의 parallel work로 언급되지만, 당시 논문 기준으로 모델과 benchmark 세부가 공개되지 않았다.

결국 이 논문의 문제 설정은 시계열 예측에도 pretraining과 zero-shot generalization이 작동하는가이다. 그리고 더 구체적으로는, 그것을 LLM reuse가 아니라 time-series-native Transformer로 풀 수 있는가에 가깝다.

2. Core Idea

2-1. Main contribution

TimesFM의 핵심 기여는 세 가지로 정리할 수 있다.

  • 첫째, Google Trends, Wiki Pageviews, public forecasting datasets, synthetic time-series를 섞어 대규모 pretraining corpus를 만든다.
  • 둘째, time-series를 contiguous non-overlapping patch로 나누고, patch를 Transformer token처럼 다루는 decoder-only architecture를 설계한다.
  • 셋째, input patch보다 긴 output patch를 예측해 long-horizon forecasting에서 autoregressive decoding step을 줄인다.

이 논문에서 중요한 점은 LLM을 그대로 가져오는 것이 아니라, 시계열의 연속값 구조에 맞게 token interface를 새로 정의했다는 것이다. Text에서는 token이 discrete subword지만, TimesFM에서는 patch가 하나의 token이다. Patch는 residual MLP block을 거쳐 model dimension으로 projection되고, Transformer는 causal attention으로 과거 patch만 본다.

2-2. Design intuition

TimesFM의 설계 직관은 꽤 좋다.

  • Forecasting model은 다양한 context length를 받아야 한다.
  • Forecasting model은 다양한 horizon length를 생성해야 한다.
  • Forecasting model은 hourly, daily, weekly, monthly처럼 다른 granularity에도 버텨야 한다.
  • 그래서 full sequence를 한 번에 encoder로 넣고 fixed horizon을 내는 방식보다, patch-level autoregressive decoder가 더 flexible하다.

하지만 LLM식 token-by-token generation을 그대로 쓰면 long-horizon forecasting에서 error accumulation이 커진다. 그래서 TimesFM은 input patch length와 output patch length를 분리한다. 예를 들어 input patch length가 32이고 output patch length가 128이면, 256 step horizon을 예측할 때 32-step 단위로 8번 생성하는 대신 128-step 단위로 2번 생성할 수 있다.

내가 보기엔 이 부분이 이 논문의 가장 중요한 설계다. TimesFM은 decoder-only 구조를 유지하면서도 forecasting에 필요한 chunky decoding을 넣는다. 즉 architecture family는 LLM과 비슷하지만, generation granularity는 time-series forecasting에 맞춰 바꾼다.

3. Architecture / Method

3-1. Overview

Item Description
Model name TimesFM
Goal General purpose zero-shot time-series forecaster
Backbone Decoder-only causal Transformer
Token unit Contiguous non-overlapping time-series patch
Key design Input patch length and output patch length can differ
Main output Point forecast in the paper setting
Main scale 200M parameter model

3-2. Module breakdown

1) Patch as time-series token

  • 입력 time-series는 contiguous non-overlapping patch로 나뉜다.
  • 각 patch는 residual MLP block을 통해 model dimension vector로 변환된다.
  • 여기에 positional encoding이 더해지고 Transformer input token이 된다.
  • 이 설계는 두 가지 효과를 가진다.
    • Sequence length가 patch length만큼 줄어들어 attention cost가 감소한다.
    • 연속값 time-series를 discrete token처럼 다룰 수 있는 interface가 생긴다.

Patch는 이 논문에서 vocabulary의 대체물이다. NLP에 subword token이 있다면, TimesFM에는 fixed-length numeric patch가 있다.

2) Decoder-only causal Transformer

  • TimesFM은 encoder-decoder가 아니라 decoder-only 구조를 사용한다.
  • 각 output token은 causal attention을 통해 자기 자신과 과거 token만 볼 수 있다.
  • 학습 시에는 모든 patch position에서 다음 output patch를 예측하도록 parallel training이 가능하다.
  • 이 점은 LLM pretraining과 유사하다.
  • 다만 target은 next subword가 아니라 future time window다.

이 선택의 장점은 inference flexibility다. 모델이 어떤 context length를 봤든, 그 다음 horizon을 patch 단위로 autoregressive하게 늘려 갈 수 있다.

3) Longer output patch

  • 일반 LLM은 한 token씩 생성한다.
  • TimesFM은 한 input patch를 읽고 더 긴 output patch를 예측할 수 있게 한다.
  • 논문 메인 200M 모델 기준 input patch length는 32, output patch length는 128이다.
  • 이 구조는 horizon이 길 때 decoding step 수를 줄인다.
  • 예를 들어 256 step horizon은 128 step output patch를 두 번 생성하면 된다.

이것은 단순 speed trick이 아니다. Forecasting에서는 one-step autoregressive decoding보다 horizon chunk를 직접 예측하는 방식이 더 안정적인 경우가 많다. TimesFM은 foundation model의 variable horizon 요구와 long-horizon forecasting의 direct prediction 성향 사이에서 middle ground를 잡는다.

4) Patch masking for arbitrary context length

  • Patch만 사용하면 모델이 patch boundary에 맞는 context length에만 익숙해질 수 있다.
  • TimesFM은 training 중 첫 input patch 일부를 random masking한다.
  • 또한 완전히 masked-out된 patch는 causal self-attention에서 제외한다.
  • 이 전략을 통해 모델은 1부터 maximum context length까지 다양한 context length를 보게 된다.

이 부분은 작지만 중요하다. Production forecasting에서는 사용 가능한 history length가 dataset마다 다르다. Patch boundary에만 맞는 model은 zero-shot forecaster로 쓰기 어렵다.

5) Loss and output head

  • 논문 본문은 point forecasting에 초점을 둔다.
  • 학습 loss는 MSE 계열 point forecasting loss로 설명된다.
  • 저자들은 quantile loss나 likelihood loss를 붙여 probabilistic forecasting으로 확장할 수 있다고 언급하지만, 논문 메인 실험의 초점은 아니다.

즉 TimesFM paper의 core claim은 calibrated probabilistic forecaster가 아니라, single pretrained point forecaster의 zero-shot generalization이다.

4. Training / Data / Recipe

4-1. Data

TimesFM의 pretraining corpus는 크게 real-world data와 synthetic data로 구성된다.

Source Key detail
Google Trends 약 22k head queries, hourly, daily, weekly, monthly granularity
Wiki Pageviews Jan. 2012 to Nov. 2023 pageview data, hourly to monthly aggregation
Synthetic data 3M series, each length 2048, ARMA, seasonality, trend, step functions
Other real data M4, Electricity, Traffic, Weather, Favorita Sales, LibCity

arXiv v4 기준 dataset table에는 Wiki Pageviews가 대규모 비중을 차지한다. Wiki hourly, daily, weekly, monthly를 합치면 매우 큰 timepoint 수가 나오고, Trends와 synthetic data가 여기에 diversity를 더한다.

중요한 점은 synthetic data를 단순 augmentation으로만 넣지 않는다는 것이다. 저자들은 synthetic data가 underrepresented frequency나 pattern을 보완하는 역할을 한다고 본다. 실제 data는 hourly, daily 같은 빈도가 많고, quarterly, yearly, 10-minute 같은 granularity는 상대적으로 부족할 수 있다. Synthetic generator는 이런 빈 공간을 메우는 inductive bias 역할을 한다.

4-2. Training strategy

  • Training loader는 v4 기준 80% real data와 20% synthetic data를 sample한다.
  • Real data mixture는 hourly + sub-hourly, daily, weekly, monthly group에 균형을 주도록 구성된다.
  • 대부분의 training에서는 maximum context length 512를 사용한다.
  • Weekly data는 길이가 충분하지 않아 maximum context length 256을 사용한다.
  • Monthly data는 같은 이유로 maximum context length 64를 사용한다.
  • Context normalization에는 reversible instance normalization의 standard normalization 부분을 사용한다.
  • 200M 모델은 20 layers, model dimension 1280, 16 heads, input patch length 32, output patch length 128, dropout 0.2로 정리된다.
  • Ablation에는 17M, 70M, 200M 모델이 사용된다.

논문은 200M 모델 학습에 16 TPUv5e tensor-cores에서 1.5M iterations 기준 약 2일이 걸렸다고 설명한다. LLM scale과 비교하면 작지만, time-series forecasting에서는 충분히 큰 pretrained model이다.

4-3. Engineering notes

실무 관점에서 가져갈 만한 recipe는 다음과 같다.

  1. Patch size를 model architecture가 아니라 task interface로 본다
    • Input patch length는 attention cost와 context resolution을 동시에 결정한다.
    • Output patch length는 forecast horizon과 autoregressive error accumulation을 결정한다.
  2. Synthetic data는 rare granularity coverage에 유용하다
    • 논문 ablation에서 synthetic data를 제거하면 underrepresented granularity에서 성능 저하가 더 두드러진다.
    • 실제 production corpus가 특정 frequency에 치우쳐 있다면 synthetic generator가 중요해질 수 있다.
  3. Context length는 inference-time hyperparameter다
    • 논문 appendix에는 일부 Monash dataset에서 context length를 32, 64, maximum allowed 중 validation metric으로 고르는 설정이 나온다.
    • Zero-shot이라고 해도 완전한 no-tuning system은 아니다. 어떤 history를 넣을지는 여전히 중요한 운영 변수다.
  4. Point forecast만으로는 production forecasting이 끝나지 않는다
    • 수요 예측, risk forecasting, capacity planning에는 uncertainty interval이 필요하다.
    • 논문은 probabilistic extension을 future work로 두므로, production 적용 시 calibration을 별도로 봐야 한다.

5. Evaluation

5-1. Main results

TimesFM은 세 가지 benchmark group에서 zero-shot으로 평가된다.

Benchmark group What is tested Key result reading
Monash 다양한 domain과 granularity의 18 datasets TimesFM이 scaled MAE GM 기준 top model로 보고됨
Darts 8 univariate seasonal datasets TimesFM은 ARIMA와 llmtime에 근접하지만 최고는 아님
Informer / ETT long-horizon forecasting, horizons 96 and 192 TimesFM이 PatchTST 계열과 매우 근접한 수준

Monash appendix table 기준으로 scaled MAE GM은 TimesFM 0.6846, N-BEATS 0.7005, DeepAR 0.7477, llmtime 0.9715, Naive 1.0000이다. 낮을수록 좋다. 이 결과는 TimesFM이 supervised deep baseline과 견줄 수 있는 zero-shot model이라는 주장을 뒷받침한다.

Darts에서는 결과 해석이 더 조심스럽다. Scaled MAE GM 기준 llmtime 0.4882, ARIMA 0.5219, TimesFM 0.5767이다. TimesFM이 강하긴 하지만 최고는 아니며, 논문도 Darts가 개별 series 수가 적고 standard error가 날카롭지 않다고 설명한다. 또한 ARIMA는 seasonality parameter를 잘 맞춰야 하고, llmtime 쪽은 public blog post 등으로 인한 contamination 가능성을 배제하기 어렵다고 언급한다.

ETT appendix table 기준 평균 MAE는 TimesFM 0.36, supervised PatchTST 0.37, PatchTST(ZS) 0.35, llmtime 0.45, FEDFormer 0.53, AutoFormer 0.53, Informer 0.99다. 이 결과는 TimesFM이 long-horizon benchmark에서도 dataset-specific supervised model에 근접하거나 비슷한 수준까지 간다는 것을 보여준다.

5-2. What really matters in the experiments

이 논문에서 가장 중요한 실험은 최종 score보다 ablation이다.

  • Scaling ablation에서 17M, 70M, 200M 모델의 FLOPS가 증가할수록 Monash scaled MAE가 감소한다.
  • Output patch length를 8에서 128까지 늘릴 때 ETT 512-step forecasting의 average MAE가 단조 감소한다.
  • Input patch length는 너무 작아도 비효율적이고, 너무 크면 decoder-only training의 장점이 줄어든다.
  • 70M 모델 ablation 기준으로 input patch length 32가 좋은 trade-off로 제시된다.
  • Synthetic data를 제거하면 Monash와 ETTm 같은 underrepresented granularity에서 성능 저하가 관찰된다.

내 해석은 이렇다. TimesFM의 성능은 단순히 200M Transformer라서 나오는 것이 아니다. Patch length, output length, synthetic data, masking strategy가 함께 맞물려야 zero-shot forecasting이 된다. 이 논문이 좋은 이유는 final benchmark만 제시하는 것이 아니라, 어떤 설계가 foundation model 성격을 만드는지 어느 정도 분해해 보여준다는 점이다.

6. Limitations

  1. Probabilistic forecasting이 메인 초점이 아니다
    • 논문은 point forecasting을 중심으로 실험한다.
    • Quantile loss나 likelihood head는 가능하다고 언급하지만, 본문 core result는 calibrated uncertainty forecast가 아니다.
  2. Covariate handling이 제한적이다
    • 논문 기준 모델은 meaningful covariate를 포함해 pretrain되지 않는다.
    • Date feature는 appendix에서 다루지만, main paper는 univariate time-series input에 초점을 둔다.
    • 실제 수요 예측에서는 price, promotion, holiday, inventory, event 같은 covariate가 중요할 수 있다.
  3. Context length tuning이 여전히 중요하다
    • Zero-shot model이어도 어떤 history window를 넣을지는 성능에 큰 영향을 준다.
    • 논문 appendix에서도 일부 dataset에 대해 inference-time context length tuning을 수행한다.
  4. Benchmark protocol을 조심해서 봐야 한다
    • ETT 비교는 llmtime 비용 문제 때문에 last test window 기준으로 수행된다.
    • Darts는 dataset 수가 적어 standard error가 충분히 sharp하지 않다.
    • Public benchmark는 contamination 가능성을 완전히 배제하기 어렵다.
  5. Interpretability가 약하다
    • ARIMA, ETS 같은 statistical model보다 왜 특정 forecast를 냈는지 설명하기 어렵다.
    • 논문도 foundation model의 interpretability 문제를 limitation으로 언급한다.
  6. Critical use에는 human-in-the-loop가 필요하다
    • Forecasting error는 재고, 인력 배치, finance risk, infrastructure planning에 직접 영향을 줄 수 있다.
    • 논문 impact statement도 모델이 잘 작동하지 않는 입력이 있을 수 있으므로 충분한 testing, finetuning, human oversight가 필요하다고 본다.

7. My Take

7-1. Why this matters for my work

  • TimesFM은 time-series foundation model을 설계할 때 LLM architecture를 얼마나 그대로 가져오고, 어디서 task-specific하게 바꿔야 하는지를 잘 보여준다.
  • 특히 input patch와 output patch를 다르게 두는 설계는 forecasting domain의 inductive bias를 직접 반영한다.
  • 내가 보기엔 이 논문은 LLM for time-series라기보다, time-series를 위한 decoder-only pretraining interface를 정의한 논문에 가깝다.
  • Agent, finance, infra monitoring, demand forecasting 같은 실무 시스템에서는 zero-shot baseline을 빠르게 깔고, 필요한 dataset만 fine-tuning이나 calibration을 붙이는 방향으로 재사용할 수 있다.

7-2. Reuse potential

재사용하고 싶은 포인트는 다섯 가지다.

  1. Patch-level tokenization
    • Raw timestep을 그대로 token으로 쓰지 말고, patch 단위로 sequence length와 forecasting granularity를 조절한다.
  2. Longer output patch
    • Long horizon을 한 step씩 autoregressive하게 생성하지 않고, chunk 단위로 직접 예측한다.
  3. Synthetic generator
    • ARMA, seasonality, trend, step function 조합으로 underrepresented pattern과 frequency를 보완한다.
  4. Masking for arbitrary context length
    • Patch boundary에 묶이지 않도록 partial masking을 넣어 다양한 context length를 보게 한다.
  5. Zero-shot first, tune later
    • 각 dataset마다 model을 처음부터 train하기 전에 TimesFM류 foundation model을 baseline으로 먼저 둔다.
    • 이후 covariate, calibration, quantile forecast, business constraint를 task별로 붙인다.

7-3. Follow-up papers

  • Chronos: Learning the Language of Time Series
  • Lag-Llama: Towards Foundation Models for Probabilistic Time Series Forecasting
  • Unified Training of Universal Time Series Forecasting Transformers
  • MOMENT: A Family of Open Time-series Foundation Models
  • PatchTST: A Time Series is Worth 64 Words
  • Long-term Forecasting with TiDE
  • TimeGPT-1

8. Summary

  • TimesFM은 time-series를 patch token으로 바꾸고 decoder-only Transformer로 next patch를 예측하는 forecasting foundation model이다.
  • 핵심 설계는 input patch length 32, output patch length 128처럼 읽는 단위와 생성 단위를 분리하는 것이다.
  • Pretraining corpus는 Google Trends, Wiki Pageviews, public forecasting datasets, synthetic time-series를 결합한다.
  • Monash, Darts, ETT 결과는 TimesFM이 zero-shot으로 supervised baselines에 근접할 수 있음을 보여주지만, 모든 benchmark에서 압도적인 것은 아니다.
  • 실무 적용 시에는 probabilistic forecast, covariate handling, context tuning, benchmark protocol, interpretability를 반드시 같이 봐야 한다.

댓글남기기