Skip to content
/ TATO Public

The official code repository for our ICLR 2026 paper, Adaptive Transformation Optimization for Domain-Shared Time Series Foundation Models.

License

Notifications You must be signed in to change notification settings

thulab/TATO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TATO: Adaptive Transformation Optimization for Domain-Shared Time Series Foundation Models

License Python 3.8+ PyTorch

TATO (Adaptive Transformation Optimization) is a novel framework that automatically optimizes data transformations to enhance the performance of time series foundation models across diverse domains.

πŸ“– Paper Abstract

Time series foundation models have shown remarkable capabilities in various forecasting tasks. However, their performance can be significantly degraded when applied to datasets with different characteristics due to domain shift. TATO addresses this challenge by introducing an adaptive transformation optimization framework that automatically searches for the optimal combination of data transformations to adapt foundation models to new domains.

Key Contributions:

  • Adaptive Transformation Pipeline: Automatically optimizes 8 types of data transformations
  • Model-Agnostic Design: Compatible with various time series foundation models
  • Efficient Search: Utilizes Optuna for hyperparameter optimization
  • Comprehensive Evaluation: Supports multiple benchmark datasets

πŸš€ Quick Start

Installation

  1. Clone the repository:
git clone https://github.com/thulab/TATO.git
cd TATO
  1. Dependency Management: Different time series foundation models have different version requirements for the transformers library (especially Sundial requires 4.40.1, while other models use 4.41.0). We have adopted a modular dependency management solution:
TATO/
β”œβ”€β”€ base_requirements.txt          # Base dependencies shared by all models
β”œβ”€β”€ scripts/timer_runs/           # Timer model specific
β”‚   └── timer_requirements.txt    # Timer model dependencies (transformers 4.41.0)
β”œβ”€β”€ scripts/moirai_runs/          # MOIRAI model specific
β”‚   └── moirai_requirements.txt   # MOIRAI model dependencies (transformers 4.41.0)
β”œβ”€β”€ scripts/chronos_runs/         # Chronos model specific
β”‚   └── chronos_requirements.txt  # Chronos model dependencies (transformers 4.41.0)
└── scripts/sundial_runs/         # Sundial model specific
    └── sundial_requirements.txt  # Sundial model dependencies (transformers 4.40.1)
  1. Set up model environments:
# Create independent virtual environments for each model. It is noteworthy that conflicts exist among their envs. 
bash scripts/timer_runs/setup_timer.sh      # Timer model
bash scripts/moirai_runs/setup_moirai.sh    # MOIRAI model
bash scripts/chronos_runs/setup_chronos.sh  # Chronos model
bash scripts/sundial_runs/setup_sundial.sh  # Sundial model (requires transformers 4.40.1)
  1. Download pre-trained models and datasets:

Install dependencies of the pre-trained models. For Timer, please download it from https://drive.google.com/file/d/1PFHMpa32dO8Y2fQ8N7vjsbTpFhd0fC8_/view?usp=drive_link and add the decompressed directory to PYTHONPATH

# Download checkpoints (Timer, Chronos, etc.) and put them in CKPT
mkdir -p CKPT
# Download datasets (ETT, Exchange, etc.) and put them in DATASET
mkdir -p DATASET
# You can make soft link to the directory as needed.

Model Configuration

TATO uses a configuration-driven approach for model management. All model definitions are stored in configs/model_config.yaml:

# Model Configuration File
models:
  # Timer models
  Timer-UTSD:
    class: Timer
    ckpt_path: CKPT/Building_timegpt_d1024_l8_p96_n64_new_full.ckpt
    description: "Timer model with UTSD architecture"
    requires_args: true
  
  # MOIRAI models
  MOIRAI-small:
    class: MOIRAI
    ckpt_path: CKPT/MOIRAI-small
    description: "Small MOIRAI model"
    requires_args: false
  
  # Chronos models
  Chronos-tiny:
    class: Chronos
    ckpt_path: CKPT/Chronos-tiny
    description: "Tiny Chronos model"
    requires_args: false
  
  # Sundial models
  Sundial:
    class: Sundial
    ckpt_path: CKPT/sundial
    description: "Sundial model (requires transformers 4.40.1)"
    requires_args: true

Required Checkpoint Structure

After downloading pre-trained models, your CKPT/ directory should have the following structure:

