Instructions to use davidvicente/ModernBERT-paper-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use davidvicente/ModernBERT-paper-classifier with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("davidvicente/ModernBERT-paper-classifier") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
ModernBERT Paper Classifier for Deduplication
This model is a fine-tuned version of answerdotai/ModernBERT-base designed to identify duplicate academic papers. It uses a SentenceTransformer architecture with a custom linear classification head trained using SoftmaxLoss.
It was specifically developed to deduplicate records between PubMed and Crossref databases.
Model Details
- Model Type: Sentence Transformer with Binary Classifier
- Base Model:
answerdotai/ModernBERT-base - Tokenizer: ModernBERT Tokenizer
- Classifier: A linear layer (saved as
classifier_weights.pt) that takes the concatenation of $(u, v, |u - v|)$ embeddings. - Maximum Sequence Length: 8192 tokens (inherited from ModernBERT)
- Training Language: English
Intended Use
This model is intended for academic paper deduplication. It expects a specific input format where paper metadata is concatenated using [SEP] tokens.
Input Format
The model was trained on strings joined in the following order:
Year [SEP] First Author [SEP] Journal [SEP] Title [SEP] Abstract
Training Data
The dataset was generated by cross-referencing papers from PubMed and Crossref:
- Positive Pairs: Papers identified as the same via DOI/PMID matches across both databases.
- Negative Pairs: Challenging negatives were generated by querying the Elasticsearch index of one source (e.g., PubMed) using the title of a paper from the other source (e.g., Crossref).
- Mirroring: The process was performed in both directions (PubMed β Crossref and Crossref β PubMed).
- Balance: The final test set was balanced to reflect an estimated real-world scenario where duplicates and non-duplicates appear with similar frequency in high-recall candidate sets.
Training Procedure
- Framework:
sentence-transformers - Loss Function:
SoftmaxLosswith 2 output labels (0: Not Duplicate, 1: Duplicate). - Epochs: 10
- Batch Size: 8
- Learning Rate: 5e-6
- Warmup Steps: 1000
- Optimizer: AdamW
Evaluation Results
Evaluated on a balanced test set:
| Metric | Value |
|---|---|
| Accuracy | 0.9862 |
| F1 Score | 0.9863 |
| Precision | 0.9822 |
| Recall | 0.9905 |
Usage
Since this model includes a separate classifier head, it is best loaded using the snapshot_download from huggingface_hub alongside the PaperClassifier class provided in the accompanying tool.
from huggingface_hub import snapshot_download
from paper_deduplication.paper_classifier import PaperClassifier
# 1. Download model and classifier weights
repo_id = "your-username/ModernBERT-paper-classifier"
model_path = snapshot_download(repo_id)
# 2. Initialize
classifier = PaperClassifier(model_path)
# 3. Predict
is_duplicate = classifier.deduplicate(
"2023 [SEP] Smith J [SEP] Nature [SEP] Title of paper A [SEP] Abstract...",
"2023 [SEP] Smith J [SEP] Nature [SEP] Title of paper B [SEP] Abstract..."
)
Citation
If you use this model in your research, please cite the repository:
@software{modernbert_paper_dedup,
author = {David Vicente},
institution = {University of Geneva},
title = {ModernBERT Paper Classifier for Deduplication},
year = {2026},
url = {https://huggingface.co/your-username/ModernBERT-paper-classifier}
}
- Downloads last month
- 10
Model tree for davidvicente/ModernBERT-paper-classifier
Base model
answerdotai/ModernBERT-base