Self-Repairing Virtual Screening Pipelines

Modern virtual screening campaigns are run by brittle, hand-written scripts. When a machine-learned scoring model misranks compounds, when a library file arrives with renamed columns, or when a hit list turns out to be full of compounds that quench the assay's fluorescence rather than inhibit the target, a human stops the campaign and debugs the pipeline by hand. Meanwhile, a separate line of work has shown that large language models can write, execute, and repair their own code in a closed loop, using compilers, test suites, and profilers as an objective source of truth. And the knowledge needed to write a correct screening pipeline in the first place — which molecular features survive on chemically novel scaffolds, which assay technologies are fooled by which compound classes — lives split between structured databases and free-text literature, exactly the split that hybrid retrieval systems were built to bridge. Nobody has connected these three threads: today's screening pipelines are static code, built from knowledge that no single system can retrieve, with no mechanism to learn from their own failures.

This proposal builds an agent that closes that loop. Given a screening target, an assay technology, and a compound library, the agent uses hybrid knowledge retrieval — a knowledge graph of targets, assay technologies, interference mechanisms, and feature definitions acting as the roadmap, with dense text retrieval over literature and documentation supplying the terrain detail — to write the virtual screening pipeline as executable code. It then validates the pipeline against three execution oracles, repairs it within a fixed budget, and, crucially, writes the verified lessons back into the knowledge graph so that every campaign leaves the system smarter than it found it.

Core Claim

A code-generating agent grounded in hybrid retrieval and refined against scientific execution oracles can assemble and maintain virtual screening pipelines that (a) match or beat the best single static feature configuration on a per-target basis under chemically realistic evaluation, (b) audit its own hit lists for assay interference at the level of dedicated interference classifiers without sacrificing hit recovery, and (c) recover autonomously from pipeline faults that crash or silently corrupt static scripts. The claim is not that the agent discovers better chemistry than domain experts; it is that the agent's per-target adaptivity, interference awareness, and fault tolerance are properties no fixed pipeline has.

The scientific tension motivating part (a) comes from the screening literature itself. Liu et al. evaluated graph neural networks of increasing sophistication, combined with expert-crafted biochemical descriptors, across nine curated PubChem high-throughput screening assays, and found that on scaffold-split evaluation — where test compounds rest on molecular scaffolds never seen in training — the expert descriptors alone frequently outperformed both the standalone networks and their combinations, while learned representations helped mainly under random splits (Advancements in Ligand-Based Virtual Screening through the Synergistic Integration of Graph Neural Networks and Expert-Crafted Descriptors, summary; Advancements in Ligand-Based Virtual Screening through the Synergistic Integration of Graph Neural Networks and Expert-Crafted Descriptors). In other words, there is no single best feature recipe: the right assembly depends on the target and on how the evaluation stress-tests chemical novelty. Choosing that assembly per target, from retrieved knowledge, and validating the choice by executing it, is precisely the job description of an iterative code agent.

Research Program

The agent operates in a budgeted synthesize–execute–repair loop with three components that go beyond existing code agents.

The retrieval layer is a Think-on-Graph 2.0-style tight coupling: the agent anchors on entities in a biochemical knowledge graph (target, assay technology, compound library, descriptor family), prunes candidate relations, and retrieves text documents for the entities it reaches, scoring them with a dense reranker and pruning low-scoring branches (Think-on-Graph 2.0: Deep and Faithful Large Language Model Reasoning with Knowledge-guided Retrieval Augmented Generation). This design is chosen deliberately: on ToG-FinQA, naive vector retrieval and chain-of-thought prompting both scored 0.0% exact match while the tightly coupled loop scored 34.0%, and 74% of correct answers depended on text the graph guided the system to find. Hierarchical aggregation in the spirit of LeanRAG — clustering entities, synthesizing summaries, and retrieving only the paths between seed entities and their lowest common ancestor — keeps the retrieved context compact, since LeanRAG showed a 46% reduction in retrieval redundancy with this structure (LeanRAG, summary; LeanRAG: Knowledge-Graph-Based Generation with Semantic Aggregation and Hierarchical Retrieval).

