Skip to main content

TimesFM 2.5 (Google Foundation Model)

Pre-trained time series transformer with fine-tuning and quantile predictions


Overview​

  • ID: timesfm-2.5-finetune-gpu
  • Type: Time series forecasting (foundation model)
  • Architecture: Decoder-only transformer (200M parameters)
  • Checkpoint: google/timesfm-2.5-200m-pytorch
  • Context: Up to 16,384 time points
  • Horizon: Up to 1,024 steps ahead
  • Quantiles: 10 quantile heads (q10 through q90)
  • Training time: 5-30 minutes (fine-tuning)
  • GPU required: Yes (~4 GB VRAM)

TimesFM 2.5 is Google Research's time series foundation model. It works out of the box (zero-shot) and can be fine-tuned on your data for better accuracy.

Lifecycle

timesfm-2.5-finetune-gpu is currently a candidate template. Check the live catalog (GET /api/builder/v1/inference/models?category=time_series) for its current status.


When to Use​

Perfect for:

  • Financial time series (stocks, crypto, forex)
  • High-frequency data (minute-level, hourly)
  • When you need prediction intervals (quantiles)
  • Complex patterns that classical models miss
  • Large datasets (1k+ data points)

Not ideal for:

  • Very small datasets (< 100 points) -- use Classical Forecasting
  • When interpretability is critical (use Prophet/ARIMA)

Quick Start​

Fine-Tuning​

from colabhive import ColabHive

client = ColabHive(api_key="...", account_id="...")

dataset = client.datasets.upload("btc_prices", "./btc_daily.csv")

job = client.training.create(
model="timesfm-2.5-finetune-gpu",
dataset_id=dataset.id,
hyperparameters={
"target_column": "close",
"covariate_columns": ["open", "high", "low", "volume"],
"date_column": "date",
"context_len": 1024,
"horizon_len": 12,
"epochs": 10,
"learning_rate": 1e-4,
"batch_size": 8,
"quantiles": True,
}
)

job.wait()
print(job.get_metrics()) # e.g. {"eval_mae": ..., "eval_mse": ...}

Register for Inference​

endpoint = client.training.register_for_inference(
run_id=job.id,
name="btc-forecast",
description="BTC price forecasting (TimesFM 2.5 fine-tuned)",
visibility="account",
)

Run Inference​

result = client.endpoints.infer(
endpoint_id=endpoint.endpoint_id,
input_data={
"values": [42000, 42500, 41800, 43000, 42700, ...],
"horizon": 12,
},
)

Response Format​

{
"forecasts": [43100.5, 43250.2, 43180.7, ...],
"model_type": "TimesFM-2.5",
"horizon": 12,
"quantiles": {
"mean": [43100.5, 43250.2, ...],
"q10": [42800.1, 42900.3, ...],
"q20": [42900.2, 43000.5, ...],
"q30": [42950.3, 43050.7, ...],
"q40": [43020.4, 43150.1, ...],
"q50": [43100.5, 43250.2, ...],
"q60": [43180.6, 43350.4, ...],
"q70": [43260.7, 43450.6, ...],
"q80": [43340.8, 43550.8, ...],
"q90": [43420.9, 43650.0, ...]
}
}

Dataset Format​

CSV Format​

date,open,high,low,close,volume
2024-01-01,42000,42500,41800,42300,1500000
2024-01-02,42300,43000,42100,42700,1800000
2024-01-03,42700,42900,42200,42500,1200000

Requirements​

  • Date column: Date or datetime (name it via date_column)
  • Target column: Numeric column to forecast (via target_column)
  • Min 200 points (recommended 1000+)
  • Covariate columns are optional but improve accuracy

Hyperparameters​

ParameterTypeDefaultRangeDescription
target_columnstring"close"--Column to forecast
covariate_columnslist[]--Additional feature columns
date_columnstring"ds"--Date/time column name
context_lenint102432-16384History window length
horizon_lenint1281-1024Forecast steps ahead
learning_ratefloat1e-41e-6 to 1e-3Fine-tuning learning rate
epochsint101-100Number of training epochs
batch_sizeint81-64Training batch size
quantilesbooltrue--Enable quantile head (q10-q90)

How It Works​

  1. Pre-trained Model: TimesFM 2.5 was trained by Google Research on a massive corpus of time series data (ICML 2024 paper). It understands temporal patterns out of the box.

  2. Fine-Tuning: The system creates sliding windows of (context_len, horizon_len) from your dataset, then fine-tunes the decoder using MSE loss with AdamW optimizer and cosine LR scheduling.

  3. Inference: The fine-tuned model receives a history window and outputs point forecasts + quantile intervals. The horizon is always respected exactly.

  4. Quantiles: When enabled, the model produces 10 prediction intervals (q10 through q90), giving you confidence bounds on the forecast.


Comparison with Classical Forecasting​

FeatureTimesFM 2.5Classical (Prophet/ARIMA/ETS)
TypeFoundation model (200M params)Statistical models
TrainingFine-tune pre-trained transformerFit from scratch
ContextUp to 16k pointsUnlimited
QuantilesNative (q10-q90)Limited (Prophet only)
Speed5-30 min fine-tuning1-10 min
AccuracyHigher on complex patternsGood on seasonal data
GPURequired (4GB+)Required (6GB+)
Best forFinance, high-freq, complexSales, demand, simple seasonal

Tips​

  1. Context length: Use the largest context that fits your data. More context = better pattern recognition.
  2. Learning rate: Start with 1e-4. If loss doesn't decrease, try 1e-5. If it oscillates, try 3e-5.
  3. Epochs: 5-15 is usually sufficient. The system saves the best checkpoint automatically.
  4. Batch size: 8 works well for most cases. Increase to 16-32 for larger datasets.
  5. Quantiles: Always enable them -- they give you prediction intervals at no extra cost.
  6. Covariates: Adding related columns (e.g. volume for price prediction) can significantly improve accuracy.

References​


Next Steps​