AI4S in Practice: Moving Massive Molecular Libraries Toward the Clinic
AI4S in drug discovery is often framed as a faster way to compute, but the harder problem is making early elimination less blind and more traceable. This article examines how general-purpose LLMs and domain-specific tools can be combined through agent orchestration to compress search spaces, automate low-creativity but high-effort checks, and keep every decision auditable. It covers a layered architecture, constrained tool-call pseudocode, a three-level evaluation framework with wet-lab hold-out controls, cloud engineering patterns, common pitfalls, and a phased rollout path. The central argument is that the real output of AI4S is not merely faster computation, but a development pipeline in which every judgment can be reviewed.
1. The Core Problem: Not Slow Computation, but Blind Filtering
Drug discovery has long operated under a funnel structure. The starting point is a compound space ranging from hundreds of thousands to millions of molecules. Candidates then pass through target validation, primary activity screening, developability assessment, animal models, and Phase I to Phase III clinical trials. Only a very small number reach the market.
The harshness of this funnel is not primarily the computation time at each layer. It is that each layer’s judgment is built on errors from the previous layer. An ignored toxicity signal early on may surface years later as sunk costs reaching hundreds of millions.
In this context, the correct role of AI4S (AI for Science) in pharma is not to “replace experiments.” It should do three things:
- Compress the search space: use differentiable or learnable surrogate models to reduce the candidate set requiring real experimental validation from millions to thousands.
- Move inexpensive criteria earlier: automate work such as marker gene calculation, ribosomal protein filtering, and biological plausibility assessment. This work is low in creative value but high in time cost, so automation lets experts focus on hypothesis design.
- Make decisions traceable: every elimination should leave behind a reason, data version, and model version. Otherwise, the upper layers of the funnel become a black box.
In practical workflows, marker calculation, protein filtering, and plausibility assessment that may have required a PhD student four to eight hours can be compressed into the duration of a meal. The technical meaning is not simply that “the model is faster.” Rather, this type of work has been重构 into a deterministic toolchain that agents can schedule. That point deserves elaboration.
2. Why General-Purpose LLMs Plus Domain Tools Are the Right Approach
General-purpose LLMs are good at intent understanding, task decomposition, and converting natural language into structured queries. But they are unreliable when it comes to numerical precision, domain constraints, and reproducibility. Conversely, domain computation tools—sequence alignment, structure parsing, property prediction, statistical testing—are precise and reproducible, but their interfaces are rigid and often require humans to write glue code.
The value of an agent lies precisely at the seam: the model decides what to call, with which parameters, and how to interpret the return value, while the tool provides verifiable numbers. A practical layered architecture looks like this:
- Model layer: responsible for planning and interpretation. Outputs must use a constrained structured format.
- Tool layer: stateless, idempotent, versioned domain computation services.
- Orchestration layer: DAG scheduling, retries, timeouts, and cost ceilings.
- Data layer: raw data, intermediate artifacts, and conclusions are stored separately, and all carry lineage.
The key engineering constraint is this: the model must never directly produce final numerical conclusions. It may only specify which tools were called, with what parameters, and how the results were interpreted. Numbers come from tools; conclusions are confirmed by a rule engine and expert review.
3. Illustrative Implementation: Constrained Tool Calls and Validation
The following vendor-neutral pseudocode shows a minimal loop of “plan—call—validate—trace”:
# Pseudocode: illustrates orchestration logic only; no vendor-specific API is involved.plan = planner.generate(task="calculate markers for a candidate gene set and perform plausibility filtering",schema=PlanSchema, # enforce structured output)for step in plan.steps: # Each step is a tool-call intent, not a conclusion.result = tool_registry.call( # Tools are stateless, idempotent, and versioned.step.tool, **step.args)assert schema_ok(result), "Tool response does not match the agreed schema"lineage.append(step, result) # Traceability: input version + tool version + parametersverdict = rule_engine.evaluate(lineage) # Verdicts are produced by deterministic rules.report = reporter.render(verdict, lineage) # Reviewable report.
Three details are easy to miss:
- Schema validation must happen before invocation: if the model output has missing parameters or type errors, intercept it before the call instead of letting the tool throw an exception.
- Idempotency is a hard requirement: rerunning the same task must produce the same result; otherwise, the evaluation system becomes invalid.
- Lineage is the foundation of auditability: every number in the report must be traceable back to a data snapshot and tool version.
4. Evaluation: Offline Metrics and the Wet-Lab Loop
The most common reason AI4S projects fail is not that the model is insufficiently powerful. It is that there is no trustworthy evaluation baseline. At minimum, build three layers:
| Layer | Evaluation target | Typical metrics |
|---|---|---|
| Component layer | Individual tool or surrogate model | Numerical agreement with a reference implementation; coverage |
| Workflow layer | End-to-end agent | Task completion rate; manual rework rate; time and cost per task |
| Decision layer | Funnel effectiveness | Enrichment rate; false-positive elimination rate; hit rate in wet-lab validation |
The third layer is the most important. The funnel is only valid if the molecules rejected by the model are indeed rarely shown to be excellent in experiments. This requires a hold-out set: some candidates are not sent to the model for ranking and instead follow the conventional experimental path as an unbiased control. Without a hold-out set, all metrics are merely self-referential.
5. Cloud Engineering: From Research Code to Operable Service
Research-stage scripts cannot directly support funnel-level throughput. Standard cloud components are needed, using only general categories here:
- Object storage: store dataset snapshots, intermediate artifacts, and reports; use versioning and lifecycle policies to control cost.
- Container platform: package each domain tool as an image to ensure environment consistency and elastic scaling.
- Message queues: shave peaks and smooth load, make million-scale candidate tasks asynchronous, and avoid synchronous-call cascades.
- Logging, monitoring, and alerting: record latency, failure rate, and cost for each tool call; alert on anomalous drift.
- Access control and auditing: authorize data by classification, keep sensitive data within its permitted domain, and retain a full trace of operations.
For cost governance, set a budget ceiling and degradation policy for each task. When model calls exceed the budget, automatically degrade to a rule-only path so that the workflow keeps running.
6. Common Pitfalls
- Treating the agent as a search engine: model output without tool constraints is not reproducible and cannot enter the decision chain.
- Self-validating metrics: without a hold-out set, enrichment rates are inflated.
- Ignoring data versions: after a data update, historical conclusions cannot be explained.
- Over-automation: elimination decisions must preserve expert veto power and record the reasons for vetoes.
- One-off delivery: the funnel is a long-term asset and requires continuous feedback from wet-lab results for closed-loop iteration.
7. A Suggested Rollout Path
In the first phase, focus on single-point efficiency. Choose one high-effort, low-risk step—such as annotation calculation and plausibility filtering—automate it, and quantify the expert hours saved. In the second phase, focus on workflow orchestration: connect multiple tools into a DAG with validation and lineage. In the third phase, focus on closed-loop decision-making: introduce a hold-out set and wet-lab feedback, and demonstrate value through enrichment rate rather than time saved.
Returning to the initial question: when many thousands of molecules flow toward the clinic, which ones will survive? Technology cannot remove the harshness of the funnel, but it can make elimination earlier, cheaper, and more explainable. The real output of AI4S is not “faster computation.” It is a development pipeline in which every judgment can be reviewed. This is both an efficiency problem and a governance problem.
