---
language: []
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:1600000
- loss:TripletLoss
datasets: []
metrics:
- cosine_accuracy
- dot_accuracy
- manhattan_accuracy
- euclidean_accuracy
- max_accuracy
- pearson_cosine
- spearman_cosine
- pearson_manhattan
- spearman_manhattan
- pearson_euclidean
- spearman_euclidean
- pearson_dot
- spearman_dot
- pearson_max
- spearman_max
- cosine_accuracy@10
- cosine_precision@10
- cosine_recall@10
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@10
- dot_accuracy@10
- dot_precision@10
- dot_recall@10
- dot_ndcg@10
- dot_mrr@10
- dot_map@10
widget:
- source_sentence: 'search_query: pokemon card mewtwo'
sentences:
- 'search_document: Personal AM/FM Pocket Radio Portable VR-robot, Mini Digital
Tuning Walkman Radio, with Rechargeable Battery, Earphone, Lock Screen for Walk/Jogging/Gym/Camping,
VR-robot, Electronics'
- 'search_document: Pokemon Mewtwo & Pikachu XY Evolutions TCG Card Game Decks -
60 Cards Each, Pokemon, '
- 'search_document: Ultra Pro Pokemon: Charizard Album, 2", Ultra Pro, '
- source_sentence: 'search_query: table runners 108 inches'
sentences:
- 'search_document: Sambosk Fall Buffalo Pumpkin Table Runner, Autumn Farmhouse
Table Runners for Kitchen Dining Coffee or Indoor and Outdoor Home Parties Decor
13 x 72 Inches SK006, Sambosk, Black White'
- 'search_document: EYEGUARD Readers 4 Pack of Thin and Elegant Womens Reading Glasses
with Beautiful Patterns for Ladies 1.00, EYEGUARD, Mix'
- 'search_document: Sunfiy 4 Pack Red Satin Table Runner 12 x 108 Inch Long Table
Runners for Wedding Birthday Parties Banquets Graduations Engagements, Sunfiy,
Red'
- source_sentence: 'search_query: nursing shoes for women'
sentences:
- 'search_document: Hawkwell Women''s Lightweight Comfort Slip Resistant Nursing
Shoes,White PU,10 M US, Hawkwell, 1923/White'
- 'search_document: REESE''S Peanut Butter Milk Chocolate You''re Amazing Appreciation
Candy Bars for Christmas and Holiday Season, 4.2 oz Bars, 12 Count, Reese''s, '
- 'search_document: adidas womens Cloudfoam Pure Running Shoe, Black/Black, 7.5
US, adidas, Black/Black/White'
- source_sentence: 'search_query: mens socks black and white'
sentences:
- 'search_document: Fruit of the Loom Men''s Essential 6 Pack Casual Crew Socks
| Arch Support | Black & White, Black, Shoe Size: 6-12, Fruit of the Loom, Black'
- 'search_document: adidas Originals Men''s Trefoil Crew Socks (6-Pair), White/Black
Black/White, Large, (Shoe Size 6-12), adidas Originals, White/Black'
- 'search_document: Fifty Shades of Grey, , '
- source_sentence: 'search_query: karoke set 2 microphone for adults'
sentences:
- 'search_document: EARISE T26 Portable Karaoke Machine Bluetooth Speaker with Wireless
Microphone, Rechargeable PA System with FM Radio, Audio Recording, Remote Control,
Supports TF Card/USB, Perfect for Party, EARISE, '
- 'search_document: FunWorld Men''s Complete 3D Zombie Costume, Grey, One Size,
Fun World, Multi'
- 'search_document: Starion KS829-B Bluetooth Karaoke Machine l Pedestal Design
w/Light Show l Two Karaoke Microphones, Starion, Black'
pipeline_tag: sentence-similarity
model-index:
- name: SentenceTransformer
results:
- task:
type: triplet
name: Triplet
dataset:
name: Unknown
type: unknown
metrics:
- type: cosine_accuracy
value: 0.7298125
name: Cosine Accuracy
- type: dot_accuracy
value: 0.2831875
name: Dot Accuracy
- type: manhattan_accuracy
value: 0.72825
name: Manhattan Accuracy
- type: euclidean_accuracy
value: 0.729875
name: Euclidean Accuracy
- type: max_accuracy
value: 0.729875
name: Max Accuracy
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: Unknown
type: unknown
metrics:
- type: pearson_cosine
value: 0.4148003591706621
name: Pearson Cosine
- type: spearman_cosine
value: 0.39973675544358156
name: Spearman Cosine
- type: pearson_manhattan
value: 0.37708819507475255
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.36992167570513307
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.3777862291730549
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.3707889635811508
name: Spearman Euclidean
- type: pearson_dot
value: 0.3813644395159763
name: Pearson Dot
- type: spearman_dot
value: 0.3817136551173837
name: Spearman Dot
- type: pearson_max
value: 0.4148003591706621
name: Pearson Max
- type: spearman_max
value: 0.39973675544358156
name: Spearman Max
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: Unknown
type: unknown
metrics:
- type: cosine_accuracy@10
value: 0.967
name: Cosine Accuracy@10
- type: cosine_precision@10
value: 0.6951
name: Cosine Precision@10
- type: cosine_recall@10
value: 0.6216729831257005
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.8300106033542061
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.9111154761904765
name: Cosine Mrr@10
- type: cosine_map@10
value: 0.7758485833963215
name: Cosine Map@10
- type: dot_accuracy@10
value: 0.946
name: Dot Accuracy@10
- type: dot_precision@10
value: 0.6369
name: Dot Precision@10
- type: dot_recall@10
value: 0.5693415261440723
name: Dot Recall@10
- type: dot_ndcg@10
value: 0.7668657376718138
name: Dot Ndcg@10
- type: dot_mrr@10
value: 0.8754059523809526
name: Dot Mrr@10
- type: dot_map@10
value: 0.6962231903502142
name: Dot Map@10
---
# SentenceTransformer
This is a [sentence-transformers](https://www.SBERT.net) model trained on the triplets dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Maximum Sequence Length:** 8192 tokens
- **Output Dimensionality:** 768 tokens
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- triplets
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co./models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NomicBertModel
(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, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("lv12/esci-nomic-embed-text-v1_5_4")
# Run inference
sentences = [
'search_query: karoke set 2 microphone for adults',
'search_document: Starion KS829-B Bluetooth Karaoke Machine l Pedestal Design w/Light Show l Two Karaoke Microphones, Starion, Black',
'search_document: EARISE T26 Portable Karaoke Machine Bluetooth Speaker with Wireless Microphone, Rechargeable PA System with FM Radio, Audio Recording, Remote Control, Supports TF Card/USB, Perfect for Party, EARISE, ',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Triplet
* Evaluated with [TripletEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.TripletEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| **cosine_accuracy** | **0.7298** |
| dot_accuracy | 0.2832 |
| manhattan_accuracy | 0.7282 |
| euclidean_accuracy | 0.7299 |
| max_accuracy | 0.7299 |
#### Semantic Similarity
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.4148 |
| **spearman_cosine** | **0.3997** |
| pearson_manhattan | 0.3771 |
| spearman_manhattan | 0.3699 |
| pearson_euclidean | 0.3778 |
| spearman_euclidean | 0.3708 |
| pearson_dot | 0.3814 |
| spearman_dot | 0.3817 |
| pearson_max | 0.4148 |
| spearman_max | 0.3997 |
#### Information Retrieval
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@10 | 0.967 |
| cosine_precision@10 | 0.6951 |
| cosine_recall@10 | 0.6217 |
| cosine_ndcg@10 | 0.83 |
| cosine_mrr@10 | 0.9111 |
| **cosine_map@10** | **0.7758** |
| dot_accuracy@10 | 0.946 |
| dot_precision@10 | 0.6369 |
| dot_recall@10 | 0.5693 |
| dot_ndcg@10 | 0.7669 |
| dot_mrr@10 | 0.8754 |
| dot_map@10 | 0.6962 |
## Training Details
### Training Dataset
#### triplets
* Dataset: triplets
* Size: 1,600,000 training samples
* Columns: anchor
, positive
, and negative
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
| type | string | string | string |
| details |
search_query: udt hydraulic fluid
| search_document: Triax Agra UTTO XL Synthetic Blend Tractor Transmission and Hydraulic Oil, 6,000 Hour Life, 50% Less wear, 36F Pour Point, Replaces All OEM Tractor Fluids (5 Gallon Pail), TRIAX,
| search_document: Shell Rotella T5 Synthetic Blend 15W-40 Diesel Engine Oil (1-Gallon, Case of 3), Shell Rotella,
|
| search_query: cheetah print iphone xs case
| search_document: iPhone Xs Case, iPhone Xs Case,Doowear Leopard Cheetah Protective Cover Shell For Girls Women,Slim Fit Anti Scratch Shockproof Soft TPU Bumper Flexible Rubber Gel Silicone Case for iPhone Xs / X-1, Ebetterr, 1
| search_document: iPhone Xs & iPhone X Case, J.west Luxury Sparkle Bling Translucent Leopard Print Soft Silicone Phone Case Cover for Girls Women Flex Slim Design Pattern Drop Protective Case for iPhone Xs/x 5.8 inch, J.west, Leopard
|
| search_query: platform shoes
| search_document: Teva Women's Flatform Universal Platform Sandal, Black, 5 M US, Teva, Black
| search_document: Vans Women's Old Skool Platform Trainers, (Black/White Y28), 5 UK 38 EU, Vans, Black/White
|
* Loss: [TripletLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#tripletloss) with these parameters:
```json
{
"distance_metric": "TripletDistanceMetric.COSINE",
"triplet_margin": 0.8
}
```
### Evaluation Dataset
#### triplets
* Dataset: triplets
* Size: 16,000 evaluation samples
* Columns: anchor
, positive
, and negative
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string | string |
| details | search_query: hogknobz
| search_document: Black 2014-2015 HDsmallPARTS/LocEzy Saddlebag Mounting Hardware Knobs are replacement/compatible for Saddlebag Quick Release Pins on Harley Davidson Touring Motorcycles Theft Deterrent, LocEzy,
| search_document: HANSWD Saddlebag Support Bars Brackets For SUZUKI YAMAHA KAWASAKI (Black), HANSWD, Black
|
| search_query: tile sticker key finder
| search_document: Tile Sticker (2020) 2-pack - Small, Adhesive Bluetooth Tracker, Item Locator and Finder for Remotes, Headphones, Gadgets and More, Tile,
| search_document: Tile Pro Combo (2017) - 2 Pack (1 x Sport, 1 x Style) - Discontinued by Manufacturer, Tile, Graphite/Gold
|
| search_query: adobe incense burner
| search_document: AM Incense Burner Frankincense Resin - Luxury Globe Charcoal Bakhoor Burners for Office & Home Decor (Brown), AM, Brown
| search_document: semli Large Incense Burner Backflow Incense Burner Holder Incense Stick Holder Home Office Decor, Semli,
|
* Loss: [TripletLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#tripletloss) with these parameters:
```json
{
"distance_metric": "TripletDistanceMetric.COSINE",
"triplet_margin": 0.8
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 16
- `gradient_accumulation_steps`: 2
- `learning_rate`: 1e-07
- `num_train_epochs`: 5
- `lr_scheduler_type`: polynomial
- `lr_scheduler_kwargs`: {'lr_end': 1e-08, 'power': 2.0}
- `warmup_ratio`: 0.05
- `dataloader_drop_last`: True
- `dataloader_num_workers`: 4
- `dataloader_prefetch_factor`: 4
- `load_best_model_at_end`: True
- `gradient_checkpointing`: True
- `auto_find_batch_size`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters