Text Generation
Transformers
English
Chinese
finance
reinforcement-learning
reasoning
qwen3
alpha-screening
quantitative-finance
Instructions to use AFatRat/Alpha-R1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AFatRat/Alpha-R1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AFatRat/Alpha-R1")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AFatRat/Alpha-R1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AFatRat/Alpha-R1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AFatRat/Alpha-R1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AFatRat/Alpha-R1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AFatRat/Alpha-R1
- SGLang
How to use AFatRat/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 "AFatRat/Alpha-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AFatRat/Alpha-R1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "AFatRat/Alpha-R1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AFatRat/Alpha-R1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AFatRat/Alpha-R1 with Docker Model Runner:
docker model run hf.co/AFatRat/Alpha-R1
Update README.md
Browse files
README.md
CHANGED
|
@@ -122,6 +122,158 @@ The model is designed as a research tool for factor selection and should be used
|
|
| 122 |
|
| 123 |
---
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
# Limitations
|
| 126 |
|
| 127 |
- This model is **not** a financial advisor.
|
|
@@ -136,7 +288,7 @@ The model is designed as a research tool for factor selection and should be used
|
|
| 136 |
If you use Alpha-R1 in your research, please cite our paper:
|
| 137 |
|
| 138 |
```bibtex
|
| 139 |
-
@article{
|
| 140 |
title={Alpha-R1: Alpha Screening with LLM Reasoning via Reinforcement Learning},
|
| 141 |
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},
|
| 142 |
journal={arXiv preprint arXiv:2512.23515},
|
|
|
|
| 122 |
|
| 123 |
---
|
| 124 |
|
| 125 |
+
# Usage
|
| 126 |
+
|
| 127 |
+
Alpha-R1 is designed for **alpha screening** in quantitative investment research rather than general-purpose conversation.
|
| 128 |
+
|
| 129 |
+
Given:
|
| 130 |
+
|
| 131 |
+
- Current market conditions
|
| 132 |
+
- Historical market memory
|
| 133 |
+
- Candidate alpha factor descriptions
|
| 134 |
+
- Asset universe information
|
| 135 |
+
|
| 136 |
+
the model reasons about factor effectiveness under the prevailing market regime and selects factors that are more likely to generate excess returns.
|
| 137 |
+
|
| 138 |
+
## Example
|
| 139 |
+
|
| 140 |
+
```python
|
| 141 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 142 |
+
import torch
|
| 143 |
+
|
| 144 |
+
model_name = "FinStep-AI/Alpha-R1"
|
| 145 |
+
|
| 146 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 147 |
+
|
| 148 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 149 |
+
model_name,
|
| 150 |
+
torch_dtype="auto",
|
| 151 |
+
device_map="auto"
|
| 152 |
+
)
|
| 153 |
+
|
| 154 |
+
model.eval()
|
| 155 |
+
|
| 156 |
+
system_prompt = """
|
| 157 |
+
You are a senior quantitative investment expert, skilled in selecting
|
| 158 |
+
the most suitable alpha factor combinations based on market environment
|
| 159 |
+
and asset characteristics.
|
| 160 |
+
|
| 161 |
+
You need to analyze current market conditions, the characteristics of
|
| 162 |
+
each factor, and asset portfolio situations to provide scientific and
|
| 163 |
+
reasonable factor selection recommendations.
|
| 164 |
+
"""
|
| 165 |
+
|
| 166 |
+
user_prompt = """
|
| 167 |
+
Based on the following information, select the most suitable factor
|
| 168 |
+
combinations for {target_date}'s trading day for a {holding_days}-day
|
| 169 |
+
short-term strategy stock selection
|
| 170 |
+
(buy at market open, sell at market close after {holding_days} trading days).
|
| 171 |
+
|
| 172 |
+
Target Date:
|
| 173 |
+
{target_date}
|
| 174 |
+
|
| 175 |
+
Market Environment Information:
|
| 176 |
+
|
| 177 |
+
• Previous Trading Day Closing Data ({previous_trading_day}):
|
| 178 |
+
{market_price_data}
|
| 179 |
+
|
| 180 |
+
• Previous Trading Day Market Analysis ({previous_trading_day}):
|
| 181 |
+
{market_analysis}
|
| 182 |
+
|
| 183 |
+
• Current Day Pre-Market News ({target_date}):
|
| 184 |
+
{financial_news}
|
| 185 |
+
|
| 186 |
+
Available Factor Descriptions:
|
| 187 |
+
|
| 188 |
+
• {factor_1_name}:
|
| 189 |
+
{factor_1_description}
|
| 190 |
+
|
| 191 |
+
• {factor_2_name}:
|
| 192 |
+
{factor_2_description}
|
| 193 |
+
|
| 194 |
+
• {factor_3_name}:
|
| 195 |
+
{factor_3_description}
|
| 196 |
+
|
| 197 |
+
...
|
| 198 |
+
|
| 199 |
+
Asset Portfolio Information:
|
| 200 |
+
|
| 201 |
+
{asset_pool_information}
|
| 202 |
+
|
| 203 |
+
Analysis Framework:
|
| 204 |
+
|
| 205 |
+
1. Analyze each factor's nature and characteristics.
|
| 206 |
+
2. Evaluate factors' expected performance in the current market.
|
| 207 |
+
3. Consider portfolio characteristics for further screening.
|
| 208 |
+
4. Make the final selection (maximum 10 factors).
|
| 209 |
+
|
| 210 |
+
Output Requirements:
|
| 211 |
+
|
| 212 |
+
• Provide detailed analytical reasoning first.
|
| 213 |
+
• Output XML-tagged factor list:
|
| 214 |
+
<alpha_list><alpha001>...</alpha_list>
|
| 215 |
+
• Maximum 10 factors allowed.
|
| 216 |
+
• Skip selection if no factors are expected to yield positive returns.
|
| 217 |
+
"""
|
| 218 |
+
|
| 219 |
+
messages = [
|
| 220 |
+
{"role": "system", "content": system_prompt},
|
| 221 |
+
{"role": "user", "content": user_prompt},
|
| 222 |
+
]
|
| 223 |
+
|
| 224 |
+
text = tokenizer.apply_chat_template(
|
| 225 |
+
messages,
|
| 226 |
+
tokenize=False,
|
| 227 |
+
add_generation_prompt=True,
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
+
inputs = tokenizer(
|
| 231 |
+
text,
|
| 232 |
+
return_tensors="pt"
|
| 233 |
+
).to(model.device)
|
| 234 |
+
|
| 235 |
+
with torch.no_grad():
|
| 236 |
+
outputs = model.generate(
|
| 237 |
+
**inputs,
|
| 238 |
+
max_new_tokens=4096,
|
| 239 |
+
temperature=0.6,
|
| 240 |
+
top_p=0.95,
|
| 241 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 242 |
+
)
|
| 243 |
+
|
| 244 |
+
response = tokenizer.decode(
|
| 245 |
+
outputs[0][inputs.input_ids.shape[1]:],
|
| 246 |
+
skip_special_tokens=True,
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
print(response)
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
## Expected Output
|
| 253 |
+
|
| 254 |
+
```text
|
| 255 |
+
Factor analysis reasoning: [Detailed explanation of selection logic...]
|
| 256 |
+
The most suitable factor selection for the current market is: <alpha_list><alpha001><alpha003><alpha007></alpha_list>
|
| 257 |
+
```
|
| 258 |
+
|
| 259 |
+
## Generation Recommendations
|
| 260 |
+
|
| 261 |
+
```python
|
| 262 |
+
generation_config = {
|
| 263 |
+
"temperature": 0.6,
|
| 264 |
+
"top_p": 0.95,
|
| 265 |
+
"max_new_tokens": 4096,
|
| 266 |
+
}
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
For reproducible factor-screening results, we recommend:
|
| 270 |
+
|
| 271 |
+
```python
|
| 272 |
+
temperature=0
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
which is also consistent with the evaluation setting reported in the paper.
|
| 276 |
+
|
| 277 |
# Limitations
|
| 278 |
|
| 279 |
- This model is **not** a financial advisor.
|
|
|
|
| 288 |
If you use Alpha-R1 in your research, please cite our paper:
|
| 289 |
|
| 290 |
```bibtex
|
| 291 |
+
@article{jiang2025alphar1,
|
| 292 |
title={Alpha-R1: Alpha Screening with LLM Reasoning via Reinforcement Learning},
|
| 293 |
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},
|
| 294 |
journal={arXiv preprint arXiv:2512.23515},
|