DPP-4 Kd LTN
A tuned LTN (Logical Tensor Network-style MLP, PyTorch) that predicts the binding affinity pKd of a small molecule for human DPP-4 (dipeptidyl peptidase 4; UniProt P27487, ChEMBL CHEMBL284) from its SMILES.
The protein input is fixed to DPP-4: this is a single-target model. For each compound it returns predicted pKd, Kd in nM (= 10^(9 − pKd)), ΔG in kcal/mol (= −1.3642 × pKd, the ΔG° = −RT·ln10·pKd convention at 298.15 K), and a potency class (potent pKd ≥ 7, moderate 6–7, weak < 6).
Model
- Architecture: MLP trunk 768 → 384 → 192 (GELU, dropout 0.1) with a regression head (pKd) and a 3-class band head. Training loss = MSE(pKd) + cross-entropy(band) + (1 − satisfiability of the true-band axiom, p=2 SatAgg) — the LTN component.
- Inputs (3,328, no scaling — exactly as trained):
- Ligand: Morgan fingerprint, radius 2, 2048 bits (RDKit).
- Protein: ESM-2 650M mean-pooled embedding of full-length human DPP-4,
1280 dims, computed once and reused (bundled in
esm2_dpp4.npz).
Training — two-stage transfer
- Stage 1 (pretrain): all-target Kd corpus, 86,569 compound–target rows collected from ChEMBL, BindingDB, PubChem and PDBbind (lr 1e-4, batch 256, early stopping). Stage-1 held-out test: RMSE 0.8865, R² 0.6969 (n = 8,658).
- Stage 2 (fine-tune): all weights fine-tuned on 555 DPP-4 Ki
compounds (pKi used as the fine-tune label; lr 5e-5, batch 64, early
stopping). These stage-2 weights (
ltn_stage2.pt) are the deployment weights in this repo. - External evaluation: the only 15 DPP-4 compounds with measured Kd form the external test set. They were blocked by molecule identity from every training stage (overlap verified to be exactly 0).
Training ran on UAB Cheaha via SPARCq (suite job 801).
External test results (15 held-out DPP-4 Kd compounds)
| Model | External RMSE (pKd) ↓ | External MAE (pKd) ↓ | Class accuracy ↑ |
|---|---|---|---|
| LTN (this model) | 1.6037 | 1.2758 | 0.8667 |
| GAT + ExtraTrees head | 1.6106 | — | — |
| GAT | 1.6579 | 1.3741 | 0.9333 |
| Mistral-8L (reduced backbone) | 1.6923 | 1.4679 | 0.9333 |
| Trees (RandomForest / ExtraTrees) | not present in the retrieved comparison file (empty row) |
Values are from kd_model_comparison.csv (included in this repo). The
GAT + ExtraTrees head figure is that file's dedicated
external15_rmse_extratrees_head column. Per-compound LTN predictions for
all 15 compounds are in external_ltn.csv; full metrics (including stage-1)
are in metrics_ltn.json.
Verification: the metrics above were reproduced by live inference from
the exact weights in this repo on 2026-11-12 — RMSE 1.6037, MAE 1.2758,
class accuracy 0.8667, and per-compound predictions matching
external_ltn.csv to < 5×10⁻⁵.
Honest caveats
- External accuracy is modest. RMSE ≈ 1.6 log units on only n = 15 compounds, with a systematic under-prediction bias of −1.10 pKd units. This is a hard transfer problem: the model was fine-tuned on Ki and is evaluated on Kd, and 15 compounds is a small test set. Treat predictions as a ranking/screening signal, not as measured affinities.
- Single target only (human DPP-4). The bundled ESM-2 vector is DPP-4's; the model cannot score other targets.
- Research use only; not a substitute for experimental Kd measurement.
Usage
pip install torch rdkit numpy
python predict_kd.py "Cn1c(=O)cc(N2CCC[C@@H](N)C2)n(Cc2ccccc2C#N)c1=O"
# pKd 7.7058 | Kd 19.69 nM | dG -10.5123 kcal/mol | potent | (alogliptin)
python predict_kd.py --csv compounds.csv --smiles-col canonical_smiles --out preds.csv
Files
| File | Contents |
|---|---|
ltn_stage2.pt |
Stage-2 (DPP-4 Ki fine-tuned) LTN weights — the deployment model |
predict_kd.py |
Self-contained inference (single SMILES or CSV batch) |
config.json |
Architecture, feature spec, target, provenance, metrics |
esm2_dpp4.npz |
The DPP-4 ESM-2 650M embedding only (slim extract of the project's per-target store) |
external_ltn.csv |
The 15-compound external test grid (experimental vs predicted pKd) |
metrics_ltn.json |
Full metrics: stage-1 val/test + stage-2 external test |
kd_model_comparison.csv |
All-model external comparison from the training run |
- Downloads last month
- 28