langcache-embed-v1 / README.md
srijithrajamohan's picture
Model card dataset type changed to unknown
e37e4de
|
raw
history blame
4.61 kB
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - loss:OnlineContrastiveLoss
base_model: Alibaba-NLP/gte-modernbert-base
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
  - cosine_accuracy
  - cosine_precision
  - cosine_recall
  - cosine_f1
  - cosine_ap
model-index:
  - name: SentenceTransformer based on Alibaba-NLP/gte-modernbert-base
    results:
      - task:
          type: my-binary-classification
          name: My Binary Classification
        dataset:
          name: Quora
          type: unknown
        metrics:
          - type: cosine_accuracy
            value: null
            name: Cosine Accuracy
          - type: cosine_f1
            value: null
            name: Cosine F1
          - type: cosine_precision
            value: null
            name: Cosine Precision
          - type: cosine_recall
            value: null
            name: Cosine Recall
          - type: cosine_ap
            value: null
            name: Cosine Ap

SentenceTransformer based on Alibaba-NLP/gte-modernbert-base

This is a sentence-transformers model finetuned from Alibaba-NLP/gte-modernbert-base on the Quora csv 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.

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:
    • csv

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

Direct Usage (Sentence Transformers)

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-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)


#### My Binary Classification

* Evaluated with <code>scache.train.MyBinaryClassificationEvaluator</code>

| Metric                    | Value     |
|:--------------------------|:----------|
| cosine_accuracy           | 0.9023    |
| cosine_f1                 | 0.9028    |
| cosine_precision          | 0.8987    |
| cosine_recall             | 0.9069    |
| **cosine_ap**             | **0.952** |


## Training Details

### Training Dataset

#### csv

* Dataset: csv
* Size: 323,480 training samples
* Columns: <code>question_1</code>, <code>question_2</code>, and <code>label</code>

### Evaluation Dataset

#### csv

* Dataset: csv
* Size: 323,480 evaluation samples
* Columns: <code>question_1</code>, <code>question_2</code>, and <code>label</code>

## Citation

### BibTeX

#### Sentence Transformers
```bibtex
@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",
}