ayatafoy's picture
Upload 2 files
29f5011 verified
|
Raw History Blame Contribute Delete
8.43 kB
metadata
license: cc-by-4.0
language:
  - en
task_categories:
  - text-generation
tags:
  - quantitative-finance
  - alpha-generation
  - formulaic-alphas
  - sft
  - reinforcement-learning
size_categories:
  - 100K<n<1M
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train.parquet
      - split: test
        path: data/test.parquet

GFT Quant Alphas SFT

512,544 prompt–completion pairs: a research brief in, one formulaic trading alpha out. The formulas use a small DSL in the style of WorldQuant's 101 Formulaic Alphas.

The answers were written by Qwen models (4B to 27B) during our reinforcement-learning runs on an alpha-generation gym, between July and October 2026.

Each row passed three filters:

  1. Valid formula. It was re-checked against the published grammar and evaluated on real market data.
  2. Exact brief. Its brief is the one the model actually saw, recovered and statistically verified (see How it was built).
  3. Backtest metrics. It was scored with one consistent backtest.
Split Rows US stocks Crypto Distinct briefs Source
train 507,236 376,807 130,429 1,341 answers sampled during RL training
test 5,308 2,566 2,742 212 greedy answers to held-out evaluation briefs

The two splits share no brief. Evaluation briefs come from a separate generator seed and a disjoint set of horizons, and no model was trained on them.

Example

[system] You are a quant researcher inventing ORIGINAL formulaic alphas in a small, strict DSL ... (full grammar in system_prompt.txt)
[user]   Market: US-listed stocks trading on weekday sessions.
         Design an alpha whose PRIMARY mechanism is: mixed-input volatility (risk measured on a price-volume composite)
         Target horizon: react over roughly 47-day windows (windows near 47 are appropriate; exact values are yours to choose).
         Inputs: must combine a price series with a non-price series.
         Structure: difference two windows of the SAME operator (fast minus slow).
         Constraint: do NOT window-jitter a textbook momentum spread and call it new
         Risk preference: prefer signals whose sign flips slowly (hold for the horizon).
[assistant] <alpha>rank(ts_std(volume, 47) / ts_std(close, 47))</alpha>

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: <alpha>formula</alpha>
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

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 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

@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}
}