# Adaptive Pipeline Logic Review ## Scope This review covers the current adaptive docking path used by: - `reference_free_active_learning_v2` - `reference_free_active_learning_v3_diverse_ranker` - `reference_free_active_learning_v3_lean` - `benchmark-comparable-adaptive` - `screen-production-adaptive` The goal is to identify what is structurally necessary before the 500k benchmark, what is only diagnostic, and what is currently at risk of adding complexity without enough gain. ## End-to-End Path The effective runtime path is: 1. load prepared dataset and ligand metadata 2. verify prepared SDF consistency against metadata 3. build model rows and reuse dataset-level cluster assignments 4. prefilter candidate pool 5. select calibration set 6. dock calibration set at requested fidelity levels 7. fit classifier gate 8. fit optional regressor and audit its sign / usefulness 9. score remaining candidates 10. triage survivors 11. promote through quota ladder across fidelities 12. dock promoted ligands at higher fidelities 13. write final raw / downranked / filtered hits from real docking only 14. compare strategies only inside a frozen evaluation universe for comparable benchmark mode ## Necessary Components These components are structurally necessary: - dataset loading and metadata/SDF consistency checks - ligand-level feature extraction - clustering or cluster identifiers - calibration docking - classifier gate - promotion ladder across fidelities - final real docking at final fidelity - raw/downranked/filtered hit separation - failed chunk isolation - comparable benchmark evaluation universe Without these, either the production run is unsafe or the benchmark is not interpretable. ## Diagnostic Components These components are useful but not required for production decisions: - `acquisition_components.csv` - `outlier_component_flags.csv` - `cluster_quota_decisions.csv` - `exploration_exploitation_split.csv` - full regressor validation tables - uncertainty calibration diagnostics - leakage audit tables - component-level plots They should remain additive. For large runs they should be controlled by `--diagnostics-level`. ## Components That Can Hurt by Excess Complexity The current risk points are: - classifier probability used as too strong a ranker instead of only a gate - regressor contribution when sign or cluster-generalization is weak - uncertainty contribution when it does not correlate with error - excessive rescue / union logic causing survivor inflation - overly large diagnostic tables for 500k-scale runs These components can degrade ranking quality or operational cost while still looking reasonable in intermediate metrics. ## v3 vs Cluster-Only / Diverse Random `reference_free_active_learning_v3_diverse_ranker` intentionally overlaps with: - `cluster_only_triage` on cluster coverage - `diverse_random_cost_balanced` on exploration That overlap is acceptable if the model adds ranking signal on top. If it does not, v3 mostly becomes a more complex restatement of cluster/diverse heuristics. The current local smoke results suggest exactly that risk: v3 is technically correct, but it has not yet shown clear filtered-score advantage over simple baselines. ## Regressor Status The regressor is no longer allowed to silently dominate the queue. Current behavior: - it is audited on sign and usefulness - if sign check fails or Spearman is too weak, effective regressor weight becomes `0` - ranking can fall back to classifier/diversity-only behavior So the regressor can steer the queue only when validation passes. Otherwise it is effectively diagnostic. ## Classifier Status The classifier should act primarily as a high-recall gate. Current intended use: - exclude clearly poor ligands - keep a candidate pool for downstream ranking - not dominate final ordering in v3/v3_lean If the gate retains too much of the library, the gate is capped by `classifier_max_gate_fraction` and a warning is written into metrics. ## Final Hit Provenance Final hits come from real docking only. They are written from ligand states that contain observed docking scores. Predicted-only ligands do not become final hits. Failed chunk ligands and records without `SCORE` are excluded from final hit tables. ## Survivor / Retain / Reduction Semantics Current intended definitions: - `survivors` = unique `ligand_id` - `retain_fraction = survivors / initial_ligands` - `reduction_fraction = 1 - retain_fraction` These must never be derived from pose count or SDF record count. The current code recomputes them from unique survivor IDs in strategy aggregation. ## Comparable Benchmark Semantics `benchmark-comparable-adaptive` is comparable only when: - one frozen `evaluation_universe.csv` is used - every strategy runs only on the subset dataset derived from that universe - reference docking is done only for evaluation - cost balance is within tolerance - the same dataset manifest / target / fidelity schedule is used This mode is the only place where winner reporting is valid. `reference_mode=none` remains valid for production-like exploratory runs, but not for final strategy claims. ## Minimal Production Logic For a stable 500k run, the safest logic is: - classifier gate - diversity and cluster quotas - weak regressor rerank only if validated - deterministic quota ladder - explicit final-fidelity minimum - raw/downranked/filtered reporting This is exactly why `reference_free_active_learning_v3_lean` exists: it keeps the adaptive idea while removing unnecessary modeling complexity from the decision path. ## Recommendation Before 500k Use `benchmark-comparable-adaptive` first on a 25k evaluation universe with: - `reference_free_active_learning_v2` - `reference_free_active_learning_v3_diverse_ranker` - `reference_free_active_learning_v3_lean` - `cluster_only_triage` - `diverse_random_cost_balanced` - `single_fidelity_cost_balanced` Treat `v3_lean` as the production-oriented adaptive candidate. Do not recommend an adaptive strategy unless it wins on filtered best score and filtered top-k quality under comparable cost.