Skip to main content
Yuming Yang

Projects / quant-trap-bench

QuantTrapBench

Does an AI agent notice the trap in a quant research task?

A benchmark of 22 quant research tasks, most with a planted trap such as survivorship, lookahead or full-sample selection, and a quarter without one to measure false alarms. Scoring is deterministic, two scripted reference agents validate every task, and no language model has been run on it yet.

RepositoryPython · pandas · NumPy · LLM agents · evaluation
22 tasks
Eight trap families with two tasks each, plus six controls without a trap
16 / 16
Trap tasks where the naive reference agent falls for the trap and the oracle corrects it
≥ 2.8
Tolerances separating the corrected and naive values on every task

01Problem

Ask an agent for the annualized return of an equal-weighted portfolio and hand it a file of today's listed stocks, and it will usually average that file. The answer is wrong by the survivorship bias, and nothing in the request says so. Quant research is full of traps like this, and they are the ones a careful researcher is paid to catch. This benchmark asks whether an agent catches them, and whether it raises false alarms when there is nothing to catch.

02What a task looks like

Each task gives the agent a few CSV files, a data dictionary and a request for one number. The dictionary is truthful and includes the detail that reveals the trap to a careful reader; the request never mentions it. A hidden key holds two values computed when the task is generated:

  • the corrected value a careful researcher would report;
  • the naive value the analysis gives on the data taken at face value.

In survivorship_1, averaging the current-constituents file gives 8.20% a year; combining it with the delisted-stocks file gives 5.18%. The tolerance is ±0.40 points, so the two answers are 7.5 tolerances apart and cannot be confused.

03Traps

FamilyTrapHow it is planted
DataSurvivorshipThe main returns file is a current-constituents snapshot
DataFundamentals not point-in-timeValues carry a fiscal period end and a separate filing date
DataUnadjusted splitsRaw closes with a cumulative split factor next to them
DataPrice lookaheadA momentum signal whose window ends at the next day's close
DataZero costsNet performance is requested; costs are in a side file
MethodFull-sample selection"Pick the best lookback" against a stated holdout protocol
MethodBest-of-many reportingMany skill-less variants; how likely is the best to have skill?
MethodMisaligned ICSignal and return on one row, but the return is contemporaneous

The method tasks reuse the synthetic panel of Factor Research Pipeline, whose true signal is known.

04Results: benchmark validation

AgentTrap tasks: correctedTrap tasks: naiveControls correct
Naive (textbook analysis on the data as given)0 of 1616 of 166 of 6
Oracle (reference correction)16 of 160 of 166 of 6
  • Every trap bites, and every trap is fixable from the materials the agent sees.
  • Controls are not trick questions: the naive analysis is right on all six, so "correcting" a control is a false alarm.
  • The scorer never has to guess: the two reference values are at least 2.8 tolerances apart, and up to 496.

No language model has been run. A model run would report the share of trap tasks answered with the corrected and the naive value, the false-alarm rate on controls, and each by family, with intervals over repeated runs. The harness is in place; a run needs an API key and an explicit flag, and the repository includes a cost estimate.

05Design trade-offs

  • A deterministic score. An answer is a number compared with two reference values, so scoring needs no judge model and cannot drift. The cost is that it cannot see reasoning; full transcripts are saved for that.
  • Truthful dictionaries. A trap that could only be guessed would test luck, not care.
  • Controls mirror traps. Each control has the same data shape as a trap family without the flaw.
  • Synthetic data. No model can have memorized it, and both reference values are exact.
  • A minimal harness. One Python tool in a temporary directory and a step limit. It isolates the task files, not the machine.

06Limitations

  • Synthetic traps are cleaner than real ones: one trap per task, a truthful dictionary, every statistic defined.
  • No model results yet.
  • Tasks and keys reflect one view of careful research; compare more than one model family.
  • 16 trap tasks and 6 controls; per-family figures rest on a few tasks each.

07Status

Benchmark complete and public under the MIT licence. qtb generate and qtb check rebuild and validate every task from a fresh clone, and CI runs the check on every push.

← All projects