Text Generation
Transformers
Safetensors
qwen3
finance
quantitative-trading
alpha-factor
reinforcement-learning
grpo
qlib
conversational
text-generation-inference
Instructions to use FinStep/Alpha-R1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FinStep/Alpha-R1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FinStep/Alpha-R1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FinStep/Alpha-R1") model = AutoModelForCausalLM.from_pretrained("FinStep/Alpha-R1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FinStep/Alpha-R1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FinStep/Alpha-R1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FinStep/Alpha-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FinStep/Alpha-R1
- SGLang
How to use FinStep/Alpha-R1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "FinStep/Alpha-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FinStep/Alpha-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "FinStep/Alpha-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FinStep/Alpha-R1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use FinStep/Alpha-R1 with Docker Model Runner:
docker model run hf.co/FinStep/Alpha-R1
| # Alpha-R1: Alpha Screening with LLM Reasoning via Reinforcement Learning | |
| <p align="center"> | |
| <img src="assets/Alpha-R1.png" alt="Alpha-R1" style="width: 100%; height: auto;"> | |
| </p> | |
| <p align="center"> | |
| <a href="https://huggingface.co/FinStep/Alpha-R1/blob/main/README_en.md">English</a> | <a href="https://huggingface.co/FinStep/Alpha-R1/blob/main/README.md">䏿–‡</a> | |
| </p> | |
| **Alpha-R1** is a reasoning-enhanced LLM for quantitative alpha selection: built on Qwen3-8B and trained with GRPO reinforcement learning ([verl](https://github.com/volcengine/verl)) using a market-feedback reward. It reasons over **semantic factor descriptions** — how each factor works, when it works, and when it fails — and selects the Alpha101 factors that best fit current market conditions. | |
| - 📄 Paper: [arXiv:2512.23515](https://arxiv.org/abs/2512.23515) | |
| - 💻 Code: [FinStep-AI/Alpha-R1](https://github.com/FinStep-AI/Alpha-R1) (inference pipeline / qlib backtesting / training config) | |
| - 📜 License: MIT | |
| ## Model Overview | |
| <p align="center"> | |
| <img src="assets/framework.png" alt="Alpha-R1 framework overview" style="width: 100%;"> | |
| </p> | |
| | Item | Content | | |
| |---|---| | |
| | Base model | [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) | | |
| | Training | GRPO (verl) with a market-feedback reward | | |
| | Input | Decision-context prompt: concatenated semantic factor descriptions `α_des` | | |
| | Output | Selected factors listed in `<alpha_list>` | | |
| | Candidate pool | 82 Alpha101 factors (as screened in the paper) | | |
| | Recommended decoding | temperature=0 (greedy), top_p=0.7, max_new_tokens=4096 | | |
| ## Quick Start | |
| ### transformers | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = "FinStep/Alpha-R1" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16", device_map="auto") | |
| prompt = "<decision context: concatenated factor descriptions>" # see the GitHub repo for the prompt builder | |
| inputs = tokenizer.apply_chat_template( | |
| [{"role": "user", "content": prompt}], | |
| add_generation_prompt=True, return_tensors="pt", | |
| ).to(model.device) | |
| # paper setting: temperature=0 (greedy), top_p=0.7 | |
| out = model.generate(inputs, max_new_tokens=4096, do_sample=False) | |
| print(tokenizer.decode(out[0][inputs.shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| ### vLLM | |
| ```python | |
| from vllm import LLM, SamplingParams | |
| llm = LLM(model="FinStep/Alpha-R1") | |
| params = SamplingParams(temperature=0.0, top_p=0.7, max_tokens=4096) | |
| outputs = llm.chat([[{"role": "user", "content": prompt}]], params) | |
| ``` | |
| For the full end-to-end pipeline (factor description generation → Alpha-R1 inference → output parsing → qlib strategy backtest), see the [GitHub repository](https://github.com/FinStep-AI/Alpha-R1). | |
| ## Output Contract | |
| The model lists the selected factor ids inside `<alpha_list>...</alpha_list>`, e.g.: | |
| ``` | |
| <alpha_list>alpha001, alpha021, alpha053</alpha_list> | |
| ``` | |
| Validation and parsing scripts are provided under `src/alpha_r1/parsing/` in the GitHub repository. | |
| ## Performance | |
| 12-month out-of-sample testing (2025-01-01 to 2025-12-31, paper Table 1): | |
| <p align="center"> | |
| <img src="assets/main_results.png" alt="Backtest NAV comparison on S&P 500 (left) and CSI 300 (right)" style="width: 100%;"> | |
| </p> | |
| <table> | |
| <thead> | |
| <tr> | |
| <th rowspan="2">Type</th> | |
| <th rowspan="2" width="160">Method</th> | |
| <th colspan="3">S&P 500</th> | |
| <th colspan="3">CSI 300</th> | |
| </tr> | |
| <tr> | |
| <th>AR (%)</th> | |
| <th>SR</th> | |
| <th>MDD (%)</th> | |
| <th>AR (%)</th> | |
| <th>SR</th> | |
| <th>MDD (%)</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr><td rowspan="9">Non-LLM</td><td>Buy & Hold</td><td>19.34</td><td>0.80</td><td>18.75</td><td>22.16</td><td>1.31</td><td>10.49</td></tr> | |
| <tr><td>PCA</td><td>7.98</td><td>0.27</td><td>17.30</td><td>2.93</td><td>0.17</td><td>14.46</td></tr> | |
| <tr><td>XGBoost</td><td>3.49</td><td>0.03</td><td>18.45</td><td>8.99</td><td>0.50</td><td>16.26</td></tr> | |
| <tr><td>LightGBM</td><td>-5.42</td><td>-0.43</td><td>20.93</td><td>18.44</td><td>1.05</td><td>14.92</td></tr> | |
| <tr><td>A2C</td><td>10.82</td><td>0.40</td><td>17.70</td><td>22.96</td><td>1.20</td><td>14.86</td></tr> | |
| <tr><td>PPO</td><td>7.68</td><td>0.25</td><td>14.97</td><td>14.96</td><td>0.81</td><td>12.95</td></tr> | |
| <tr><td>DDPG</td><td>2.53</td><td>-0.02</td><td>15.04</td><td>1.97</td><td>0.12</td><td>16.54</td></tr> | |
| <tr><td>TD3</td><td>5.54</td><td>0.14</td><td>16.58</td><td>8.66</td><td>0.52</td><td>10.26</td></tr> | |
| <tr><td>SAC</td><td>37.60</td><td>1.44</td><td>15.18</td><td>9.77</td><td>0.56</td><td>11.68</td></tr> | |
| <tr><td rowspan="5">LLM</td><td>Gemini 2.5 Pro</td><td>14.23</td><td>0.55</td><td>17.01</td><td>16.29</td><td>0.90</td><td>14.01</td></tr> | |
| <tr><td>Claude 3.7 Sonnet</td><td>10.92</td><td>0.40</td><td>18.88</td><td>10.13</td><td>0.57</td><td>14.49</td></tr> | |
| <tr><td>DeepSeek‑R1</td><td>21.94</td><td>0.93</td><td><b>14.36</b></td><td>14.66</td><td>0.81</td><td>14.60</td></tr> | |
| <tr><td>Qwen3‑8B</td><td>12.85</td><td>0.47</td><td>19.52</td><td>15.44</td><td>0.79</td><td>14.38</td></tr> | |
| <tr><td><b>Alpha‑R1 (Ours)</b></td><td><b>47.87</b></td><td><b>1.62</b></td><td>16.91</td><td><b>40.57</b></td><td><b>2.23</b></td><td><b>6.58</b></td></tr> | |
| </tbody> | |
| </table> | |
| Out-of-domain generalization without retraining (paper Table 2): 80.54% AR (SR 2.46) on Russell 2000 and 73.52% AR (SR 2.80) on CSI 1000. AR = annualized return, SR = excess Sharpe ratio, MDD = max drawdown. | |
| ## Training | |
| Alpha-R1 is trained on Qwen3-8B with GRPO using verl and a market-feedback reward (`R_final = R_adjusted - P_structural`, paper Section 3.4). The training configuration and a reference reward implementation live in the `training/` directory of the GitHub repository. | |
| ## Limitations | |
| - This model is intended for academic research; its outputs do not constitute investment advice. | |
| - Factor selection depends on the upstream description-generation and backtesting pipeline (see the GitHub repository); the model alone does not produce tradable signals. | |
| ## Citation | |
| ```bibtex | |
| @article{jiang2025alphar1, | |
| title={Alpha-R1: Alpha Screening with LLM Reasoning via Reinforcement Learning}, | |
| author={Jiang, Zuoyou and Zhao, Li and Sun, Rui and Sun, Ruohan and Li, Zhongjian and Li, Jing and Jiang, Daxin and Bai, Zuo and Hua, Cheng}, | |
| journal={arXiv preprint arXiv:2512.23515}, | |
| year={2025} | |
| } | |
| ``` | |
| ## License | |
| This project is released under the [MIT License](https://opensource.org/licenses/MIT). | |