ONNX Model Zoo

redis/langcache-embed-medical-v1

By redis · ↓ 7 · ♥ 1 · Updated 2025-05-22

What's in this repo

This page lists the files in redis/langcache-embed-medical-v1, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 14 files, including 8 .json, 1 .md, 1 .safetensors, 1 .onnx, 1 .bin, 1 .xml
  • Last updated 2025-05-22

ONNX files

File Size Download
onnx/model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Redis semantic caching embedding model based on Alibaba-NLP/gte-modernbert-base

This is a sentence-transformers model finetuned from Alibaba-NLP/gte-modernbert-base on the Medical dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity for the purpose of semantic caching in the medical domain.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: Alibaba-NLP/gte-modernbert-base
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

Usage

First install the Sentence Transformers library:

pip install -U sentence-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("redis/langcache-embed-medical-v1")
# Run inference
sentences = [
    'Will the value of Indian rupee increase after the ban of 500 and 1000 rupee notes?',
    'What will be the implications of banning 500 and 1000 rupees currency notes on Indian economy?',
    "Are Danish Sait's prank calls fake?",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)

Binary Classification
Metric Value
cosine_accuracy 0.92
cosine_f1 0.93
cosine_precision 0.92
cosine_recall 0.93
cosine_ap 0.97

Training Dataset

Medical
  • Dataset: Medical dataset
  • Size: 2438 samples
  • Columns: question_1, question_2, and label

Evaluation Dataset

Medical
  • Dataset: Medical dataset
  • Size: 610 samples
  • Columns: question_1, question_2, and label

Citation

BibTeX

Redis Langcache-embed Models
@inproceedings{langcache-embed-v1,
    title = "Advancing Semantic Caching for LLMs with Domain-Specific Embeddings and Synthetic Data",
    author = "Gill, Cechmanek, Hutcherson, Rajamohan, Agarwal, Gulzar, Singh, Dion",
    month = "04",
    year = "2025",
    url = "https://arxiv.org/abs/2504.02268",
}
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}

<!--

Model info

sentence-similarity sentence-transformers
sentence-transformers onnx safetensors openvino modernbert sentence-similarity loss:OnlineContrastiveLoss arxiv:2504.02268 arxiv:1908.10084 base_model:Alibaba-NLP/gte-modernbert-base base_model:quantized:Alibaba-NLP/gte-modernbert-base model-index
↓ 7 ♥ 1

Created: 2025-03-20

Updated: 2025-05-22

View on Hugging Face

Files (14)

.gitattributes
1_Pooling/config.json
README.md
config.json
config_sentence_transformers.json
model.safetensors
modules.json
onnx/model.onnx ONNX
openvino/openvino_model.bin
openvino/openvino_model.xml
sentence_bert_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json

Related models