Skip to content

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

SIREN: Spectral Intra-Lookback Retrieval Engine for Time Series Forecasting

Deeptanshu Kumar1, Sanjith Suresh Kumar1, Pallavi2

1Department of Computer Science and Engineering (AIML), PES University
2Department of Electronics and Communication Engineering, PES University

{deeptanshu.kumar13, sanjithsureshkumarwork, pallavikv459}@gmail.com


SIREN is a retrieval-augmented generation framework for time series forecasting that retrieves similar historical patterns via spectral signature matching and fuses them into foundation model forecasts through an adaptive mixer.

Architecture

SIREN retrieves candidates by spectral signature matching. The retrieval strategy depends on the setting:

  • Pretraining: A two-stage FAISS + SIREN pipeline precomputes retrievals offline from a large database (Chronos-T5 or FFT fingerprints for prefilter, then SIREN spectral rerank).
  • Online evaluation: The memory buffer is populated from the training split at startup. Each test query is fingerprinted via FFT and compared directly against the buffer entries using SIREN spectral rerank — no FAISS needed.

An Adaptive Retrieval Mixer (ARM) fuses retrieved sequences into the backbone via learned gating.

Supported Backbones

  • Chronos-Bolt (amazon/chronos-t5-base)
  • MOMENT (AutonLab/MOMENT-1-large)

Installation

conda create -n siren python=3.9
conda activate siren
pip install -r requirements.txt
cd TS-RAG

Data

Retrieval Database

retrieval_database_512.parquet with columns: x (512,), y (64,), embedding (768,), timestamps, id.

Pretrain Pairs

Parquet shards with columns: target (576,), indices (20,), distances (20,), embedding (768, — optional).

In-Step Memory Buffer (1024 Context)

SIREN maintains a sliding-window memory buffer that stores recently-seen segments as MemoryEntry objects:

Field Shape Description
context (1024,) Sliding window of raw time series
future (64,) Forecast horizon
fingerprint (90,) FFT spectral signature
metadata dict Entropy, band energies

The buffer processes input in 1024-length steps with a circular buffer (default capacity: 10,000). When full, the oldest entries are evicted automatically, enabling efficient online retrieval without re-indexing.

Usage

1. Precompute Retrievals

Chronos + SIREN:

python siren/precompute_pretrain_retrievals.py \
  --input_data_path /data/pretrain_chunks \
  --output_data_path /data/pretrain_pairs_ctx512_siren \
  --retrieval_database_path /data/retrieval_database_512.parquet \
  --save_embeddings

2. Train ARM Module

Chronos-Bolt:

python pretrain.py \
  --model ChronosBoltRetrieve \
  --model_id SIREN_ChronosBolt \
  --data_path /data/pretrain_pairs_ctx512_siren_pure \
  --retrieval_database_path /data/retrieval_database_512.parquet \
  --retriever_type embedding \
  --top_k 10 --batch_size 256 --train_steps 10000 \
  --learning_rate 0.0003 --weight_decay 0.01 --drop_prob 0.2 \
  --freeze_chronos_bolt \
  --pretrained_model_path ./checkpoints/base/

MOMENT:

python pretrain.py \
  --model MOMENTRetrieve \
  --model_id SIREN_MOMENT \
  --data_path /data/pretrain_pairs_ctx512_siren_pure \
  --retrieval_database_path /data/retrieval_database_512.parquet \
  --retriever_type embedding \
  --top_k 10 --batch_size 256 --train_steps 10000 \
  --learning_rate 0.0003 --freeze_chronos_bolt

3. Zero-Shot Evaluation (Online)

python siren/siren_online_eval.py \
  --dataset_name ETTh1 \
  --root_path ./dataset/ETTh1/ \
  --data_path ETTh1.csv \
  --seq_len 512 --pred_len 64 \
  --top_k 10 --stride 16 \
  --buffer_size 1024 \
  --fingerprint_length 64 \
  --batch_size 256 \
  --augment_mode moe \
  --pretrained_model_path ./checkpoints/base/ \
  --checkpoint_model_path ./checkpoints/SIREN_ChronosBolt/model_steps10000.pth

Project Structure

.
├── datasets/                          # Evaluation datasets
├── retrieval_database/                # Raw retrieval files
├── TS-RAG/
│   ├── siren/                         # SIREN retrieval engine
│   │   ├── precompute_pretrain_retrievals.py
│   │   ├── siren_online_eval.py       # Online zero-shot evaluation
│   │   ├── spectral_retriever.py      # FFT fingerprinting + rerank
│   │   ├── memory_buffer.py           # Sliding window buffer
│   │   └── memory_entry.py            # Buffer entry schema
│   ├── models/                        # Chronos-Bolt, MOMENT + ARM
│   │   ├── ChronosBolt.py
│   │   └── moment.py
│   ├── dataset.py                     # Datasets & retrievers (FAISS, SIREN)
│   ├── pretrain.py                    # ARM training
│   ├── zeroshot.py                    # Chronos-based zeroshot
│   ├── retrieve.py                    # Online retrieval utilities
│   └── checkpoints/
│       └── base/                      # Pretrained backbone
└── requirements.txt

Citation

If you find SIREN useful, please consider citing:

@misc{kumar2025siren,
      title={SIREN: Spectral Intra-Lookback Retrieval Engine for Time Series Forecasting}, 
      author={Deeptanshu Kumar and Sanjith Suresh Kumar and Pallavi},
      year={2025},
}

About

SIREN (Spectral Intra Lookback Retrieval Engine):A lightweight FFT-based spectral retrieval framework for retrieval-augmented time-series forecasting, designed as a plug-and-play alternative to embedding-based retrieval.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages