Instructions to use devansh0703/PeptEdgeV2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use devansh0703/PeptEdgeV2 with Transformers:
# Load model directly from transformers import PeptEdgeV2 model = PeptEdgeV2.from_pretrained("devansh0703/PeptEdgeV2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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:
- Biophysical Embedding โ 12 physicochemical properties per amino acid (from a fixed table) concatenated with learned token embeddings (192-dim total).
- Multi-Scale Convolution โ four parallel
Conv1Dbranches (kernel sizes 3, 5, 7, 11) with batch norm + residual connections. - SwiGLU Transformer โ 5 transformer layers with gated feed-forward networks and stochastic depth regularization.
- 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 tomax_len=200.
Quickstart
Install:
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:
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
- 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):
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:
@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:
@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
- Downloads last month
- -
Evaluation results
- F1 Score on GenPept-Curated-2025 (balanced_11000)test set self-reported0.915
- Accuracy on GenPept-Curated-2025 (balanced_11000)test set self-reported0.913
- ROC AUC on GenPept-Curated-2025 (balanced_11000)test set self-reported0.951
- Matthews Correlation Coefficient on GenPept-Curated-2025 (balanced_11000)test set self-reported0.827