Basic Prerequisites: 02 · Data Pipelines and 04 · Reproducibility.


1. Intuition & Practical Objective

This page is the folder’s fault clinic: the concrete ways honest-looking data goes wrong, and the first-principles rule that catches each. The unifying theme is that every failure below is silent - nothing crashes, the pipeline “succeeds,” and the corruption rides the valid-looking bytes into the model. Three families cover most of what kills quant results:

  1. Silent data corruption - a flipped byte, a NaN, a mis-scaled field that passes domain checks and quietly biases every downstream study.
  2. Irreproducibility / config drift - an unpinned dependency, seed, or data version so that a rerun diverges, and the “reproducible” number is actually a moving target.
  3. Look-ahead / point-in-time leakage - serving restated or future data to a backtest, the single most expensive failure of all (cross-listed from the backtesting folder).

The one-line job: make corruption, drift, and leakage fail loudly at ingest - with checksums, validation gates, and pinned inputs - instead of costing you months of trusting a wrong result.


2. Mathematical Ground Truth & Derivations

A z-score gate turns “looks fine” into “measured anomaly.” For a column with sample mean and sample standard deviation ,

A genuinely corrupt extreme value (a price 999.99 in a ~100±6 column) drives one z-score far beyond the rest of the column’s range. In the demo below the max jumps from to - a threshold like (or for heavy tails) flags it instantly, even though the mean only moved . The mean hides outliers; the z-score does not.

A checksum catches what statistics miss. A subtle corruption (one cell scaled by a tiny factor, or a single flipped bit in a large file) may leave every aggregate plausible while changing the stored bytes. Because a checksum hashes all bytes, it detects any change with probability (see 03). The two tools are complementary: z-scores for statistical outliers, checksums for byte-level integrity.

Config drift is a change in or without a change in . Recall the reproducibility triangle from 04. Drift means or changed silently - a dependency upgraded, a default changed - so the “same” run is actually a different computation that fails to be flagged as one.


3. Computational Implementation - statistics vs checksum on a corrupted column

Build a clean column, corrupt exactly one cell, and show that (a) the z-score gate catches it and (b) the checksum catches it - while the mean stays plausible. Stdlib only.

Read the numbers carefully: the mean barely moved () - a naive “look at the average” check would pass this corrupted column. Only the z-score () and the checksum (hash flipped) raise the alarm. That is the whole lesson: plausible-looking aggregates are the enemy of data quality.


4. Failure Modes & First-Principles Breakdowns

  1. Silent byte corruption. A single flipped bit changes the checksum but often leaves means/sds intact. If you hash at ingest (02) the store rejects it; if you do not, it rides into the model.
  2. The mean-mask trap. Aggregates average away outliers - the demo shows a mean over a column with a 999.99 row. Rely on distributional stats (z-scores) and per-cell integrity, never the mean alone.
  3. Config drift / irreproducible reruns. An unpinned dependency or seed makes a rerun silently diverge. The reproducibility triangle fails exactly when or drifts without a lockfile. (See 04 and §2 above.)
  4. Point-in-time leakage (the costliest). Serving restated/future data to a backtest is corruption of a different kind - semantic corruption the checksum cannot see, because the bytes are “valid.” This is why point-in-time hygiene is enforced at the store/query layer, not by validation: Tick-Level Databases · Backtesting Engines.

5. References

  • López de Prado - Advances in Financial Machine Learning
  • Needham & Simons - DuckDB in Action
  • Astral uv / conda-lock / Docker
  • Financial Data Engineering with Python

6. Connected Graph Bridges