Ray's Knowledge Base
Unlock

Guard a model of a performance number against target leakage

RecipeVerified 1 Oct 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.

When to use#

You fit a model that predicts a run's time per operation (or explains it with SHAP) from counters, knobs and trace terms, and you compare input sets to argue which one is needed. Many performance features hide the target, and repetitions of one configuration look alike, so a naive setup scores well for the wrong reason.

Steps#

  1. Drop every rate: bytes per second, ops per second, completions per second. A rate is work divided by the target's own time. Normalize counts per operation instead.
  2. Drop every inter-operation gap (submit to next submit, completion to next completion). In a serial loop the gap is the time per operation.
  3. Drop wall-clock counters that scale with the window: perf stat -a task-clock is the window length times the cores. A polling loop's cycles and instructions are its wall time too.
  4. Run a guard before any fit: drop a feature that reproduces the target within one group to R^2 above 0.999 with a log-log slope near 1. Plant a fake leak (a feature equal to 2 x y) and a rate in a synthetic test, and check that the guard drops both.
  5. Group the folds by configuration (cell), so the repetitions of one cell are never split across train and test.
  6. Run a null: shuffle y inside each group and refit. Every input set must get worse. A set that does not get worse has a leak.
  7. Take y from a run without instrumentation when one exists, and use one y source per group. Mixing instrumented and plain y lets the model learn which run a row came from.
  8. Derive ground-truth labels (the injected cause) from the design only, never from a measured time.
  9. Keep knobs out of a cause-attribution test: the knob that changed names the cause by itself.
  10. Hold out whole families of related workloads in a transfer test, not single workloads that share code with a training one.
  11. Fix the model settings once, before the real data, the same for every input set.

Evidence#

Built for the dpucrumbs black-box study (13 workloads, about 700 rows). The guard dropped both planted leaks in the synthetic test. On real data it dropped two inter-op gap columns; a DMA benchmark's submit-to-submit gap tracked y in its serial loop. The shuffled-y null made every set worse (error factor about 1.5x to about 3x). Two other leaks were found by review and removed: cause labels that one extractor computed from a measured wall time, and a knob that named which probe set ran.

Also found by searching

  • model predicts runtime too well, feature leaks the target
  • how do I keep a performance model from cheating on the target
  • target leakage in a model of benchmark latency from trace counters
  • cross-validation looks great because reps of one config are in train and test