Noureddine RAMDI / QuantaAlpha: LLM-driven trajectory-based self-evolution for quantitative alpha factor discovery

Created Mon, 04 May 2026 10:23:01 +0000 Modified Mon, 06 Jul 2026 15:16:10 +0000

QuantaAlpha/QuantaAlpha

QuantaAlpha tackles a tricky problem in quantitative finance: how to automatically discover alpha factors that reliably predict stock returns. Instead of relying solely on human intuition or static factor libraries, QuantaAlpha puts large language models (LLMs) to work in an iterative evolutionary loop. It generates candidate factor hypotheses, evolves them through trajectory-based constraints, and validates performance with historical backtests, all in a self-improving cycle.

What QuantaAlpha does and how it works

At its core, QuantaAlpha is a Python-based framework that combines LLMs with evolutionary algorithms to mine, evolve, and validate quantitative alpha factors. These factors are mathematical signals or features that can be used to predict asset returns, a fundamental task in quantitative investing.

The architecture centers around a trajectory-based self-evolution mechanism. The process begins with diversified planning initialization, where the system generates a broad set of candidate factor hypotheses using LLMs. These hypotheses are expressed as structured code snippets constrained by domain knowledge and predefined templates.

Next comes trajectory-level evolution, where candidate factors are iteratively evolved by applying mutations and crossovers guided by fitness scores derived from backtesting results. This evolutionary strategy is enhanced by structured hypothesis-code constraints that keep the factor code syntactically valid and financially meaningful.

For backtesting and validation, QuantaAlpha integrates with Microsoft’s open-source Qlib platform, which provides a comprehensive environment for evaluating factor performance on historical market data. The framework supports multiple LLM providers, including OpenAI, DeepSeek, and Qwen, allowing flexibility in choosing the underlying language model.

The project also includes a web UI that helps users visualize the workflow, manage experiments, and browse the evolving factor library. This makes it easier to track the factor generation process and inspect top-performing factors.

Why QuantaAlpha’s trajectory-based self-evolution is technically interesting

The standout feature of QuantaAlpha is how it brings together LLMs and evolutionary strategies in a feedback loop tailored for quantitative research. Instead of treating the LLM as a static oracle that outputs factors on demand, it treats the LLM as an agent within an evolutionary ecosystem.

This means factor hypotheses are not one-off outputs but parts of trajectories that evolve over iterations. By combining diversified planning initialization with trajectory-level evolution, the system effectively explores a large, complex hypothesis space in a structured way.

The use of structured hypothesis-code constraints is a smart design choice. It prevents the generated code from becoming syntactically invalid or financially nonsensical, which is a common challenge when using LLMs for code generation in specialized domains.

The integration with Qlib is another practical strength. Qlib is a battle-tested quantitative finance backtesting framework, and leveraging it allows QuantaAlpha to ground its factor evolution in real historical data rather than synthetic or toy datasets.

Benchmark results cited in the repo are concrete: an Information Coefficient (IC) of 0.1501, annualized excess return of 27.75%, max drawdown of 7.98%, and a Calmar Ratio of 3.4774 on major indices like CSI 300/500 and S&P 500. These figures indicate the evolved factors have meaningful predictive power and risk-adjusted returns.

The tradeoff is complexity and resource requirements. Running an LLM-driven evolutionary strategy with repeated backtesting is computationally intensive and requires careful environment setup. The codebase itself is Python-heavy with dependencies on ML models and finance data pipelines, so it’s not lightweight.

Quick start with QuantaAlpha

The project provides a clear quick start guide that lets you get the system up and running:

git clone https://github.com/QuantaAlpha/QuantaAlpha.git
cd QuantaAlpha
conda create -n quantaalpha python=3.10
conda activate quantaalpha

# Install the package in development mode
SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 pip install -e .

# Install additional dependencies
pip install -r requirements.txt

Then configure your environment variables by copying the example:

cp configs/.env.example .env

Editing .env allows you to specify API keys for LLM providers and other runtime settings.

From there, you can explore the factor mining pipeline and run experiments. The web UI offers a visual interface for managing these processes.

Verdict

QuantaAlpha is a sophisticated tool for quantitative researchers and data scientists looking to automate alpha factor discovery using LLMs combined with evolutionary algorithms. Its trajectory-based self-evolution loop is a clever approach to tackle the vast search space of factor hypotheses.

That said, it’s not plug-and-play for casual users. The setup requires a Python environment with specific dependencies, API keys for LLM providers, and access to financial data. Running full experiments demands substantial compute resources and patience.

If you are working in quantitative finance or research and want to experiment with AI-driven factor discovery, QuantaAlpha offers a well-engineered, extensible platform. Its honest tradeoffs around complexity and compute reflect the real-world challenges of automated quantitative research. The benchmarks are promising, but as with any backtested strategy, real-world robustness needs continuous validation.

Overall, it’s a worthwhile project to explore if you’re comfortable with Python, ML pipelines, and financial data backtesting, and curious about integrating LLMs in a closed-loop research system.


→ GitHub Repo: QuantaAlpha/QuantaAlpha ⭐ 760 · Python