Skip to main content
Back

TreeKD Teaches 2B-Parameter LLMs to Beat Specialist Drug Discovery Models

TreeKD verbalizes decision tree rules into prompts, letting small LLMs match or beat specialist ADMET models across 22 drug discovery tasks.

Pro

  • TreeKD distills decision tree rules into LLM prompts for molecular property prediction.
  • Uses 40K functional groups extracted via SMART-Chemist as tree features.
  • Boosts Gemma-2-2B and Granite-3.3-2B on 19/22 ADMET tasks on TDC benchmark.
  • Rule-consistency ensembles 50 Random Forest rules, beating self-consistency on 17/22 tasks.
  • Beats TxGemma-2B generalist on most tasks; narrows gap with MapLight specialists.
  • Improves activity cliff handling: 34/55 and 38/55 pairs correct vs 22/55 baseline.

Language models keep showing up in drug discovery pipelines, but when it comes to predicting whether a candidate molecule will actually behave like a drug, they still lose to boring old decision trees. A new paper called TreeKD proposes an unusually simple fix: train a tree on chemical substructures, translate its decision path into English if-then rules, and paste that into the LLM's prompt. The result is a 2B-parameter generalist model that closes most of the gap to state-of-the-art specialist ADMET predictors.

Why LLMs stumble on molecules

Molecular Property Prediction (MPP) is a core step in drug discovery, used to estimate ADMET characteristics (absorption, distribution, metabolism, excretion, and toxicity) before running expensive lab experiments. LLMs are attractive here because they offer a single interface for many properties and can explain themselves in natural language, but their current performance remains insufficient for practical adoption.

The authors argue this is a representation problem. LLMs tend to attend to molecules as a whole given their SMILES string, while struggling to recognize and utilize their local substructures, even though those substructures (functional groups like methyl, sulfone, or acyl) are what actually drive properties. Tree-based models sidestep this because they split on individual substructure counts directly, and they are more sensitive to activity cliffs, where a tiny structural change flips a molecule's behavior.

Diagram comparing how LLMs see a whole molecule versus how a decision tree splits on functional group counts

Verbalizing a decision tree into a prompt

TreeKD is a four-stage pipeline. For each input molecule the system:

  1. Runs SMART-Chemist, a powerful cheminformatics tool for SMARTS pattern matching, to extract the 40K most common functional groups and count occurrences.
  2. Trains a specialist decision tree per property on those counts, with max depth 6.
  3. Converts the tree into a hierarchy of nested if-then conditions where indentation encodes depth, and pastes that verbalized rule into the LLM's prompt alongside the SMILES string and the list of detected functional groups.
  4. At inference time, ensembles predictions across multiple rules drawn from a Random Forest.

The fine-tuning objective is the standard next-token cross-entropy on the labeled answer, with regression targets rounded to six decimals to preserve precision. Training uses LoRA adapters (rank 16) and, as the authors note, a training run with a batch size of 8 on two NVIDIA A100 80GB GPUs takes approximately 20 hours.

Rule-consistency instead of self-consistency

The second contribution is a test-time trick borrowed from bagging. Standard self-consistency samples the same prompt multiple times and averages, which mostly injects noise. TreeKD instead trains a Random Forest of 50 trees, verbalizes each into its own prompt variant, and averages the LLM's predictions across those variants. During training, one rule per molecule is picked at random so the model does not overfit to any single tree. On regression tasks especially, this rule-consistency ensemble beats self-consistency handily.

Verbalized decision tree showing nested if-then conditions on functional group counts for Caco-2 permeability

What the numbers look like

Experiments run on the Therapeutics Data Commons benchmark across 22 ADMET tasks (9 regression, 13 classification), using Gemma-2-2B and Granite-3.3-2B. Highlights:

  • TreeKD enhances LLMs' performance on most tasks (19/22 for Gemma-2-2B and 19/22 for Granite-3.3-2B).
  • Even a weak specialist tree still helps: on Plasma Protein Binding Rate (PPBR), the decision tree alone scores 11.492 MAE, but distilling its rule pushes Gemma-2-2B to 7.503 and Granite-3.3-2B to 7.259, closing most of the gap to specialist MapLight models at 7.654.
  • In head-to-head with TxGemma-2B, the strongest 2B generalist for MPP, TreeKD wins on 19/22 tasks with Gemma and 18/22 with Granite.
  • Rule-consistency further improves results on 17/22 tasks for both models, beating self-consistency clearly.

An analysis on activity cliffs, where two nearly identical molecules have opposite labels, shows the method is doing more than parroting the tree. TreeKD enables Gemma-2-2B and Granite-3.3-2B to correctly predict both molecules in considerably more pairs (34/55 and 38/55) than the baseline (22/55 and 21/55). This suggests that TreeKD improves LLMs' ability to capture the concept of activity cliffs, and the LLMs sometimes override the rule when it is wrong.

Caveats worth knowing

TreeKD is not a free lunch. Prompts get longer because they include the full verbalized rule, so training and inference cost more. The authors show that with prefix caching the overhead nearly vanishes, dropping batched inference down to about 0.09 seconds versus 0.06 seconds for naive inference. Performance also degrades on properties like LD50 and Blood-Brain Barrier permeability that lean more toward global information than FGs, and test-time scaling saturates around N=50 rules as Random Forest diversity plateaus. Still, for the ADMET workload where functional groups dominate, this is a rare case of classical ML meaningfully teaching a modern LLM.