Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions bench/BENCH_TWO_MODEL_DUAL_MA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Bench: one harness, two proposer models, three market windows

Same unmodified harness, same strategy (SPY-style dual-moving-average momentum: long while
fast SMA > slow SMA, else cash), same scoring engine
(`src.backtest.simple_backtest.basic_momentum_backtest`), same gates (min Sharpe 0.3, max
drawdown 0.20). Only the proposer changes.

The harness's in-process LLM planners have no API key in this environment — `GOOGLE_API_KEY`,
`OPENAI_API_KEY` and `ANTHROPIC_API_KEY` are all unset, so `create_planner()` returns
`FallbackPlanner` and every recorded `strategy_runs` row is `generation_method: grid_search`.
So each model acted as the proposer through a Vibe session pinned to it, exactly as in
`bench/BENCH_DEEPSSEEK_V4_1_FLASH.md`:

| Model | Proposer session | Prompt |
| --- | --- | --- |
| `deepseek-v4-1-flash-1017` | this session | regime slice + task, JSON-only reply |
| `zai-glm-5-3` | `907226ef-e45c-eeab-8b37-744635d4b1b7` | identical prompt, verbatim |

This benches the models *as proposers*. It does not exercise the harness's provider adapters,
because no credentials exist to exercise them.

## Protocol A — anchor: SPY daily, 2021-12-03 → 2026-12-02

Search slice = first 80% (2021-12-03 → 2025-12-02, 1003 bars), sealed trailing 20% holdout
(2025-12-03 → 2026-12-02, 251 bars), graded once per proposal. Regime context both models saw:
+10.9% vs SMA200, SMA50 > SMA200 by +9.2%, 21d −0.08%, 63d +6.2%, 126d +15.0%, VIX 16.6
(37.7th pctile of 1y).

| Model | Params | In-sample Sharpe | IS max DD | Holdout Sharpe | IS − holdout |
| --- | --- | ---: | ---: | ---: | ---: |
| deepseek | 20/100 | 0.548 | 23.2% | **+0.552** | −0.00 |
| deepseek | 10/50 | 0.829 | 11.9% | +0.169 | +0.66 |
| deepseek | 50/200 | 0.815 | 18.8% | −0.186 | +1.00 |
| deepseek | 20/50 | 0.171 | 28.9% | +0.455 | −0.28 |
| deepseek | 30/150 | **0.947** | 10.2% | −0.194 | +1.14 |
| glm | 50/200 | 0.815 | 18.8% | −0.186 | +1.00 |
| glm | 20/100 | 0.548 | 23.2% | **+0.552** | −0.00 |
| glm | 100/200 | 0.992 | 18.8% | +0.406 | +0.59 |
| glm | 40/150 | **1.216** | 10.0% | −0.179 | +1.40 |
| glm | 10/200 | 1.100 | 10.1% | +0.141 | +0.96 |

Mean in-sample Sharpe: deepseek 0.662, **glm 0.934**. Mean holdout Sharpe: deepseek 0.159,
glm 0.147.

## Protocol B — new universe, new window: 2015-01-02 → 2019-12-30

Fetched for this bench, not previously in `data_store/`:

```python
yf.download(t, start="2015-01-01", end="2019-12-31", auto_adjust=True)
```

Seven assets — SPY, QQQ, AAPL, NVDA, XLE, TLT, GLD — 1257 daily bars each. Search
2015-01-02 → 2018-12-28, sealed trailing holdout 2018-12-31 → 2019-12-30 (20%).

Both models saw only the 2021-2025 regime prompt, so their proposal sets are held fixed and
merely re-scored here. That makes this a test of proposal transfer, not regime reading.

| Model | Mean IS Sharpe (5 proposals × 7 assets) | Mean holdout Sharpe of best-IS pick |
| --- | ---: | ---: |
| deepseek-v4-1-flash-1017 | **0.426** | 1.023 |
| zai-glm-5-3 | 0.409 | **1.229** |

Best-IS pick per asset:

| Asset | deepseek pick | IS | holdout | glm pick | IS | holdout |
| --- | --- | ---: | ---: | --- | ---: | ---: |
| SPY | 20/50 | 1.033 | 1.127 | 20/100 | 0.462 | 1.523 |
| QQQ | 20/100 | 0.643 | 1.595 | 40/150 | 0.643 | 1.561 |
| AAPL | 10/50 | 0.753 | 2.567 | 10/200 | 0.879 | 2.476 |
| NVDA | 30/150 | 1.546 | 0.628 | 10/200 | **1.660** | 1.044 |
| XLE | 50/200 | 0.118 | −0.491 | 10/200 | 0.238 | 0.262 |
| TLT | 20/100 | 0.132 | 1.167 | 20/100 | 0.132 | 1.167 |
| GLD | 50/200 | 0.073 | 0.568 | 50/200 | 0.073 | 0.568 |

TLT and GLD agree because both models proposed 20/100 and 50/200.

## Protocol C — breadth and holding horizon: 50 names, 7-bar and 30-bar holds

A literal "50 stocks over 7 days" cannot work: a 7-bar daily series cannot support an SMA200,
or any slow window above 7. So the span became the holding horizon instead — daily bars over
the full 2015-2019 window, the same signal rule as the engine, but the position is sampled
every H bars and held H bars.