CKPT/
β”œβ”€β”€ Building_timegpt_d1024_l8_p96_n64_new_full.ckpt/    # Timer-UTSD
β”œβ”€β”€ Large_timegpt_d1024_l8_p96_n64_new_full.ckpt/       # Timer-LOTSA
β”œβ”€β”€ MOIRAI-small/                                       # MOIRAI-small
β”œβ”€β”€ MOIRAI-base/                                        # MOIRAI-base
β”œβ”€β”€ MOIRAI-large/                                       # MOIRAI-large
β”œβ”€β”€ Chronos-tiny/                                       # Chronos-tiny
└── sundial/                                            # Sundial

Adding New Models

To add a new model, simply update the configuration file:

  1. Add model entry to configs/model_config.yaml:
NewModel-Example:
  class: Timer  # or MOIRAI, Chronos, Sundial
  ckpt_path: CKPT/new_model_checkpoint
  description: "New example model"
  requires_args: true  # or false
  1. Download the checkpoint to CKPT/new_model_checkpoint/

  2. The model will be automatically available through ModelFactory.load_model('NewModel-Example', device, args)

Basic Usage

Run a simple experiment with default settings:

python experiment/run.py \
  --device cuda:0 \
  --dataset ETTh1 \
  --model Timer-LOTSA \
  --pred_len 96 \
  --train_trials 100 \
  --num_samples 500

πŸ—οΈ Architecture

Core Components

TATO/
β”œβ”€β”€ data/              # Dataset loading and preprocessing
β”œβ”€β”€ model/             # Foundation model implementations
β”œβ”€β”€ transformation/    # Data transformation modules
β”œβ”€β”€ pipeline/          # Transformation pipeline
β”œβ”€β”€ tuner/            # Hyperparameter optimization
β”œβ”€β”€ experiment/        # Experiment orchestration
└── utils/            # Utility functions

Built-in Transformations

Transformation Purpose Search Parameters
Normalizer Scale normalization method, mode
Sampler Temporal sampling factor
Warper Time warping method
Differentiator Differencing n
Inputer Missing value imputation detect_method, fill_method
Denoiser Noise reduction method
Trimmer Sequence trimming seq_l
Aligner Sequence alignment mode, method

πŸ“Š Datasets

The following benchmark datasets are supported for now:

Dataset Frequency Length Features Description
ETTh1 Hourly 17,420 7 Electricity Transformer Temperature
ETTh2 Hourly 17,420 7 Electricity Transformer Temperature
ETTm1 15-min 69,680 7 Electricity Transformer Temperature
ETTm2 15-min 69,680 7 Electricity Transformer Temperature
Exchange Daily 7,588 8 Exchange Rates
Weather 10-min 52,695 21 Weather Data
Electricity Hourly 26,304 321 Electricity Consumption
Traffic Hourly 17,544 862 Traffic Flow

πŸ”§ Advanced Usage

Custom Experiment Configuration

Create a custom experiment script:

import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from experiment.run import main
import argparse

# Custom configuration
args = argparse.Namespace(
    seed=42,
    device='cuda:0',
    dataset='Weather',
    model='MOIRAI-base',
    pred_len=336,  # 2-week forecast
    patch_len=128,
    train_trials=200,
    num_samples=1000,
    top_k=10,
    save_dir='./custom_results',
    no_aug=False,
    plt=True
)

main(args)

Adding Custom Transformations

  1. Create a new transformation in transformation/library/:
# transformation/library/custom_transform.py
from transformation.base import BaseTransformation

class Transformation(BaseTransformation):
    search_space = {
        'parameter': [1, 2, 3, 4, 5]
    }
    
    def __init__(self, parameter, **kwargs):
        self.parameter = parameter
    
    def pre_process(self, data):
        # Your transformation logic
        return transformed_data
    
    def post_process(self, data):
        # Inverse transformation
        return restored_data
  1. The transformation will be automatically discovered by the factory.

Integration with New Models

To add a new foundation model:

# model/custom_model.py
from model.model_factory import ModelFactory

class CustomModel:
    def __init__(self, model_name, ckpt_path, device, args=None):
        self.model_name = model_name
        self.device = device
        # Initialize your model
    
    def forecast(self, data, pred_len):
        # Implement forecasting logic
        return predictions

# Register in model_factory.py
ModelFactory.register_model('custom-model', CustomModel)

πŸ“ˆ Results and Evaluation

Performance Metrics

TATO evaluates models using multiple metrics:

  • MSE (Mean Squared Error)
  • MAE (Mean Absolute Error)
  • RMSE (Root Mean Squared Error)
  • MAPE (Mean Absolute Percentage Error)
  • MSPE (Mean Squared Percentage Error)

Optimization Process

