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
140 changes: 140 additions & 0 deletions bench/BENCH_COEVOLUTION_GLM53_2025_2026.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Bench: co-evolving harness and strategy on GLM 5.3's proposals (2025 search → 2026 test)

One question: if you let the harness and the strategy hunt co-evolve at the same time, does
it find something that survives a regime change? Setup is deliberately clean — GLM 5.3
proposes with retrieval off, everything is fitted inside 2025, and 2026 is only scored at the end.

Reproduce with:

```bash
python -m bench.coevolve_dual_ma --fetch --out bench/bench_coevolution_report.json
```

## Data and split

Ten NASDAQ large caps — AAPL, MSFT, NVDA, AMZN, GOOGL, META, TSLA, AVGO, COST, NFLX —
daily adjusted OHLC from `yf.download(..., auto_adjust=True)`.

| | Window | Bars |
| --- | --- | ---: |
| Search (pattern finding) | 2025-01-02 → 2025-12-31 | 250 |
| Test (never used for selection) | 2026-01-02 → 2026-12-01 | 231 |

Search-window regime: mean return +21.5%, mean annualized vol 38.4%, median buy-and-hold
Sharpe 0.55, mean max drawdown −32.2%, 7 of 10 names above their 200-day SMA. High-vol names
with violent drawdowns — a fair trend-following test.

## Proposer: GLM 5.3, no retrieval

The harness cannot call a model in-process (`create_planner()` → `FallbackPlanner`, no
credentials, no GLM provider), so `zai-glm-5-3` acted as the proposer through a pinned
text-only session with web search disabled. It was given only the 2025 statistics and a fixed
grid, and replied:

| Params | Confidence |
| --- | ---: |
| 20/50 | 0.80 |
| 15/30 | 0.70 |
| 30/80 | 0.65 |
| 10/20 | 0.50 |
| 40/100 | 0.40 |

## Co-evolution

Two coupled populations, both selected on 2025 only:

- **Harness genome** (how we hunt): holding horizon ∈ {1,3,5}, SMA200 trend filter ∈ {off,on},
drawdown gate ∈ {0.15,0.20,0.25}, selection rule ∈ {mean Sharpe, worst name, Sharpe-over-DD}.
- **Strategy genome** (what we hunt): the 31 fast/slow pairs from the grid, seeded with GLM's five.

Harness fitness uses one common yardstick — the mean 2025 Sharpe of the strategy that harness
would actually pick — so selection rules are comparable; the rule decides *which* strategy a
harness picks, not how the harness is scored. 15 generations, 10 harnesses, 26 strategies.

Result: converged to **50/80, 5-bar hold, DD gate 0.25, mean-Sharpe rule, search fitness
1.1164** — and that is *exactly* the brute-force optimum over the whole space, verified by
exhaustive enumeration. The co-evolution is a correct search; it is not an approximation.

## The 2026 test

2026 is never used by selection. Indicators are warmed on 2025 prices, so each strategy enters
2026 in the state it would really have had (an earlier version of this bench cold-started on
Jan 2 and flattered every number; see the commit history). Buy-and-hold uses the same Sharpe
function and positive-drawdown convention as the strategies.

| Candidate | 2026 mean Sharpe | Mean max DD | Names ≥ 0.3 |
| --- | ---: | ---: | ---: |
| Co-evolved winner (50/80, H=5, gate 0.25) | **−0.589** | 28.1% | 1/10 |
| Control: same 50/80 under the fixed baseline harness (H=1) | −0.719 | 28.5% | 1/10 |
| GLM 5.3 top pick (20/50, H=1) | −0.356 | 23.9% | 1/10 |
| Buy and hold | **+0.278** | 30.8% | n/a |

All five GLM proposals, scored under the fixed baseline harness (H=1, gate 0.25, mean-Sharpe):

