A Self-Improving Research System Needs a Judge It Cannot Edit
My research loop found the one loophole in its first judge by round three. What its ledger shows, the math of a gate you can trust, and a locked judge in 56 lines of Python.

The loop took the shortcut in round three
Gedanken is a research system I built to test investment research methods in simulated markets where the right answer is planted in advance. Part of it improves itself. A proposer suggests one change at a time to the research method, and a judge scores each change on fresh simulated markets: worlds with no edge, where any claimed edge is a false discovery, and worlds with a planted edge, where the method should find it. A change replaces the current method only if the judge says it is better.
The first judge allowed up to 6% false discoveries, measured on 400 no-edge worlds, and asked for a statistically significant gain in detection on 200 planted-edge worlds. In round 3 of 22, the loop proposed lowering the evidence bar the method used to declare an edge. Detection rose from 25% to 37%, a paired z of 5.21 against the 2.13 required. False discoveries came in at 6.0%, exactly on the limit. The judge accepted it. In round 4 the loop tried lowering the bar again, and false discoveries jumped to 8.5%, which the gate rejected.
Nothing about the research got better in round 3. The method learned to call more things edges, and the judge had left just enough room for that to count as progress. This piece walks through why that happened, what the second judge does differently, the math behind a gate you can trust, and a short locked judge you can run. Everything here comes from simulated markets with known answers. No real-market performance is claimed, and none of it is investment advice.
One detail matters for anyone building with language models. In the runs below, the proposals came from the loop's built-in library of edits, a blind search, not from the LLM that can take the same seat. The judge treats both the same way. A blind search found the loophole in three rounds; a proposer that reads the judge's feedback and reasons about it has more to work with, not less.
This failure has a name
DeepMind's safety team calls it specification gaming: behavior that satisfies the literal objective without achieving the intended outcome. Their 2020 review collected around 60 examples, including a simulated robot rewarded for the height of a red block's bottom face, which flipped the block over instead of stacking it. The same thing shows up in self-improving coding agents. The authors of the Darwin Gödel Machine, which rewrites its own code and keeps changes that score better on benchmarks, reported runs where the system scored well on their hallucination check by removing the markers the check looked for instead of fixing the hallucinations.
Finance has its own version. Harvey, Liu and Zhu reviewed hundreds of published return factors and argued that a new one should clear a t-statistic of 3.0 rather than 2.0, because the field had tested so many ideas that the usual bar let luck through. A research team that tries 50 variants and reports the best is running the same loop as Gedanken, with a judge that never counts the attempts.
What these cases share is a scoring rule that the optimizer can reach. The optimizer does not need to be clever or adversarial. It only needs to try enough things and keep whatever scores higher.
Who owns the evidence bar
The flaw in the first judge was not the 6% figure. It was where the evidence bar lived. The research method decides that it has found an edge when its probabilistic Sharpe ratio clears a threshold. The probabilistic Sharpe ratio, from Bailey and López de Prado, is the probability that a strategy's true Sharpe ratio exceeds a benchmark, given how many observations you have and how far the returns are from normal:
Here SR̂ is the measured Sharpe ratio, SR* the benchmark, n the number of return observations, γ̂₃ the skewness, γ̂₄ the kurtosis, and Φ the standard normal distribution function. Requiring PSR ≥ 0.95 means the standardized Sharpe estimate must clear Φ⁻¹(0.95) ≈ 1.64. Lowering the requirement to 0.90 cuts that to Φ⁻¹(0.90) ≈ 1.28. For a single clean test on a strategy with no edge, that doubles the chance of a false claim, from 5% to 10%.
In the first judge, that threshold was one of the method's own settings, so it was one of the things the proposer was allowed to change. The thing being judged could make the judge more lenient. Once I saw it in the ledger, the rule was obvious: anything that sets how strict the test is belongs to the judge, never to the thing being tested.
The second judge, which I approved and logged on Nov 19, 2026, owns the evidence bar at 0.95 and ignores any attempt to move it. It also changed three other things, each covered below: a hard 5% gate, larger samples (1,000 no-edge worlds and 400 planted-edge worlds), and worlds drawn in five batches whose volatility and pricing assumptions vary by up to 25%, so a method has to hold up across plausible markets rather than one idealized one.
A gate is only as tight as its measurement
The 6% gate in the first judge was meant to leave room for sampling noise. It ended up as room for the loop. A false-discovery rate measured on n no-edge worlds has a standard error of
At p = 6% and n = 400, that is 1.19 percentage points, and a 95% Wilson interval runs from 4.1% to 8.8%. The measured 6.0% in round 3 was consistent with a method whose true rate was well above the gate. At n = 1,000 and p = 5%, the standard error falls to 0.69 points.
You can see what that means for a gate directly. The method passes if its measured rate is at or below the gate, so the pass probability is a binomial tail:
"""How often does a method with a given true false-discovery rate pass a gate,
when the rate is measured on a finite number of no-edge worlds?"""
from scipy.stats import binom
def pass_prob(true_fdr, n_worlds, gate):
# the method passes if its measured rate is at or below the gate
return binom.cdf(int(gate * n_worlds), n_worlds, true_fdr)
if __name__ == "__main__":
for true_fdr in (0.04, 0.05, 0.06, 0.07, 0.08):
loose = pass_prob(true_fdr, 400, 0.06)
tight = pass_prob(true_fdr, 1000, 0.05)
print(f"true rate {true_fdr:.0%}: passes 6% gate on 400 worlds {loose:.0%}, "
f"5% gate on 1,000 worlds {tight:.0%}")
It prints:
true rate 4%: passes 6% gate on 400 worlds 98%, 5% gate on 1,000 worlds 95%
true rate 5%: passes 6% gate on 400 worlds 85%, 5% gate on 1,000 worlds 54%
true rate 6%: passes 6% gate on 400 worlds 55%, 5% gate on 1,000 worlds 10%
true rate 7%: passes 6% gate on 400 worlds 25%, 5% gate on 1,000 worlds 1%
true rate 8%: passes 6% gate on 400 worlds 8%, 5% gate on 1,000 worlds 0%
Under the first judge, a method whose real false-claim rate is 7% passes one round in four. A loop that proposes dozens of changes will eventually present one on a lucky draw. Under the second judge, the same method passes 1% of the time.
The ledger shows the cost of the loose gate. Before round 3, the accepted method measured 1.75% to 2.75% false discoveries. After it, the judge re-scored the same method on fresh worlds in each of the next 19 rounds. Its false discoveries averaged 5.2%, came in above the 6% gate in 3 of those rounds, and reached 8.25%. The method had passed once and then stayed in place while its real error rate showed itself.
A bar that rises with every attempt
The second rule protects against the slower version of the same problem. Every proposal is another draw, so the evidence a change needs should grow with the number of changes ever tried, including the rejected ones. Gedanken uses a one-sided Bonferroni correction over the full count:
with α = 0.05 and k the number of proposals tried so far. The bar is 1.64 on the first try, 2.13 on the third, 2.58 on the tenth and 2.96 on the 32nd. That last figure sits close to the t-statistic of 3.0 that Harvey, Liu and Zhu proposed for new return factors, which is the same correction reached from the other direction: a field that has tried many ideas needs more evidence for each new one.
The gain itself is measured with a paired test. Candidate and incumbent run on the same fresh worlds, and for each planted-edge world the difference d is 1 if only the candidate found the edge, −1 if only the incumbent did, and 0 otherwise:
Pairing removes the world-to-world noise that would swamp a small real gain if the two methods were scored on different markets. The fresh worlds come from seeds the judge holds, so the proposer cannot pick easy markets.
Lock the judge, then let a person sign
The last piece is mechanical, and it follows the split that makes systems like DeepMind's AlphaEvolve work: language models propose programs, and automated evaluators verify and score every one. The proposer can be as creative as it likes because it has no say in the score. In Gedanken, the judge's code is hashed, and the hash is stored in a lock file. Every comparison starts by checking that the code still matches the lock. If anything has changed, the loop stops until a person reviews the judge and signs it again. Changes to the judge are logged with the date, the version and the approval. The loop can rewrite the research method as often as it likes; it cannot touch the rules it is scored by.
Here is the pattern in a form you can run, with no Gedanken code in it:
"""A minimal locked judge: hash lock, hard gate, paired test, and a bar that rises with every trial."""
import hashlib
from pathlib import Path
import numpy as np
from scipy.stats import norm
JUDGE_FILE = Path(__file__)
LOCK_FILE = JUDGE_FILE.with_suffix(".lock")
FDR_GATE = 0.05 # owned by the judge, never by the thing being judged
ALPHA = 0.05
def verify_lock():
digest = hashlib.sha256(JUDGE_FILE.read_bytes()).hexdigest()
if not LOCK_FILE.exists() or LOCK_FILE.read_text().strip() != digest:
raise SystemExit("Judge changed or unsigned: a human must review it and re-sign.")
def sign():
LOCK_FILE.write_text(hashlib.sha256(JUDGE_FILE.read_bytes()).hexdigest())
def required_z(trials):
# Bonferroni over every proposal ever tried, one-sided
return norm.ppf(1 - ALPHA / max(1, trials))
def compare(inc_null, inc_hits, cand_null, cand_hits, trials):
"""Each argument is a 0/1 array over the SAME fresh worlds:
*_null = claimed an edge in a no-edge world, *_hits = found a planted edge."""
verify_lock()
fdr = cand_null.mean()
if fdr > FDR_GATE:
return "rejected", f"false discoveries {fdr:.1%} above the {FDR_GATE:.0%} gate"
diff = cand_hits.astype(float) - inc_hits.astype(float)
se = diff.std(ddof=1) / np.sqrt(len(diff))
z = diff.mean() / se if se > 0 else 0.0
if z <= required_z(trials):
return "rejected", f"gain not significant (z={z:.2f}, needed {required_z(trials):.2f})"
return "accepted", f"power {inc_hits.mean():.1%} -> {cand_hits.mean():.1%}, z={z:.2f}"
if __name__ == "__main__":
if not LOCK_FILE.exists():
sign()
rng = np.random.default_rng(10)
n_null, n_alpha = 1000, 400
# same 400 planted-edge worlds: incumbent finds about 24%, candidate about 26%
base = rng.random(n_alpha)
inc_hits, cand_hits = base < 0.25, base < 0.27
null_draw = rng.random(n_null)
inc_null, cand_null = null_draw < 0.02, null_draw < 0.02
for trials in (1, 7, 32):
print(f"after {trials} trials, bar z = {required_z(trials):.2f}:",
compare(inc_null, inc_hits, cand_null, cand_hits, trials))
It prints:
after 1 trials, bar z = 1.64: ('accepted', 'power 24.0% -> 26.0%, z=2.85')
after 7 trials, bar z = 2.45: ('accepted', 'power 24.0% -> 26.0%, z=2.85')
after 32 trials, bar z = 2.96: ('rejected', 'gain not significant (z=2.85, needed 2.96)')
The same two-point gain on the same worlds passes early and fails late, because by the 32nd attempt a z of 2.85 is what you would expect the best of 32 lucky draws to produce. Edit any character in the file after the first run and the next comparison stops with the lock message. In a real system the lock file belongs somewhere the optimizer cannot write, such as a protected branch or a separate service, and the judge code should not import anything the optimizer can change.
What the stricter judge let through
Under the second judge the loop ran 32 rounds and accepted one change. In round 7 it switched position sizing from the direction of the signal to its strength, a z-score. Detection rose from 25.2% to 32.5%, a paired z of 3.22 against 2.45 required, with 2.0% false discoveries. The other 31 proposals were rejected: 30 because the gain was not significant at the rising bar, one because false discoveries reached 6.3%. Across all 32 rounds, the accepted method's false discoveries stayed between 1.2% and 3.9% on fresh worlds, an average of 2.3%.
That record looks less exciting than the first run, and that is what a working judge produces. The first judge gave the loop a 12-point jump in detection that was mostly a looser definition of success. The second gave it a 7-point gain that held up with false discoveries under 3%.
The research in the first run did not change. Only the judge did.
Where it breaks
These are simulated markets, and the judge is only as good as the worlds it grades on. If the simulation leaves out something real, such as a regime change or a cost, a method can satisfy the judge and still fail in practice. Gedanken handles part of that with a separate check that flags when real data drifts outside the simulated range, and changes to the world model also need a signed approval, but no simulation covers everything.
Bonferroni is conservative. By round 32 the bar is high enough that real gains of a point or two will be rejected, and the loop slows down. That is a deliberate trade: I would rather miss a small real improvement than accept a false one, but a team with a different cost of error might use a less strict correction or a spending plan for its error budget.
A hash lock protects a file, not a system. If the optimizer can change the data the judge reads, the random seeds, or a library the judge imports, it can still move the score. The lock has to cover everything the judge depends on, and the approval step is only as good as the person reviewing the change.
Finally, the logged runs used the blind proposer. I expect an LLM proposer to search the same space faster and to find loopholes faster too, but these ledgers do not measure that.
What to do this quarter
If you run any loop that tunes itself against a score, whether that is an LLM-as-judge evaluation pipeline, an AutoML search, an agent optimizing a business metric or a research team testing variants, start with an inventory: list every number that decides pass or fail and move each one out of the thing being scored and into the judge. Size the evaluation set so the standard error of each gate is small compared with the margin you care about, and check it with the binomial table above. Count every attempt, keep a ledger of rejected ones, and raise the bar with the count. Score each candidate on fresh data the proposer never sees, paired against the incumbent. Then lock the judge and require a named person to sign any change to it.
The full record of both runs, the interactive demo and the other three findings are in the Gedanken demo and the showcase repository. The companion piece on backtest overfitting and look-ahead bias in 600 simulated stock markets covers what the same simulation shows about human research processes, and more agent and evaluation work is on the agentic AI page.
Sources
- Krakovna and colleagues, Specification gaming: the flip side of AI ingenuity, DeepMind, 2020
- Zhang, Hu, Lu, Lange and Clune, Darwin Gödel Machine: Open-Ended Evolution of Self-Improving Agents, arXiv, 2025
- Novikov and colleagues, AlphaEvolve: A coding agent for scientific and algorithmic discovery, Google DeepMind, 2025
- Harvey, Liu and Zhu, … and the Cross-Section of Expected Returns, Review of Financial Studies, 2016
- Bailey and López de Prado, The Sharpe Ratio Efficient Frontier, Journal of Risk, 2012
- Bailey and López de Prado, The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality, Journal of Portfolio Management, 2014
- Vector 1, Gedanken demo and showcase repository; all loop results above are from Gedanken's simulated natural gas to fertilizer earnings markets, Nov 19, 2026