Fifty large caps, all listed before 2015 (AAPL, MSFT, AMZN … MMM, HON, LMT); the 30-bar run
uses a sector-diverse ten (AAPL, NVDA, JPM, GS, XOM, CVX, JNJ, WMT, DIS, CAT). Same split:
search 2015-01-02 → 2018-12-28, trailing 20% holdout after. `H=1` reproduces
`basic_momentum_backtest` to floating-point equality, asserted before the bench ran, so this
is the engine plus a hold rather than a reimplementation.

| Run | Model | Mean IS Sharpe | Mean holdout of best-IS pick | Tickers clearing 0.3 holdout gate |
| --- | --- | ---: | ---: | ---: |
| 50 names, H=7 | deepseek | 0.388 | 0.609 | 34/50 |
| 50 names, H=7 | glm | 0.387 | 0.787 | 34/50 |
| 10 names, H=30 | deepseek | 0.378 | 1.063 | 7/10 |
| 10 names, H=30 | glm | **0.417** | 0.938 | 7/10 |
| 50 names, H=1 (reference) | deepseek | 0.389 | 0.641 | 33/50 |
| 50 names, H=1 (reference) | glm | 0.380 | 0.751 | 36/50 |

Best configs by mean IS Sharpe across names:

| Run | Top configs (mean IS / mean holdout) |
| --- | --- |
| H=7 | 100/200 0.459 / 1.032 · 20/50 0.438 / 0.604 · 10/50 0.410 / 0.686 |
| H=30 | 10/200 0.489 / 0.983 · 40/150 0.425 / 0.997 · 10/50 0.409 / 0.820 |
| H=1 | 20/50 0.448 / 0.571 · 100/200 0.447 / 0.811 · 10/50 0.412 / 0.791 |

## Takeaways

- **On the anchor slice GLM 5.3 proposes better in-sample picks** — mean 0.934 vs 0.662, best
1.216 (40/150) vs 0.947 (30/150). Higher confidence too: GLM put 0.85 on its top pick,
DeepSeek 0.66.
- **Neither model's top in-sample pick beats the gate out of sample.** Each model's best-IS
pick (DeepSeek 30/150, GLM 40/150) has an IS−holdout gap of +1.14 / +1.40 and lands at
−0.19 / −0.18 holdout Sharpe, under the 0.3 gate. Gaps vary across the other proposals:
20/100 held up (+0.552, gap about 0, proposed by both models), 20/50 (+0.455) and 100/200
(+0.406) also cleared 0.3, while 10/50 and 10/200 stayed below it. This is one holdout
slice with ten proposals and multiple comparisons, so treat it as suggestive.
- **Proposal quality does not transfer.** On the 2015-2019 basket the ranking inverts on
in-sample score (DeepSeek 0.426 vs GLM 0.409, a dead heat) and GLM's edge shows up only in
holdout of its best pick (1.229 vs 1.023). With ten proposals across seven assets this
difference is noise, not a ranking.
- **Both models converge on the same region** — 20/100 and 50/200 appear in both sets
regardless of model, and confidence ordering tracks in-sample Sharpe almost mechanically.
The regime prompt shifts the *rationale* more than the *parameters*.
- **Breadth erases the model difference.** Over 50 names the two proposers tie at H=7 (0.388 vs
0.387) and differ only by noise at H=30 on ten names. The anchor's 0.662-vs-0.934 gap was
five correlated configs scored on one instrument; it does not survive a cross-section.
- **The holding horizon is nearly free but adds no edge.** Going from holding 1 bar to 7 moves
mean in-sample Sharpe by 0.001 (0.389 → 0.388) while cutting turnover about sevenfold. At 30
bars the ten-name sample is too thin to read: roughly 42 rebalances, so that column is
directional only.
- **Config rankings do not transfer either.** 100/200 tops the 50-name breadth test (0.459),
while the SPY anchor crowned GLM's 40/150 (1.216) and the 10-name 30-bar run favours 10/200
(0.489). No pair is consistently best across universe or horizon.
- **Gate pass rates track the window, not the models.** 34/50 names clear the 0.3 holdout gate
on this 2015-2019 basket while the same rule and params mostly fail the 2025-26 SPY holdout.
- Consistent with the harness's thesis: the sealed holdout, not in-sample Sharpe, is the
honest score, and it is the same score for either proposer here.

## Caveats

- No model was called over HTTP. Proposal sessions are pinned Vibe sessions; the deterministic
engine did all scoring. Nothing here validates the harness's LLM provider plumbing.
- The `deepseek-v4-1-flash-1017` set is the one already reported as run 1 in
`bench/BENCH_DEEPSSEEK_V4_1_FLASH.md`. Its numbers were reproduced bit-for-bit before this
bench was written, as a check on the scoring path.
- The 2015-2019 trailing holdout is a single bull year (2019), so its holdout sharpes are
flattering and are not comparable with the 2025-26 anchor holdout.
- One grading per proposal per window, no re-grading, no multiplicity correction across ten
proposals and two models. No in-sample Sharpe here is a validated score.
- Protocol C's 50-name universe and its 7/30-bar horizons were chosen after the SPY anchor and
the seven-asset basket were already scored, so protocol C is a robustness check, not a
pre-registered test.
- `20/100` breaches the 0.20 drawdown gate in-sample (23.2%) on the anchor slice; the best
picks sit at 10-19%.

Full machine-readable report: `bench/bench_two_model_report.json`.
Loading
Loading