Skip to content

Add crypto domain LoRA adapters for TimesFM 2.5 - #532

Open
wtatari wants to merge 5 commits into
google-research:masterfrom
wtatari:horizon-c1
Open

wtatari wants to merge 5 commits into
google-research:masterfrom
wtatari:horizon-c1

Conversation

@wtatari

@wtatari wtatari commented Sep 27, 2026

Copy link
Copy Markdown

Summary

  • Add a domain-adapters pipeline that trains small LoRA adapters on the untouched TimesFM 2.5 base for crypto candles, with calendar train/val/test splits so assets cannot leak future prices into each other.
  • Ship Horizon-C1 (1h and 1d) and Horizon-C2 (1m/5m/15m/1h) adapter weights plus fetch, fine-tune, forecast, context-length, and layered-routine evaluation scripts.
  • Keep the candle-aware (high/low/volume) and mixed context-length experiments in tree, and document that neither beat Horizon-C2 on the held-out test window.

Test plan

  • Install the documented PyTorch and PEFT dependencies and load google/timesfm-2.5-200m-transformers with --adapter horizon-c1 and --adapter horizon-c2.
  • Run forecast.py --adapter horizon-c2 --symbol BTCUSDT --interval 15m --compare and confirm a point forecast and quantile band are produced.
  • Confirm the default split dates keep the test window after validation (val before test_start) in finetune_domain.py.
  • Re-run evaluate_layered.py on a short candle slice and check it reports the price-vs-open baseline next to the model.

wtatari and others added 5 commits September 27, 2026 00:25
domain-adapters/ holds a domain fine-tuning pipeline on top of the
untouched TimesFM 2.5 base model:
- fetch_crypto.py: Binance public klines for 36 USDT pairs (1h, 1d)
- finetune_domain.py: LoRA training with a price-relative loss and
  calendar-based train/val/test splits
- forecast.py: forecast with base or any adapter (CUDA / MPS / CPU)
- adapters/horizon-c1: trained crypto adapter weights (11 MB)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- fetch_crypto_minutes.py: 1m Binance archives (handles the 2025 switch
  to microsecond timestamps), builds 5m/15m candles
- evaluate_layered.py: replays forecast-then-reforecast-every-step on
  unseen candles and compares against the price-vs-open baseline
- adapters/horizon-c2: LoRA trained on 1m/5m/15m/1h

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ohlcv.py: zero-initialised candle encoder hooked into TimesFM's input
  layer, flip-invariance aware (swaps wicks on the mirrored pass)
- finetune_ohlcv.py: trains it on top of an adapter, with a --no_candle
  control run
- evaluate_layered.py / forecast.py: feed full candles to candle-aware models
- README: C3 matched C2 and the control within noise, so it is not promoted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… C2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Sep 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant