PharmAgent: Constraint-Aware Search with Frozen Language Models for Molecular Optimization
Organizations: City University of Hong Kong (Dongguan) · The Hong Kong Polytechnic University · Tencent AI Lab · Zhengzhou University · Northwestern Polytechnical University
Abstract
Molecular optimization must improve target activity and satisfy developability constraints within limited evaluation budgets. Classical methods require tailored rules or training to incorporate chemical instructions and property feedback. Frozen language models can condition edits on this information, but need explicit constraint control and relevant experience. We therefore present PharmAgent, a constraint-aware molecular search method driven by adaptive external state. Its Lagrangian controller translates violations in accepted states into accumulated constraint pressure, keeping this history separate from current property measurements. Structure-indexed replay complements this feedback with relevant evaluated transitions that guide subsequent proposals. As a curriculum progressively activates constraints, candidates and the incumbent are compared under the same current objective, and the accepted state determines the next multiplier update. We derive an exact identity that characterizes how accepted-state violations accumulate in the controller's multipliers. Across five tasks with five independent runs, PharmAgent achieves a summed area under the target-score curves (AUC) of 3.9208 in target-only search, improving over MOLLEO by 37.3%. With online constraints, it achieves a property-adjusted AUC of 0.7076, improving over the strongest online baseline, ExLLM, by 53.8%. These results rank first among all evaluated methods in both target-only and constraint-aware search. The online comparison covers all five baseline frameworks. The full system leads every ablation variant in target quality, property-adjusted performance, and Pareto hypervolume. All five molecular cases reach feasible final states, documenting target gains and trade-offs.
Figures & tables
| Method | Online constraints | Adaptive weights | Structure-based retrieval | Cross-task reuse |
|---|---|---|---|---|
| Graph-GA / REINVENT4 | ✗ | ✗ | ✗ | ✗ |
| MOLLEO / ExLLM / SEISMO | ✗ | ✗ | ✗ | ✗ |
| Online adaptations | ✓ | ✗ | ✗ | ✗ |
| PharmAgent | ✓ | ✓ | ✓ | ✓ |
| Method | GSK3 | JNK3 | DRD2 | Sitagliptin | Albuterol | Sum |
|---|---|---|---|---|---|---|
| Graph-GA | 0.4600 | 0.1814 | 0.6939 | 0.2213 | 0.4423 | 1.9988 |
| REINVENT4 | 0.3792 | 0.1742 | 0.6917 | 0.1513 | 0.3947 | 1.7911 |
| MOLLEO † | 0.5028 | 0.3658 | 0.8041 | 0.2999 | 0.8840 | 2.8565 |
| ExLLM † | 0.5150 | 0.3302 | 0.7981 | 0.2657 | 0.8860 | 2.7950 |
| SEISMO | 0.4850 | 0.2326 | 0.9756 | 0.1344 | 0.9791 | 2.8067 |
| PharmAgent | 0.7564 | 0.9186 | 0.9494 | 0.3472 | 0.9492 | 3.9208 |
| Method | Target AUC Sum | AA-AUC | PHV | Top-1 | Top-10 |
|---|---|---|---|---|---|
| Graph-GA (FF) | 1.0675 | 0.2536 | 0.4181 | 0.4375 | 0.3219 |
| Graph-GA (FP) | 1.1809 | 0.2711 | 0.4630 | 0.4837 | 0.3575 |
| REINVENT4 (FP) | 1.8337 | 0.2859 | 0.5622 | 0.6221 | 0.4663 |
| MOLLEO † (FF) | 2.0465 | 0.4006 | 0.6430 | 0.6788 | 0.5864 |
| ExLLM † (FF) | 2.2732 | 0.4602 | 0.6514 | 0.6647 | 0.6352 |
| SEISMO (FF) | 2.9319 | 0.3838 | 0.5795 | 0.6405 | 0.5978 |
| Variant | Target AUC Sum | AA-AUC | PHV |
|---|---|---|---|
| PharmAgent (full system) | 3.6936 | 0.7076 | 0.8248 |
| w/o Lagrangian | 3.6535 | 0.4781 | 0.7815 |
| w/o Chemical-CER | 3.4008 | 0.5459 | 0.7904 |
| w/o Curriculum | 3.1981 | 0.6260 | 0.7295 |
| w/o MedChem-RAG | 2.9977 | 0.4146 | 0.6593 |
| w/o Reviewer agent | 3.3024 | 0.5566 | 0.7100 |
Appendix figures & tables22 assets
Supplementary material from the paper’s appendix.
Appendix
| Task | State | MW | logP | QED | SA | CYP | hERG | Caco-2 |
|---|---|---|---|---|---|---|---|---|
| Bound | ||||||||
| GSK3 | R59 | 401.418 | 4.4596 | 0.3982 | 2.4764 | 0.0553 | 0.5754 | -5.5022 |
| GSK3 | Final | 375.215 | 4.3756 | 0.6825 | 2.3569 | 0.4371 | 0.3496 | -4.4525 |
| JNK3 | R59 | 378.407 | 4.0013 | 0.7018 | 2.7675 | 0.0638 | 0.6968 | -4.9562 |
| JNK3 | Final | 461.497 | 3.8926 | 0.4802 | 3.4456 | 0.0391 | 0.4993 | -5.1188 |
| DRD2 | R59 | 386.511 | 4.0715 | 0.6044 | 2.9680 | 0.9720 | 0.9889 | -5.2292 |
| Optimizer | Weight | AA-AUC | PHV | Selected |
|---|---|---|---|---|
| Graph-GA | 0.1 | 0.206613 | 0.349602 | No |
| Graph-GA | 1 | 0.209172 | 0.294164 | No |
| Graph-GA | 10 | 0.209456 | 0.290444 | Yes |
| REINVENT4 | 0.1 | 0.257339 | 0.489099 | No |
| REINVENT4 | 1 | 0.286928 | 0.542494 | Yes |
| REINVENT4 | 10 | 0.262841 | 0.506246 | No |
| Method | Unique evaluations | Evaluation events | Total unique |
|---|---|---|---|
| Graph-GA (FF) | 1,000 | 1,000 | 25,000 |
| Graph-GA (FP) | 1,000 | 1,000 | 25,000 |
| REINVENT4 (FP) | 1,000 | 1,000 | 25,000 |
| MOLLEO (FF) | 1,000 | 1,000 | 25,000 |
| ExLLM (FF) | 1,000 | 1,000 | 25,000 |
| SEISMO (FF) | 6–47 | 37–50 | 955 |
| Constraint | Property | Type | Threshold | Tool |
|---|---|---|---|---|
| Lipinski MW | Molecular weight | 500 Da | RDKit | |
| Lipinski logP | Lipophilicity | 5.0 | RDKit | |
| QED | Drug-likeness | 0.3 | RDKit | |
| SA Score | Synth. accessibility | 6.0 | RDKit | |
| CYP2D6 inhibition | Metabolic safety | 0.5 | ADMET-AI | |
| hERG blocking | Cardiac safety | 0.5 probability | ADMET-AI |
| Property | Scale | Steepness | Justification |
|---|---|---|---|
| MW | 150 Da | 5.0 | Std. dev. in drug-like space |
| logP | 2.0 | 5.0 | Std. dev. in drug-like space |
| QED | 0.2 | 5.0 | Range , std |
| SA Score | 2.0 | 5.0 | Range , std |
| CYP2D6 inh. | 0.3 | 5.0 | Probability scale |
| hERG blocking | 0.3 | 5.0 | Probability scale |
| Quantity | E1 | E2 |
|---|---|---|
| Unique target evaluations | 25,000 | 25,000 |
| Recorded optimization rounds | 38,013 | 49,854 |
| Successful HTTP calls | 83,653 | 108,055 |
| HTTP attempts | 83,751 | 108,168 |
| Input tokens | 119,050,374 | 301,475,520 |
| Output tokens | 55,388,732 | 118,552,476 |
| State / operation | Parameter | Default |
| Constraint state | Initial penalty | 1.0 |
| Growth factor | 1.5 | |
| Maximum penalty | 100 | |
| Experience state | Retrieval count | 5 |
| Archive capacity | 1000 | |
| Fingerprint radius / bits | 2 / 2048 |
| System | Multi-agent | Online ADMET | Online ADMET | Memory | Cross-task | Five-task |
|---|---|---|---|---|---|---|
| evaluation | constraints | retrieval | transfer | PMO | ||
| Graph-GA | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ |
| REINVENT4 | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ |
| MOLLEO-MiniMax-M3 † | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ |
| ExLLM-MiniMax-M3 † | ✗ | ✗ | ✗ | ❍ | ✗ | ✓ |
| SEISMO-MiniMax-M3 | ✗ | ✗ | ✗ | ❍ | ✗ | ✓ |
| Method | Within-task state | Structure-aware | Cross-task |
|---|---|---|---|
| Graph-GA | Evolutionary population | ✗ | ✗ |
| REINVENT4 | Learned policy parameters | ✗ | ✗ |
| MOLLEO | Population / parent scores | ✗ | ✗ |
| ExLLM | Experience memo | ✗ | ✗ |
| SEISMO | Interaction trajectory | ✗ | ✗ |
| Chemical-CER (ours) | Retrieved transitions | ✓ | ✓ |
| Target Score | Property-Aware Quality | ||||
|---|---|---|---|---|---|
| Method | Top-1 | AUC Top-10 | 5-Task Sum | AA-AUC | PHV |
| Graph-GA | 0.6029 | 0.3998 | 1.9988 | 0.3367 | 0.5686 |
| REINVENT4 | 0.5864 | 0.3582 | 1.7911 | 0.2723 | 0.5238 |
| MOLLEO † | 0.7797 | 0.5713 | 2.8565 | 0.4145 | 0.7016 |
| ExLLM † | 0.7364 | 0.5590 | 2.7950 | 0.3121 | 0.6065 |
| SEISMO | 0.6053 | 0.5613 | 2.8067 | 0.2994 | 0.5204 |
| Method | Top-1 | Top-10 |
|---|---|---|
| PharmAgent E1 | ||
| PharmAgent E2 | ||
| Graph-GA | ||
| REINVENT4 | ||
| MOLLEO † | ||
| ExLLM † |