HubLensMachine Learningshiyu-coder/Kronos
shiyu-coder

Kronos

AIMachine LearningTransformerFinanceTime SeriesDeep Learning
View on GitHub
88

// summary

Kronos is an open-source decoder-only foundation model specifically designed to interpret and forecast financial K-line sequences. It utilizes a two-stage framework that quantizes multi-dimensional market data into hierarchical tokens before processing them through an autoregressive Transformer. The project provides pre-trained models, a specialized predictor class, and a complete pipeline for fine-tuning on custom financial datasets.

// technical analysis

Kronos is a decoder-only foundation model family specifically engineered to interpret the complex, high-noise language of financial K-line sequences. It utilizes a two-stage architecture that first quantizes multi-dimensional OHLCV data into hierarchical discrete tokens, which are then processed by an autoregressive Transformer. This design addresses the unique challenges of financial time-series forecasting by providing a unified, scalable framework that can be adapted to diverse quantitative tasks through fine-tuning.

// key highlights

01
Functions as the first open-source foundation model specifically trained on financial candlestick data from over 45 global exchanges.
02
Employs a specialized tokenizer that converts continuous OHLCV data into hierarchical discrete tokens for improved model interpretability.
03
Provides a family of pre-trained models with varying parameter counts, ranging from 4.1M to 499.2M, to accommodate different computational requirements.
04
Includes a robust KronosPredictor class that simplifies the end-to-end pipeline from raw data preprocessing to inverse normalization and forecasting.
05
Supports efficient batch prediction on multiple time series simultaneously by leveraging GPU parallelism.
06
Offers a comprehensive fine-tuning pipeline, including integration with Qlib for data preparation and backtesting, to adapt the model to specific market domains.

// use cases

01
Forecasting financial market trends using historical OHLCV data
02
Fine-tuning pre-trained models on domain-specific financial datasets
03
Performing batch predictions across multiple assets for quantitative analysis

// getting started

To begin, install the required dependencies using 'pip install -r requirements.txt'. You can then load a pre-trained model and tokenizer from the Hugging Face Hub, instantiate the 'KronosPredictor' class, and pass your historical K-line data to the 'predict' method to generate forecasts.