Quant Memo
Core

Golden Datasets for Research Regression Tests

A golden dataset is a small, hand-verified set of inputs and known-correct outputs kept alongside a research codebase, so that a change to the pipeline can be checked against a trusted answer instead of just "looking about right."

Research code changes constantly — a feature gets recomputed a different way, a library gets upgraded, a data adjustment gets refined — and every change carries the risk of silently breaking something that used to work. A golden dataset is a small, fixed set of inputs (a handful of tickers, a short date range) paired with outputs that have been checked by hand and are known to be correct. Every time the pipeline changes, it gets re-run against the golden inputs, and the new outputs are compared to the golden answers.

If the numbers match, the change is safe. If they don't, either the change introduced a bug, or the golden answer itself needs to be deliberately updated and re-verified — but crucially, the difference gets caught and reviewed rather than silently shipped into a live backtest.

A golden dataset turns "does this still work?" into an automatic, repeatable check rather than a researcher's gut feeling that results "look about the same as before."

Good golden datasets are deliberately small and deliberately tricky — they should include the awkward edge cases (a stock split, a delisted ticker, a missing data day) that are most likely to break silently, not just the easy average case that would pass regardless of a bug. They also need occasional, deliberate maintenance: as conventions genuinely change (a new corporate-action rule, a revised universe definition), the golden answer itself has to be updated on purpose and re-reviewed, not just left to silently fail every future test.

Related concepts

Practice in interviews

Further reading

  • Fowler, 'Refactoring: Improving the Design of Existing Code' (testing chapter)
ShareTwitterLinkedIn