NeuML_pubmedbert-base-embeddings
NeuML · View on Hugging Face ↗
Biomedical embeddings from PubMedBERT — similarity and search over medical/scientific text.
✓ verified · rehash-vs-hf-metadata at 2026-08-24T08:10:41Z
apache-2.0836.3 MB (876,888,830 bytes)sentence-transformerspytorchsafetensorsbertfeature-extractionsentence-similaritytransformerstext-embeddings-inferenceendpoints_compatible1 language (en)
Get this model
Download NeuML_pubmedbert-base-embeddings.torrent
Recommended — the .torrent carries the webseed url-list, so your client can fall back to plain HTTPS if the swarm is thin. See/verify for the full download + verification walkthrough.
Model card
The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.
pipeline_tag: sentence-similarity tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers base_model: microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext language: en license: apache-2.0
PubMedBERT Embeddings
This is a PubMedBERT-base model fined-tuned using sentence-transformers. It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search. The training dataset was generated using a random sample of PubMed title-abstract pairs along with similar title pairs.
PubMedBERT Embeddings produces higher quality embeddings than generalized models for medical literature. Further fine-tuning for a medical subdomain will result in even better performance.
Usage (txtai)
This model can be used to build embeddings databases with txtai for semantic search and/or as a knowledge source for retrieval augmented generation (RAG).
import txtai
embeddings = txtai.Embeddings(path="neuml/pubmedbert-base-embeddings", content=True)
embeddings.index(documents())
# Run a query
embeddings.search("query to run")
Usage (Sentence-Transformers)
Alternatively, the model can be loaded with sentence-transformers.
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer("neuml/pubmedbert-base-embeddings")
embeddings = model.encode(sentences)
print(embeddings)
Usage (Hugging Face Transformers)
The model can also be used directly with Transformers.
from transformers import AutoTokenizer, AutoModel
import torch
# Mean Pooling - Take attention mask into account for correct averaging
def meanpooling(output, mask):
embeddings = output[0] # First element of model_output contains all token embeddings
mask = mask.unsqueeze(-1).expand(embeddings.size()).float()
return torch.sum(embeddings * mask, 1) / torch.clamp(mask.sum(1), min=1e-9)
# Sentences we want sentence embeddings for
sentences = ['This is an example sentence', 'Each sentence is converted']
# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained("neuml/pubmedbert-base-embeddings")
model = AutoModel.from_pretrained("neuml/pubmedbert-base-embeddings")
# Tokenize sentences
inputs = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
# Compute token embeddings
with torch.no_grad():
output = model(**inputs)
# Perform pooling. In this case, mean pooling.
embeddings = meanpooling(output, inputs['attention_mask'])
print("Sentence embeddings:")
print(embeddings)
Evaluation Results
Performance of this model compared to the top base models on the MTEB leaderboard is shown below. A popular smaller model was also evaluated along with the most downloaded PubMed similarity model on the Hugging Face Hub.
The following datasets were used to evaluate model performance.
- PubMed QA
- Subset: pqa_labeled, Split: train, Pair: (question, long_answer)
- PubMed Subset
- Split: test, Pair: (title, text)
- PubMed Summary
- Subset: pubmed, Split: validation, Pair: (article, abstract)
Evaluation results are shown below. The Pearson correlation coefficient is used as the evaluation metric.
| Model | PubMed QA | PubMed Subset | PubMed Summary | Average |
|---|---|---|---|---|
| all-MiniLM-L6-v2 | 90.40 | 95.92 | 94.07 | 93.46 |
| bge-base-en-v1.5 | 91.02 | 95.82 | 94.49 | 93.78 |
| gte-base | 92.97 | 96.90 | 96.24 | 95.37 |
| pubmedbert-base-embeddings | 93.27 | 97.00 | 96.58 | 95.62 |
| S-PubMedBert-MS-MARCO | 90.86 | 93.68 | 93.54 | 92.69 |
Training
The model was trained with the parameters:
DataLoader:
torch.utils.data.dataloader.DataLoader of length 20191 with parameters:
{'batch_size': 24, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
Loss:
sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss with parameters:
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
Parameters of the fit() method:
{
"epochs": 1,
"evaluation_steps": 500,
"evaluator": "sentence_transformers.evaluation.EmbeddingSimilarityEvaluator.EmbeddingSimilarityEvaluator",
"max_grad_norm": 1,
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
"optimizer_params": {
"lr": 2e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 10000,
"weight_decay": 0.01
}
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
)
More Information
Read more about PubMedBERT Embeddings in this article and this paper.
Magnet link (secondary — no webseeds)
Opens the swarm directly, but carries no webseed url-list. Prefer the.torrent download above — HTTP fallback seeds ride inside it.
magnet:?xt=urn:btih:4c917ceed5614490c5603049ce036500bc7d3817&dn=NeuML_pubmedbert-base-embeddingsOpen magnet in torrent client · infohash 4c917ceed5614490c5603049ce036500bc7d3817
Files & hashes
| Path | Size | Method | Hash |
|---|---|---|---|
| 1_Pooling/config.json | 190 B (190 B) | sha1-git-blob | 4e09f293dfe90bba49f87cfe7996271f07be2666 |
| README.md | 6.2 KB (6,327 B) | sha1-git-blob | c072f9810141195e949775442eed2c71a9d313a3 |
| added_tokens.json | 74 B (74 B) | sha1-git-blob | e97f8f93bfdfff48a98fde37a3cd61007272f226 |
| config.json | 667 B (667 B) | sha1-git-blob | 57f2c3f2a401cc2458702f3ef56196182059cc77 |
| config_sentence_transformers.json | 123 B (123 B) | sha1-git-blob | 659ada2a861065243395214e70a751bc290a9789 |
| model.safetensors | 417.7 MB (437,951,328 B) | sha256-lfs | 929ddc16369bb4ff6f8e92a6ee9f5e0748f2bef33989b5617533dd50beebe4ef |
| modules.json | 229 B (229 B) | sha1-git-blob | f7640f94e81bb7f4f04daf1668850b38763a13d9 |
| pytorch_model.bin | 417.7 MB (437,995,689 B) | sha256-lfs | 0bdb9787bcb608f0e4dbfa2724821b7d66a66be79508bff915a9d2e3fe1f3853 |
| sentence_bert_config.json | 53 B (53 B) | sha1-git-blob | f789d99277496b282d19020415c5ba9ca79ac875 |
| similarity_evaluation_results.csv | 301 B (301 B) | sha1-git-blob | bbfcb4417cf2f3c75ea942a1c90a4ecdd6fa75e5 |
| special_tokens_map.json | 125 B (125 B) | sha1-git-blob | a8b3208c2884c4efb86e49300fdd3dc877220cdf |
| tokenizer.json | 689.7 KB (706,277 B) | sha1-git-blob | e68fee3b6ebe7cc02f2b5f9753071bdf2c401ecf |
| tokenizer_config.json | 1.3 KB (1,297 B) | sha1-git-blob | 9dd776f5174e80e964412f1ff41a2d0f4e795782 |
| vocab.txt | 220.8 KB (226,150 B) | sha1-git-blob | 9d595d9c20feef7012f174efaaa5eb621910588e |
Provenance
| Upstream repository | NeuML/pubmedbert-base-embeddings |
|---|---|
| Revision (pinned) | b79526d6ef3645e0df4530322e266f24c829f5ef |
| Fetched at | 2026-08-24T08:10:10Z |
| License at fetch | apache-2.0 |
| Snapshot tool | huggingface · seedbank 0.1.0 |
Trackers
- udp://announce.aitorrent.org:6969/announce
- http://announce.aitorrent.org:7070/announce
- udp://announce2.aitorrent.org:6970/announce
- http://announce2.aitorrent.org:7071/announce
- udp://tracker.opentrackr.org:1337/announce
- udp://open.demonii.com:1337/announce
- udp://open.stealth.si:80/announce
- udp://exodus.desync.com:6969/announce
- udp://tracker.torrent.eu.org:451/announce