AI for Science in Production: How to Build a Screening Funnel That Survives the Push to the Clinic
As large language models shift from writing code to doing research, the hardest problem in AI for Science (AI4S) is no longer generating a plausible molecule but deciding which of thousands of candidates should advance. This article treats that problem as a reusable engineering methodology: how to layer a screening funnel, orchestrate agent workflows, close the loop between data and validation, and design the architecture that carries the load. It covers the three gaps between generation and validation, a five-stage funnel ordered from cheap to expensive, node contracts that make workflows replayable, negative-sample collection and attribution, and common anti-patterns to avoid.
The capability boundary of large models is moving from “writing code” toward “doing research.” One signal keeps recurring: some model vendors have shifted R&D focus from code generation to biology, chemistry, and pharmaceutical research. In real development settings, researchers who connect a general-purpose large model to a self-built biological agent have compressed work that used to take a PhD student four to eight hours—marker gene computation, ribosomal protein filtering, and biological plausibility assessment—into the span of a meal.
Seen together, these two facts point to the same conclusion: the bottleneck of AI for Science (AI4S) is no longer “can it generate a molecule that looks reasonable,” but “when thousands of candidate molecules head toward the clinic, which ones survive to the end.” This article discusses no specific product. Instead, it abstracts the problem into a reusable technical methodology: how to design the screening funnel, how to orchestrate agent workflows, how to close the loop between data and validation, and how the engineering architecture should carry it.
1. Reframing the Problem: The Hard Part Is the Funnel, Not the Generation
Early thinking about AI4S stayed largely with generative models: given a target or a protein structure, generate a batch of candidate molecules. Development practice quickly exposed three gaps.
The first is a gap in quantity. A single generation run can easily produce candidates in the hundreds of thousands, while preclinical work advances only hundreds into animal experiments and only single digits into human trials. There are several orders of magnitude between what can be generated and what can be validated.
The second is a gap in evaluation. Generative models optimize likelihood or similarity, while development cares about activity, selectivity, druggability, toxicity, and synthesizability. These two objective functions are not mathematically equivalent, and optimizing both with a single model often yields results that “look like molecules but cannot become drugs.”
The third is a gap in time. Wet-lab cycles are measured in weeks and months, while inference is measured in seconds. If the compute side cannot actively narrow the candidate space, compute is consumed by candidates that were never viable.
The core engineering problem of AI4S should therefore be restated as follows: how to build a multi-stage, measurable, rollback-capable screening funnel in which every stage sharply reduces the number of candidates and raises the confidence of those that remain.
2. Layered Design of the Screening Funnel
A reliable funnel usually has five layers. Each solves one clear problem, and the cheap checks must run first.
- Legality filtering. Check basic constraints such as chemical valence, charge, stereochemistry, tautomers, and protonation states. This layer is extremely cheap yet eliminates a substantial share of invalid structures, so it belongs at the very front.
- Structure–target complementarity. Use molecular docking or pharmacophore matching for a coarse screen, focusing on whether the binding mode is plausible rather than on precise scoring.
- Property prediction. Use machine learning models to predict druggability indicators such as solubility, permeability, metabolic stability, and hERG risk, outputting a distribution rather than a single point value.
- Dynamics and selectivity. Introduce molecular dynamics or enhanced sampling to assess binding stability and selectivity differences. This is expensive and runs only on the small number of candidates kept by the layers above.
- Experimental validation. Wet-lab feedback is written back to calibrate the thresholds and models of all preceding layers.
Three design principles matter. First, every layer needs an explicit elimination-rate target and confidence interval, so the funnel does not merely look like it is filtering while nothing actually converges. Second, rollback between layers must be allowed: when final validation fails, it should be possible to locate which layer let the wrong candidate through. Third, thresholds must be configurable, because different projects tolerate false positives and false negatives differently.
A schematic funnel control loop can be written as:
def screen(candidates, stages, budget):survivors = candidatesfor stage in stages: # ordered from low cost to high costif budget.exhausted():breakscored = stage.evaluate(survivors) # returns scores and uncertaintykeep = stage.threshold_fn(scored, budget)survivors = keepbudget.consume(stage.cost_per_item * len(survivors))return survivors
The code is deliberately minimal. The point is not the API but three engineering constraints: stages are pluggable, budget is bounded, and thresholds are replaceable.
3. Agent Workflows: Turning a PhD Student’s Four Hours into Orchestrated Steps
The scenario in the original discussion is representative: marker gene computation, ribosomal protein filtering, and biological plausibility assessment used to be one person’s continuous mental labor and are now split into steps that can run in parallel and be audited. That is the value of an agent workflow.
A pragmatic way to orchestrate this is to divide tasks into three node types:
- Tool nodes: call existing compute tools or scripts, with structured inputs and outputs and retryable failures.
- Reasoning nodes: the large model handles semantic judgment, for example whether a given gene marker fits the experimental design context.
- Validation nodes: check the consistency of the previous two node types, for example whether the same gene carries a consistent name and ID across steps.
It is worth stressing that the large model’s role in this chain is semantic understanding and task scheduling, not serving as the source of numerical truth. All numbers must come from deterministic tools; the model only explains, summarizes, and flags anomalies. Once that boundary blurs, results stop being reproducible.
The engineering recommendation is to define a uniform input/output contract for every node:
{"node": "marker_gene_filter","input": {"dataset_ref": "obj://bucket/exp-01", "gene_list": ["..."]},"output": {"kept": ["..."], "dropped": [{"id": "...", "reason": "..."}]},"meta": {"model": "general-purpose", "latency_ms": 1200, "version": "v3"}}
With contracts in place, a workflow can be replayed, compared, and rolled back. That is what turns “the span of a meal” into a stable, reproducible engineering metric rather than a one-off demo.
4. The Data and Validation Loop: Making the Model More Accurate with Use
The accuracy ceiling of the funnel is set by data. The most commonly overlooked practice is collecting negative samples: failed candidates and molecules rejected by experiments often carry more information than successful ones.
Three layers of data assets are recommended:
- Raw layer: experiment records, spectra, and raw measurements, append-only and never modified, carried by object storage with versioning enabled.
- Feature layer: standardized molecular descriptors, protein structure features, and encoded experimental conditions, ensuring the same field always means the same thing.
- Feedback layer: a comparison table of predicted values versus real experimental results for each screening round, used for offline evaluation and threshold recalibration.
The key to closing the loop is attributability. When a candidate fails late, it must be possible to answer whether the legality filter missed it, the property prediction was over-optimistic, or the dynamics layer was under-sampled. A loop without attribution only accumulates noise.
For evaluation, look at ranking quality and calibration quality at the same time. Ranking is measured by enrichment rate and hit rate; calibration is measured by how well predicted confidence matches the real success rate. Chasing ranking while ignoring calibration makes the thresholds of the upper layers meaningless.
5. Engineering Architecture: Compute, Storage, and Observability
Once the candidate pool grows from thousands to hundreds of thousands, architectural problems appear immediately.
- Compute scheduling: split tasks into short jobs (second-level filtering) and long jobs (hour-level sampling), and use queues and a container platform for tiered scheduling so long jobs do not block short ones.
- Storage tiering: keep hot data on high-performance storage, archive cold data to object storage, and manage lifecycle of intermediate results by project prefix.
- Data versioning: version both datasets and models so any historical conclusion can be reproduced.
- Observability: use a logging service and monitoring alerts to track each layer’s elimination rate, latency, failure rate, and resource levels; alert immediately when the funnel stops converging.
- Cost control: set a budget cap for each layer and automatically degrade to a cheaper approximation when the budget is exceeded, rather than adding compute without limit.
One frequently underestimated practice is “determinism first”: use rules where rules suffice, and small models where small models suffice. This lowers cost and improves interpretability.
6. Common Anti-Patterns
- Scoring end to end with a single model, which makes errors impossible to attribute.
- Looking only at Top-K hits without calibration, so thresholds are set by feel.
- Writing large model output directly into a report as a numerical conclusion.
- No negative-sample feedback, so the model gradually drifts after several iterations.
- Workflows with no versioning or contracts, so results cannot be replayed and teams cannot collaborate.
7. A Practical Checklist
- Fix the funnel layers and budget constraints before discussing model selection.
- Define an input/output contract and version number for every node.
- Make the boundary explicit: the model handles semantics and scheduling; tools produce numbers.
- Build a negative-sample feedback mechanism and an attributable failure-analysis process.
- Carry storage tiering, queue scheduling, and monitoring alerts on general cloud capabilities, such as object storage, message queues, container platforms, logging services, and monitoring alerts.
- Use reproducibility as the acceptance criterion: any historical conclusion can be rerun and matched.
Conclusion
The competition in AI4S is not about whose generative model writes structure formulas better, but whose screening funnel is more rigorous, whose workflows are more orchestrable, and whose data loop is more complete. When thousands of molecules head toward the clinic, the one that survives will not be the one that “looks most like a drug,” but the one that “the strictest validation chain proves to be a drug.” For developers, the worthwhile investment now is not training an even larger generative model, but making the three pieces of infrastructure—funnel, contracts, and closed loop—solid.