The oracle layer replaces the unit tests of generic code agents with three scientific checks. First, a scaffold-split cross-validation harness computes the standard early-recall metrics used in the Liu et al. benchmark (logAUC over the 0.001–0.1 enrichment window, BEDROC, EF100). Second, an interference audit runs the pipeline's emerging hit lists against the assay-artefact problem: David et al. showed that PAINS substructure filters detect only 9% of confirmed interference compounds in AlphaScreen assays and 1.5% in FRET assays, while a random forest trained on experimental artefact data reached a cross-validated ROC AUC of 0.64 even on novel single-assay compounds (Identification of Compounds That Interfere with High-Throughput Screening Assay Technologies); the agent reproduces this classifier and treats unflagged interference risk as an execution failure. Third, for structure-based campaigns, a docking-consistency check compares surrogate scores against physical docking on a subsample, following the surrogate pre-filter-then-dock design of Clyde et al., which achieved a 10x pipeline speedup at under 0.01% error in detecting the top 0.1% of compounds (Protein-Ligand Docking Surrogate Models).

The refinement and write-back layer is the new mechanism. Repair follows the budgeted best-so-far pattern of ARCS, which never returns a candidate worse than the best verified one (ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement), with rollback to the last verified checkpoint as in MEIC's dual debug-and-score agent design (MEIC). But unlike ARCS's flat vector store, and unlike the read-only graphs of LeanRAG and ToG-2, every verified repair produces candidate knowledge-graph triples — for example, (assay technology, susceptible-to-interference-from, compound cluster), with provenance pointing to the execution run — that are inserted only after the finding reproduces on held-out data. This directly addresses the known failure of static graphs, where a missing entity or relation sends the retrieval loop into a dead end, and it counters the documented plateau where refinement gains flatten after two to four iterations (Yan et al.) by letting the system accumulate structural knowledge rather than re-derive it per campaign. The iteration budget itself is dynamic rather than ARCS's fixed constant: the loop stops when per-iteration improvement falls below a threshold, which we calibrate against the observed plateau.

Baselines

The naive reference point is a single-shot generation of the screening script by the same backbone model with the target description and library documentation in context, no retrieval, and no execution feedback. This is the "do nothing" for the agentic machinery, and it matters because prior work quantifies the gap: in MEIC's setting, standard retrieval-augmented generation or fine-tuning reached only a 66% fix rate on functional errors where the iterative loop reached 78%, and ARCS found its retrieval, planning, and execution-feedback components to be super-additive rather than merely additive.

The strongest competitor on the scientific question is the best static feature configuration from Liu et al.'s study — the strongest of their graph-convolutional, SchNet, or SphereNet models with and without the expert-crafted descriptor sets, evaluated under their exact scaffold-split protocol. Because no per-target numerical result from that study is reported on Lacuna, we will re-run the strongest configurations ourselves on the same nine PubChem assays under a matched tuning and compute budget, and treat that re-run, not a quoted number, as the bar. On the interference subtask, the strongest competitor is David et al.'s random forest on ECFP4 fingerprints, with its reported ROC AUC of 0.99 on compounds tested in multiple assays and 0.64 on novel single-assay compounds; the PAINS filter, with an ROC AUC of 0.51 on the novel-compound set, serves as the naive filter reference. Beating the static baseline means improving scaffold-split logAUC on at least six of the nine assays under a paired significance test at equal GPU-hours; beating the interference baseline means matching its detection on held-out novel compounds while integrated into the pipeline, with no more than a 5% loss in EF100 relative to the unaudited pipeline.

Three ablations isolate the proposal's ingredients. The same agent loop with a flat text-only vector store (the ARCS configuration) isolates the hybrid graph-plus-text retrieval. The same hybrid retrieval without the execution-repair loop, generating the pipeline once, isolates iteration. And the full agent with write-back disabled, run across the nine assays in sequence, isolates the self-updating knowledge graph: the prediction is that with write-back, later targets converge in fewer iterations and retrieval redundancy falls.