| Params | Confidence | 2026 mean Sharpe | Names ≥ 0.3 |
| --- | ---: | ---: | ---: |
| 10/20 | 0.50 | −0.030 | 4/10 |
| 15/30 | 0.70 | −0.173 | 2/10 |
| 20/50 | 0.80 | −0.356 | 1/10 |
| 30/80 | 0.65 | −0.510 | 2/10 |
| 40/100 | 0.40 | −0.682 | 2/10 |

Every candidate loses to buy-and-hold on risk-adjusted terms. The co-evolved winner is *worse*
than GLM's top pick: the evolved harness did not add anything over the proposal, and the
strategy it chose (50/80) is the same one the fixed-harness control picks from 2025 alone.
Co-evolution therefore cannot be credited with any 2026 outcome; the control isolates that.

## Why: the strategy family failed, not the proposer

An oracle over 186 configurations (31 pairs × 3 horizons × trend filter on/off), scored *on 2026
itself* (in-sample by construction, diagnostic only), finds only **6 of 186** with a positive
mean Sharpe; the best is **+0.077** (15/30, 3-bar hold, SMA200 filter on). So even with
hindsight and the trend filter no dual-MA configuration on this universe approaches
buy-and-hold (+0.278) in 2026.

## Takeaways

- **The search is exact but not the bottleneck.** The exhaustive search maximises the same
fitness over all feasible (harness, strategy) pairs, an upper bound on what co-evolution can
reach. Co-evolution reached it at seed 7 and at four more seeds (8-11), all at fitness
1.1164. Five seeds on a 54×31 space is a sanity check, not a proof.
- **The evolved harness drifted toward looseness, and that is built in.** Harness fitness is
the best mean Sharpe among strategies the harness admits, so a looser drawdown gate admits a
superset and cannot score lower. The 0.25 gate is the guaranteed outcome of the gene
encoding, not evidence of anything about 2026.
- **GLM's confidence did not track transfer.** Its top-confidence pick was mid-table, the
lowest-confidence pick was worst, and the second-lowest (10/20 at 0.50) was best.
- **Buy-and-hold is the honest benchmark here.** On a 2025→2026 regime break, a long/cash
crossover on high-vol NASDAQ names lost risk-adjusted return in the test year.

## Smoke test of the harness itself

`agentquant run --ticker AAPL --start 2025-01-02 --end 2026-12-01` runs end to end:
`run_status: passed_quality_gate`, `costs.tool_calls: 0.0`, top pick 50/200 at Sharpe 1.042.
It spans both windows, so it leaks the test year and is a plumbing check only, not a result.

## Caveats

- GLM 5.3 is not callable over HTTP here; it proposed via a pinned session, and the harness ran
its own grid search through `FallbackPlanner`. This benches proposals plus this co-evolution
loop, not the model's agency inside the harness.
- Web search was off (`HarnessConfig.use_web_search` false; run manifest records
`tool_calls: 0.0`). Disabling retrieval does **not** remove memorised market knowledge, and
`zai-glm-5-3` is absent from `src/agent/knowledge_cutoffs.py`, so the harness's own
contamination check flags any 2026 evaluation window.
- The oracle table is in-sample and diagnostic — it is there to show the strategy family failed,
not as a candidate.
- The search space (31 pairs × 3 horizons × 2 filters × 3 gates × 3 rules) is small enough that
co-evolution is not needed; matching brute force is only a correctness check.
- One split, one test year, no multiplicity correction. Five seeds were run for the search
check. Nothing here is a validated score.
- The test window is scored many times (candidates, controls, and the 186-config oracle), so
it is now spent: do not reuse 2026 to pick anything.
- Strategy-side evolution is selection among a 26-member pool by best feasible fitness, plus
crossover; it is not independent of the harness. No random-search control at equal budget.
- Every one of the five proposals breached the 0.20 drawdown gate during the 2025 search
(21.5%–31.1% on the worst name), so none was admissible under the stricter gate; they only
became candidates once the evolved harness loosened it to 0.25. So the table above compares
proposals under a gate none of them satisfies.

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