Data#Data analysis#Model training

Qlib: Microsoft's open-source AI quant investment platform

Microsoft's open-source AI quant platform chains data, modeling, and backtesting into one pipeline, with 20-plus model benchmarks built in.

Project facts

GitHub Ecosystem
Repositorygithub.com/microsoft/qlib
License
MIT
Language
Python
Stars
49,166
Data checked
2026-10-06

Snapshot figures reflect the check date and may change over time.

Quant research often gets bogged down by a fragmented toolchain—data, modeling, and backtesting each living in their own silo. Microsoft’s open-source Qlib pulls them into a single framework: an AI-oriented quant investment platform covering everything from factor construction and model training to portfolio optimization and order execution in one pipeline. GitHubDaily recommended it in May 2025.

Core features

  • End-to-end coverage: a complete built-in machine-learning pipeline, with ready-made components for alpha mining, risk modeling, portfolio optimization, and order execution.
  • Data engine: a custom compact binary storage format plus expression and dataset caching—the official benchmark builds a 14-factor dataset in just 7.4 seconds, notably faster than HDF5 or MySQL.
  • Model benchmark library: includes more than 20 SOTA models drawn from published papers — LightGBM, XGBoost, CatBoost, LSTM, GRU, Transformer, GATs, TabNet, HIST, TRA, TCN, and more — runnable directly on Alpha158 and Alpha360, each one linked to its paper and year.
  • Multi-paradigm framework: covers supervised-learning prediction, market dynamics adaptation (rolling retraining, DDG-DA), and reinforcement-learning order execution (PPO, TWAP).
  • qrun workflow: driven by a YAML config, it automatically runs dataset construction, training, backtesting, and evaluation, producing charts like IC and grouped returns; it can also plug into RD-Agent, Microsoft’s other open-source project, to let an LLM agent handle factor mining and R&D iteration automatically.

Benchmarks

The official data-server comparison: building a 14-factor dataset from the same market data (800 stocks per day, 2007–2020), single-core wall time by storage backend:

StorageHDF5MySQLMongoDBInfluxDBQlib (no cache)Qlib (expression cache)Qlib (expression + dataset cache)
Single-core (seconds)184.4365.3253.6368.2147.047.67.4

This comes from the README’s “Performance” section, with no test date given; on 64 cores, the expression-cache configuration drops further to about 4.2 seconds. The project’s own explanation is that general-purpose databases lose time to too many interface layers and format conversions, while Qlib’s compact storage format assembles straight into arrays, skipping that overhead.

Typical use cases

  • Reproduce papers or baselines with public data in one step, comparing IC and backtest metrics on a level playing field.
  • Plug your own factors or new models into the existing pipeline without building data and backtesting infrastructure from scratch.
  • Model order execution and other sequential-decision problems with reinforcement learning for multi-level joint strategy optimization.

Quick start

After installing, pull China market data (the official dataset is temporarily unavailable, so this command scrapes from Yahoo instead), then run a built-in benchmark:

pip install pyqlib
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
cd examples && qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml

Summary

This suits quant researchers, machine-learning researchers, and fintech teams running experiments like stock prediction and portfolio optimization; an individual investor who just wants to try one model will face a steep learning curve. The project is MIT licensed and supports Python 3.8 through 3.12 on Linux/Windows/macOS; getting started requires no API key, and it sits at about 49k stars as of 2026-10-06 with active commits. Four caveats: the official dataset is offline for now due to data-security policy, so you’ll need a community data source or the repo’s own crawler (Yahoo data quality is limited); the batch script run_all_model.py only supports Linux; on Apple Silicon Macs you need to install libomp before compiling LightGBM; and a few models have extra constraints requiring older TensorFlow versions. Overall, it’s an end-to-end, well-reproducible, and fairly well-engineered open-source quant framework; teams that need to turn documents like financial reports into structured input first can pair it with a local parser like MonkeyOCR.