Why not just…?

Why not just prompt a frontier model once? The evidence against single-shot generation is consistent across three adjacent domains: MEIC's 66%-versus-78% functional fix rates, ARCS's +0.115 CodeBLEU improvement over standard retrieval-augmented generation on scientific code, and POLO's finding that one-shot models miss cross-module bottlenecks entirely in project-level work (POLO). Still, this is partly an empirical bet on our domain, which is why the single-shot baseline and the no-repair ablation are first-class experiments rather than afterthoughts; if single-shot generation with hybrid retrieval matches the full loop, that is a finding we will report.

Why not just use a flat vector store over protocols and documentation? This is the ARCS design, and it is simpler to build. The counter-evidence is ToG-2's: on unseen structured data, naive vector retrieval scored 0.0% where the coupled graph-text loop scored 34.0%, and most correct answers required text reachable only through the graph. Screening pipelines plausibly sit in that regime — the interference question is inherently multi-hop (this assay technology, this detection chemistry, this compound class). But I am honest that our domain may be less multi-hop than financial reasoning, so the flat-store ablation is the decisive test: if it matches hybrid retrieval on the nine assays, the graph layer earns its keep only through write-back, and the proposal narrows accordingly.

Why not just fix the best static descriptor pipeline once and ship it? This is the most serious alternative, because Liu et al.'s own result says expert descriptors frequently win on scaffold splits — the exact evaluation we care about. The honest answer is that our central hypothesis is a bet on per-target adaptivity: a static configuration is tuned once and applied everywhere, while the agent retrieves and assembles a configuration conditioned on the target family and validates it under the stress-test split. If the agent fails to beat the re-run static best on the nine assays, the adaptive-assembly claim is dead, and the proposal's residual contribution is interference auditing and fault recovery — properties the static pipeline demonstrably lacks, given that PAINS-based cleaning leaves up to 98.5% of interfering compounds undetected. The experiment is constructed so that this outcome would be visible and reportable, not argued around.

Why not just prefilter the library with PAINS before anything else? Because the filters fail exactly where they are needed: David et al. measured 9% and 1.5% detection rates for confirmed interference compounds, and an ROC AUC of 0.51 — coin-flip level — on novel compounds. The random forest baseline is the real competitor here, and our agent does not try to out-classify it; it wraps it as an oracle and contributes the integration, so the question becomes whether auditing costs hit recovery, which the EF100 retention check answers directly.

Proposed Experiments and Decisive Checks

The first experiment evaluates adaptive assembly: all nine PubChem high-throughput screening assays from the Liu et al. benchmark, scaffold splits, logAUC over the 0.001–0.1 window plus BEDROC and EF100, agent versus re-run static baselines versus the three ablations, at matched GPU-hour budgets. The second evaluates the interference audit on the David et al. artefact database and its external PubChem validation split, where the target is to match the random forest's 0.64 novel-compound ROC AUC inside the pipeline while flagging interference classes the agent's retrieval surfaced from literature. The third evaluates fault tolerance on the Clyde et al. SARS-CoV-2 surrogate benchmark, whose static pipeline screens a billion molecules in under a day at a 10x speedup with under 0.01% loss of top hits: we inject realistic failures (library schema drift, missing property fields, surrogate-docking score divergence) and measure whether the agent recovers hit retention within budget where the static script crashes or silently degrades, and what wall-clock overhead the agent's iterations add.

The known risks have named mitigations. The new-error trap, where repairs break adjacent modules, is handled by best-so-far caching and rollback as in MEIC. The two-to-four-iteration plateau documented by Yan et al. is the reason the budget is adaptive and the reason write-back matters — accumulated structure is the only mechanism here for gains beyond the plateau. And hallucinated knowledge is contained by the verified-insertion rule: no triple enters the graph unless the execution evidence that motivated it reproduces on held-out data. If the program works, the deliverable is not just a better screening pipeline but a knowledge base whose coverage grows with every campaign it survives.