The framework follows a three-stage optimization:

  1. Training Phase: Search for optimal transformation combinations
  2. Validation Phase: Evaluate candidate transformations
  3. Testing Phase: Final performance assessment

Visualization

Enable visualization with the --plt flag to generate:

  • Transformation effect plots
  • Prediction vs ground truth comparisons

πŸ§ͺ Experiments

Reproducing Paper Results

To reproduce the experiments from the paper, use the new modular script structure:

New Script Structure (Recommended)

Each model now has its own dedicated directory with setup and run scripts:

scripts/
β”œβ”€β”€ timer_runs/                    # Timer model specific
β”‚   β”œβ”€β”€ setup_timer.sh            # Environment setup script
β”‚   β”œβ”€β”€ run_timer.sh              # Run script
β”‚   └── timer_requirements.txt    # Dependency configuration
β”œβ”€β”€ moirai_runs/                  # MOIRAI model specific
β”‚   β”œβ”€β”€ setup_moirai.sh
β”‚   β”œβ”€β”€ run_moirai.sh
β”‚   └── moirai_requirements.txt
β”œβ”€β”€ chronos_runs/                 # Chronos model specific
β”‚   β”œβ”€β”€ setup_chronos.sh
β”‚   β”œβ”€β”€ run_chronos.sh
β”‚   └── chronos_requirements.txt
└── sundial_runs/                 # Sundial model specific
    β”œβ”€β”€ setup_sundial.sh
    β”œβ”€β”€ run_sundial.sh
    └── sundial_requirements.txt

Base Dependencies

  • base_requirements.txt - Base dependencies shared by all models

Usage Instructions

  1. Set up model environments:
# Timer model
bash scripts/timer_runs/setup_timer.sh

# Sundial model (requires transformers 4.40.1)
bash scripts/sundial_runs/setup_sundial.sh
  1. Run model experiments:
# Run after activating environment
source venv_timer/bin/activate
bash scripts/timer_runs/run_timer.sh

# Or run directly (script will check environment)
bash scripts/timer_runs/run_timer.sh

πŸ”¬ Research Extensions

Extending TATO for Your Research

  1. Novel Transformations: Implement domain-specific transformations
  2. Multi-objective Optimization: Extend the tuner for Pareto-optimal solutions
  3. Online Adaptation: Implement streaming data adaptation
  4. Cross-domain Transfer: Study transfer learning across domains

Citation

If you use TATO in your research, please cite our paper:

@inproceedings{qiu2026adapt,
    title={Adapt Data to Model: Adaptive Transformation Optimization for Domain-shared Time Series Foundation Models},
    author={Yunzhong Qiu and Zhiyao Cen and Zhongyi Pei and Chen Wang and Jianmin Wang},
    booktitle={The Fourteenth International Conference on Learning Representations},
    year={2026},
    url={https://openreview.net/forum?id=uTK1SNgi1N}
}

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Code Structure Guidelines

  • Follow PEP 8 style guide
  • Use type hints for function signatures
  • Add docstrings for all public functions and classes
  • Write unit tests for new functionality

πŸ› Troubleshooting

Common Issues

  1. Transformers Version Conflicts

    • Issue: Sundial requires transformers 4.40.1, while other models require 4.41.0
    • Solution: Use independent virtual environments
    # Check current transformers version
    python -c "import transformers; print(transformers.__version__)"
    
    # Create independent environment for Sundial
    bash scripts/sundial_runs/setup_sundial.sh
    
    # Verify Sundial environment version
    source venv_sundial/bin/activate
    python -c "import transformers; print(f'Sundial environment: {transformers.__version__}')"
    deactivate
    
    # Verify other model environment versions
    source venv_timer/bin/activate
    python -c "import transformers; print(f'Timer environment: {transformers.__version__}')"
    deactivate
  2. CUDA Out of Memory

    # Reduce batch size
    --batch_size 256
    
    # Use smaller model
    --model MOIRAI-small
  3. Dataset Download Issues

    # Manual download
    wget -P DATASET/ https://dataset-url.com/data.zip
    unzip DATASET/data.zip -d DATASET/
  4. Checkpoint Not Found

    # Download pre-trained checkpoints
    python scripts/download_checkpoints.py

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Hugging Face for model hosting infrastructure
  • Optuna for hyperparameter optimization framework
  • All contributors and users of TATO

πŸ“ž Contact

For questions and collaborations:


TATO - Making time series foundation models adaptable across domains. πŸš€

About

The official code repository for our ICLR 2026 paper, Adaptive Transformation Optimization for Domain-Shared Time Series Foundation Models.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published