PeptEdgeV2 / README.md
devansh0703's picture
Remove misleading text-classification pipeline/task tags; use protein-sequence task
317a5ec verified
|
Raw History Blame Contribute Delete
5.69 kB
---
license: mit
tags:
- biology
- bioinformatics
- peptides
- protein
- antimicrobial-peptide
- amp
- pytorch
- transformers
- protein-sequence
- sequence-classification
library_name: custom
base_model: none
metrics:
- f1
- accuracy
- roc_auc
- mcc
model-index:
- name: PeptEdgeV2
results:
- task:
type: protein-sequence
name: Antimicrobial Peptide (AMP) Binary Classification
dataset:
type: devansh0703/GenPept-Curated-2025
id: devansh0703/GenPept-Curated-2025
name: GenPept-Curated-2025 (balanced_11000)
split: test
metrics:
- name: F1 Score
type: f1
value: 0.9147
- name: Accuracy
type: accuracy
value: 0.9134
- name: ROC AUC
type: roc_auc
value: 0.9510
- name: Matthews Correlation Coefficient
type: mcc
value: 0.8272
---
# PeptEdgeV2: Parameter-Efficient Antimicrobial Peptide Classification
State-of-the-art antimicrobial peptide (AMP) classifier with **189x fewer parameters** than prior
methods, reaching **91.47% F1**, **91.34% accuracy**, and **95.10% AUC** on the
GenPept-Curated-2025 benchmark.
| Metric | PeptEdgeV2 | ESM-2 LoRA (prior SOTA) | Delta |
|--------|-----------|------------------------|-------|
| F1 Score | 91.47% | 88.30% | +3.17% |
| Accuracy | 91.34% | 86.80% | +4.54% |
| AUC | 0.9510 | 0.938 | +0.013 |
| Parameters | **3.43M** | 650M | 189x fewer |
| Inference | 52,800 seq/s | 248 seq/s | 213x faster |
## Model Description
PeptEdgeV2 combines four components in a single compact encoder:
1. **Biophysical Embedding** — 12 physicochemical properties per amino acid (from a fixed table)
concatenated with learned token embeddings (192-dim total).
2. **Multi-Scale Convolution** — four parallel `Conv1D` branches (kernel sizes 3, 5, 7, 11) with
batch norm + residual connections.
3. **SwiGLU Transformer** — 5 transformer layers with gated feed-forward networks and stochastic
depth regularization.
4. **Adaptive Tri-Pooling** — mean, max, and attention pooling fused before a 3-layer MLP head.
Total parameters: **3,434,018**.
- **Config** (`config.json`): `d_model=192, n_heads=6, num_layers=5, ff_dim=384, dropout=0.25,
sd_prob=0.05, vocab_size=21, max_len=200, num_classes=2`
- **Input encoding**: amino-acid tokens `0..20` (`PAD=0`, 20 standard AAs, `X=20`), truncated/padded
to `max_len=200`.
## Quickstart
Install:
```bash
pip install torch huggingface-hub safetensors numpy pandas scikit-learn
```
The repo contains full source (`model_v2.py`, `data_utils.py`, `train_final.py`). To load the model:
```python
import torch
from model_v2 import PeptEdgeV2
model = PeptEdgeV2.from_pretrained("devansh0703/PeptEdgeV2")
model.eval()
# Encode a peptide (tokens 1-20 = AAs, 0 = pad)
from data_utils import encode_sequence
ids = encode_sequence("GLFDIVKKVVGALGSL", max_len=200)
x = torch.tensor([ids])
with torch.no_grad():
logits = model(x)
prob_amp = torch.softmax(logits, dim=-1)[0, 1].item()
print(f"P(AMP) = {prob_amp:.3f}")
```
## Dataset
Trained on the **GenPept-Curated-2025** benchmark. The curated tables are mirrored on the Hub as a
dataset repo:
- **HF dataset:** [devansh0703/GenPept-Curated-2025](https://huggingface.co/datasets/devansh0703/GenPept-Curated-2025)
- **Original source:** https://github.com/biochem-data-sci/GenPept-Curated-2025
- **Paper (bioRxiv):** https://doi.org/10.64898/2026.04.25.720793
- **License:** CC-BY-NC 4.0 (dataset belongs to its original authors — see dataset card)
Dataset summary:
- 11,000 peptide sequences (5,500 AMP / 5,500 non-AMP)
- Sequence lengths 10–200 amino acids
- Taxonomy: Bacteria, Archaea, Fungi
> **Note on splits:** the published numbers come from a simple random stratified split
> (`random_state=42`), *not* the homology-controlled CD-HIT split described in the README/paper.
## Training
The final pipeline lives in `train_final.py` (CUDA + mixed precision required):
```bash
python train_final.py
```
Key hyperparameters (embedded in `train_final.py`): `lr=3e-4`, `weight_decay=5e-5`,
`label_smoothing=0.1`, warmup 15 epochs over 100, cosine decay, gradient clipping 1.0,
early stopping patience 30 on validation F1.
## Test Results
From `results/final_results.json`:
| Metric | Value |
|--------|-------|
| Accuracy | 0.9134 |
| Precision | 0.9009 |
| Recall | 0.9290 |
| F1 | 0.9147 |
| AUC | 0.9510 |
| MCC | 0.8272 |
| Params | 3,434,018 |
## Files
| File | Description |
|------|-------------|
| `config.json` | Model hyperparameters |
| `model.safetensors` | Trained weights (SOTA pipeline) |
| `model_v2.py` | PeptEdgeV2 architecture + `from_pretrained`/`save_pretrained` |
| `data_utils.py` | AA vocab, encoding, dataloaders |
| `train_final.py` | Final training/eval pipeline |
| `model.py` / `train.py` | Earlier v1 architecture (kept for reference) |
| `train_v2.py` | Older grid-search script (outdated, lower metrics) |
## Citation
If you use this model, cite the model:
```bibtex
@article{peptedgev2,
title={PeptEdgeV2: A Parameter-Efficient Multi-Scale Hybrid Architecture for Antimicrobial Peptide Classification},
author={Devansh Raulo},
year={2026}
}
```
If you use the dataset, cite its original authors:
```bibtex
@article{Pham2026GenPeptCurated2025,
title={GenPept-Curated-2025: A Benchmark Dataset for Antimicrobial Peptide Prediction with Homology-Controlled Partitioning},
author={Huynh Trong Pham and Bao Huynh and Thanh-Hoang Nguyen-Vo},
journal={bioRxiv},
year={2026},
doi={10.64898/2026.04.25.720793}
}
```
## License
MIT