ai-coding-minesIndexGitHub

Filter pass rates multiply — a near-zero result is not proof the data is thin

Python and databases

Symptom

An 8,000-item catalog went through the pipeline and 27 items came out the far end. The obvious read was that the source was poor.

Cause

Several filters were ANDed together. Pass rates do not add, they multiply. Five conditions that each let 70% through leave you 0.7⁵ = 17%. No single condition looks unreasonable; stacked, almost nothing survives.

Fix

Relaxing three conditions against measured evidence took it from 27 to 547 (20×). The source had been sufficient all along.

★★ Do not read "too few results" as insufficient supply. The supply may be fine and the sieve too fine. A number near zero does not, by itself, tell you why.

★★ Without per-reason rejection counts, relaxing filters is guesswork

A pipeline that only counts what passed cannot be diagnosed. Record a reason on every rejection and aggregate by reason. Measured per source, the top reason differed completely from one source to the next — price here, stock there, attachment count somewhere else.

Tuning a global filter from intuition built on one source loosens the wrong condition.

★ Relax one condition at a time

Because the rates multiply, turning off a single condition moves the result by a multiple, not an increment. Release several at once and you cannot tell which one did the work — and you open the gate wider than intended.

How to verify

Attach a {reason: count} aggregate at the end of the pipeline, then toggle conditions one at a time and record the pass count. If the model is right, each condition you disable multiplies the output rather than adding to it.

★ One side benefit: the moment the reason breakdown existed, it exposed "already processed" sitting inside the rejection reasons. A normal state mixed into a failure distribution blurs the real bottleneck ratios.

★★ For the same reason, a metric with a prerequisite misleads you when read on its own

One stage showed 0.1% complete. It read as "nobody is doing that work" — but that stage only applies to items that cleared the previous stage, which stood at 44%. The 0.1% has a denominator of 44%, and no amount of work on that stage can exceed 44%.

★★★ Where a prerequisite exists, the earlier stage's rate is the later stage's ceiling. Seeing a low number, suspect "there is nothing eligible to work on" before "the work isn't happening."

And hanging a target on such a metric quietly changes what the target means — a gate like start advertising at 80% images is, while the ceiling sits at 44%, effectively a gate on the earlier stage. Whenever you gate on a metric, write down its ceiling next to it.