--- license: cc-by-4.0 language: - en task_categories: - text-generation tags: - quantitative-finance - alpha-generation - formulaic-alphas - sft - reinforcement-learning size_categories: - 100Krank(ts_std(volume, 47) / ts_std(close, 47)) ``` ## Columns | Column | Meaning | |---|---| | `prompt` | Chat messages: the system prompt with the DSL grammar, then the brief. This is TRL's conversational prompt–completion format | | `completion` | One assistant message: `formula` | | `formula` | The formula alone | | `market` | `us-equities` or `crypto` | | `brief_mechanism`, `brief_window`, `brief_inputs`, `brief_structure`, `brief_constraint`, `brief_risk` | The brief's fields, parsed from its text | | `inputs_ok`, `structure_ok`, `horizon_ok` | Whether the formula meets the brief's input rule, its structure rule, and has a window within 0.67×–1.5× of the brief's horizon | | `follows_brief` | All three checks above pass. The economic mechanism line is not checked | | `n_nodes`, `lookback` | Size of the formula's parse tree; total nested lookback in days | | `train_sharpe`, `train_turnover` | Annualized net Sharpe and mean daily turnover on the train window | | `holdout_sharpe`, `holdout_return`, `holdout_turnover` | The same on the year after the train window, plus its total net return | | `models` | The models that produced this exact pair | | `n_runs`, `n_samples` | How many runs, and how many sampled answers, produced it | | `source` | `rl_rollout` (train split) or `probe` (test split) | ## Quick start ```python from datasets import load_dataset ds = load_dataset("g-factor-technologies/GFT-Quant-Alphas-SFT") # A stricter SFT subset: follows the brief and earns a positive train-window Sharpe. good = ds["train"].filter(lambda r: r["follows_brief"] and r["train_sharpe"] > 0.5) # 22,771 rows ``` The `prompt` and `completion` columns plug directly into TRL's `SFTTrainer`. Select rows on train-window metrics only, and keep the holdout columns for evaluation; otherwise the holdout year stops being out of sample. ## How it was built **Sources.** The data comes from 134 GRPO runs logged between 2026-07-13 and 2026-10-05: - **Training split:** every answer the trainer sampled. - **Test split:** the periodic greedy probe on 50 evaluation briefs. **Recovering the brief.** Training logs store the answers in order, but not which brief each answer was for. We rebuilt each run's prompt order from its own code version and seed: the prompt bank, its filters and samplers, and TRL's seeded shuffle. We kept a run only if the recovered briefs proved correct on its answers. Here is how the check works: - Models often reuse the brief's horizon as a window. - Across kept runs, 60–98% of formulas contain the brief's exact window. With the briefs shuffled, only 5–12% do. - Off-by-one or wrong-seed replays fall to the shuffled rate. Runs whose order could only be estimated were dropped, and so were multi-turn tool-use episodes. **Valid formula.** Every formula must pass all of these checks: - It parses under the grammar in [`system_prompt.txt`](system_prompt.txt) and uses only the listed operators. - Windows are integers from 1 to 252, and the total nested lookback is at most 252 days. - It contains no epsilon constants. - It is wrapped in `rank(...)` or `scale(...)`. - It is not a static price-level book. - On the train window it gives finite values, varies across assets on most days, and produces positions that are active and change over time. Of 680,226 distinct logged formulas, 584,171 passed. **Normalization.** The data was cleaned in three ways: - **System prompt:** every row uses the current system prompt. Older runs used earlier variants of it, for example with another lookback limit or with a one-sentence rationale before the formula. - **Briefs:** briefs from the first generator version had no `Market:` line and were US-stock only, so they got the current generator's US market line. - **Formulas:** formulas were re-spelled from their parse tree, giving uniform spacing and no redundant parentheses. Each new spelling parses back to the identical tree. Pairs that became identical were merged; `n_samples` keeps the count. ## Metrics The engine is the same for every row: - **Book:** the formula's values are ranked across assets each day, demeaned and scaled to a dollar-neutral book with gross exposure 1. Trades fill at the next open. - **Costs:** - 3.5 bps per unit of turnover; - square-root market impact on a $1M book, plus a capacity penalty; - 50 bps a year for borrowing stock to short. | Market | Universe | Train window | Holdout year | Days per year | |---|---|---|---|---| | `us-equities` | 46 US large caps | 2012-06-29 to 2025-08-20 | 2025-08-21 to 2026-08-21 | 252 | | `crypto` | 42 Coinbase spot assets | 2022-02-01 to 2025-08-20 | 2025-08-21 to 2026-08-20 | 365 | Most answers are exploration, not finished alphas. In `train`, 29% of rows have a positive train-window Sharpe and 8% are above 0.5. Price data is not included. ## Limitations - **Volume and family quality.** Models trained with RL repeat families. Many rows are window variants of one idea, so the set holds fewer distinct ideas than rows. - **Brief compliance.** 43% of `train` rows follow every checkable rule of their brief. The economic mechanism is never checked. - **Metrics.** The metrics come from one cost model, one universe per market and one holdout year. The stock universe has survivorship bias: today's large caps are followed back to 2012. - **Not advice.** This is research data, not investment advice. ## Related - Model: [g-factor-technologies/Qwen3.8-27B-GFT-Quant-LoRA](https://huggingface.co/g-factor-technologies/Qwen3.8-27B-GFT-Quant-LoRA) - Write-up: [Teaching a 27B Model to Write Trading Alphas](https://www.g-ftech.com/blog/llm-alpha-gym-trading-formulas-rewards) - Training recipe: [Multi-Reward RL, Part 3](https://www.g-ftech.com/blog/multi-reward-rl-part-3-gdpo-cispo-repo-r-27b) ```bibtex @misc{gfactor2026alphasft, title = {GFT Quant Alphas SFT: verified brief-to-formula pairs from RL alpha-generation runs}, author = {Romanov, Aleksei and {g factor technologies}}, year = {2026}, url = {https://huggingface.co/datasets/g-factor-technologies/GFT-Quant-Alphas-SFT} } ```