---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- sparse-encoder
- sparse
- splade
- e-commerce
- product-search
- information-retrieval
- dataset_size:100000
- loss:SpladeLoss
- loss:SparseMultipleNegativesRankingLoss
- loss:FlopsLoss
base_model: distilbert/distilbert-base-uncased
widget:
- text: '[Panasonic] | Panasonic FV-0811VF5 WhisperFit EZ Retrofit Ventilation Fan,
80 or 110 CFM | Retrofit Solution: Ideal for residential remodeling, hotel construction
or renovations | Low Profile: 5-5/8-Inch housing depth fits in a 2 x 6 construction
| Pick-A-Flow Speed Selector: Allows you to pick desired airflow from 80 or 110
CFM'
- text: '[Clairol] | Clairol Natural Instincts Semi-Permanent Hair Dye, 8G Medium
Golden Blonde Hair Color, 3 Count | Get a rush color and a boost of shine for
radiant, healthy-looking hair | Our most gentle color to the hair, with 80% naturally
derived ingredients | Perfect for all hair types and textures'
- text: '#1 best and not expensive bath back brush cream color'
- text: '[Feelin Good Tees] | People Who Think The Know Graphic Novelty Sarcastic
Funny T Shirt XL Black | People Who Think They Know Everything Annoy Those Of
Us That Do Funny T-Shirt. The best part is when you pull this shirt over your
head you become the center of attention. The finest quality cotton te | AWESOME
FIT: Fits True to size, great fit and feel - Wash with cold water, inside out.
Want to make dad look like a super star? This shirt has a great look and cool
fit. This men''s funny t shirt fits great and is great for men, teenagers and
kids. Nothing beats a t shirts for a gift. People Who Think They Know Everything
Annoy Us That Do Makes A Great present for someone special. | TOP QUALITY: Our
Graphic Tees Professionally screen printed designed in USA by Feelin Good Tees.
Nothing beats our selection of funny sarcastic tshirts! It will make great father''s
day gifts, birthday present, friend gift, dad gifts, Christmas gift. This is a
great mens t shirt. Everyone needs a little humor and sarcasm. | GREAT FEEL: Our
Shirts are 100% preshrunk cotton exceptions; AshGrey is 99/1cotton/poly; SportGrey
is 90/10cotton/poly if available. Available in 2XL,3XL,4XL,5XL Tee will bring
adult humor out. The sarcasm laughs will flow. Graphic tee makes gift for dad.
Great gift idea for teenagers, boys and girls, dads, uncles and best friends.'
- text: magnetic screen door
datasets:
- tasksource/esci
pipeline_tag: feature-extraction
library_name: sentence-transformers
---
# SPLADE for E-Commerce Search
A SPLADE sparse encoder fine-tuned on [Amazon ESCI](https://huggingface.co/datasets/tasksource/esci) for e-commerce product search. Achieves **+28% improvement over BM25** on product retrieval tasks.
## Benchmark Results
### Amazon ESCI (In-Domain)
| Model | nDCG@10 | vs BM25 |
|-------|---------|---------|
| BM25 (baseline) | 0.305 | — |
| SPLADE (off-the-shelf) | 0.326 | +7% |
| **This model** | **0.389** | **+28%** |
### Cross-Domain Generalization
| Dataset | nDCG@10 | vs BM25 |
|---------|---------|---------|
| WANDS (Wayfair) | 0.355 | +8% |
| Home Depot | 0.384 | +10% |
## Model Description
This is a [SPLADE Sparse Encoder](https://www.sbert.net/docs/sparse_encoder/usage/usage.html) model finetuned from [distilbert/distilbert-base-uncased](https://huggingface.co/distilbert/distilbert-base-uncased) on the [esci](https://huggingface.co/datasets/tasksource/esci) dataset using the [sentence-transformers](https://www.SBERT.net) library. It maps sentences & paragraphs to a 30522-dimensional sparse vector space and can be used for semantic search and sparse retrieval.
## Model Details
### Model Description
- **Model Type:** SPLADE Sparse Encoder
- **Base model:** [distilbert/distilbert-base-uncased](https://huggingface.co/distilbert/distilbert-base-uncased)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 30522 dimensions
- **Similarity Function:** Dot Product
- **Training Dataset:**
- [esci](https://huggingface.co/datasets/tasksource/esci)
- **Languages:** en, ja, es
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Sparse Encoder Documentation](https://www.sbert.net/docs/sparse_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Hugging Face:** [Sparse Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=sparse-encoder)
### Full Model Architecture
```
SparseEncoder(
(0): MLMTransformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'DistilBertForMaskedLM'})
(1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', 'word_embedding_dimension': 30522})
)
```
## 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 SparseEncoder
# Download from the 🤗 Hub
model = SparseEncoder("sparse_encoder_model_id")
# Run inference
sentences = [
'magnetic screen door',
'[Flux Phenom] | Flux Phenom Magnetic Screen Door - Retractable Mesh with Self Sealing Magnets - Keeps Nature Out | The Flux Phenom magnetic screen door is made for any household. The instant screen door installs in just a few minutes in any doorway of your home. It keeps irritants out, lets fresh air in, and allow | 🔨Installs in an Instant: Our magnetic door screen comes with everything you need to install it quickly; black all metal thumbtacks, a large roll of hook and loop backing, plus video tutorial | 🚪Fits Doorways Up to 38x82 Inches: Door net works on fixed, sliding, metal or wood doors as long as they measure up to 38x82 inches. Important: Measure your door before ordering to ensure fit | ↔️ Opens and Closes Like Magic: Our retractable screen door features a middle seam lined with 26 magnets for walking through any doorway with ease',
'[HP] | HP VH240a 23.8-Inch Full HD 1080p IPS LED Monitor with Built-In Speakers and VESA Mounting, Rotating Portrait & Landscape, Tilt, and HDMI & VGA Ports (1KL30AA) - Black | RESOLUTION & PANEL — 23.8-inch Full HD monitor (1920 x 1080p at 60 Hz) with 16:9 aspect ratio and an anti-glare matte IPS LED-backlit panel (2 million pixels, 16.7 million colors) | RESPONSE TIME — 5ms with overdrive for a smooth picture that looks crisp and fluid without motion blur | BUILT-IN SPEAKERS — Integrated audio speakers provide great sound for your content (2 watts per channel)',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 30522]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 38.9048, 40.5171, 21.8987],
# [ 40.5171, 177.9286, 54.3905],
# [ 21.8987, 54.3905, 183.6391]])
```
## Training Details
### Training Dataset
#### esci
* Dataset: [esci](https://huggingface.co/datasets/tasksource/esci) at [8113b17](https://huggingface.co/datasets/tasksource/esci/tree/8113b17a5d4099e20243282c926f1bc1a08a4d13)
* Size: 100,000 training samples
* Columns: anchor and positive
* Approximate statistics based on the first 1000 samples:
| | anchor | positive |
|:--------|:--------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|
| type | string | string |
| details |
bathroom fan without light | [Panasonic] \| Panasonic FV-20VQ3 WhisperCeiling 190 CFM Ceiling Mounted Fan \| WhisperCeiling fans feature a totally enclosed condenser motor and a double-tapered, dolphin-shaped bladed blower wheel to quietly move air \| Designed to give you continuous, trouble-free operation for many years thanks in part to its high-quality components and permanently lubricated motors which wear at a slower pace \| Detachable adaptors, firmly secured duct ends, adjustable mounting brackets (up to 26-in), fan/motor units that detach easily from the housing and uncomplicated wiring all lend themselves to user-friendly installation |
| revent 80 cfm | [Homewerks] \| Homewerks 7141-80 Bathroom Fan Integrated LED Light Ceiling Mount Exhaust Ventilation, 1.1 Sones, 80 CFM \| OUTSTANDING PERFORMANCE: This Homewerk's bath fan ensures comfort in your home by quietly eliminating moisture and humidity in the bathroom. This exhaust fan is 1.1 sones at 80 CFM which means it’s able to manage spaces up to 80 square feet and is very quiet.. \| BATH FANS HELPS REMOVE HARSH ODOR: When cleaning the bathroom or toilet, harsh chemicals are used and they can leave an obnoxious odor behind. Homewerk’s bathroom fans can help remove this odor with its powerful ventilation \| BUILD QUALITY: Designed to be corrosion resistant with its galvanized steel construction featuring a modern style round shape and has an 4000K Cool White Light LED Light. AC motor. |
| revent 80 cfm | [Homewerks] \| Homewerks 7140-80 Bathroom Fan Ceiling Mount Exhaust Ventilation, 1.5 Sones, 80 CFM, White \| OUTSTANDING PERFORMANCE: This Homewerk's bath fan ensures comfort in your home by quietly eliminating moisture and humidity in the bathroom. This exhaust fan is 1. 5 sone at 110 CFM which means it’s able to manage spaces up to 110 square feet \| BATH FANS HELPS REMOVE HARSH ODOR: When cleaning the bathroom or toilet, harsh chemicals are used and they can leave an obnoxious odor behind. Homewerk’s bathroom fans can help remove this odor with its powerful ventilation \| BUILD QUALITY: Designed to be corrosion resistant with its galvanized steel construction featuring a grille modern style. |
* Loss: [SpladeLoss](https://sbert.net/docs/package_reference/sparse_encoder/losses.html#spladeloss) with these parameters:
```json
{
"loss": "SparseMultipleNegativesRankingLoss(scale=1.0, similarity_fct='dot_score', gather_across_devices=False)",
"document_regularizer_weight": 3e-05,
"query_regularizer_weight": 5e-05
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `learning_rate`: 2e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
- `router_mapping`: {'anchor': 'query', 'positive': 'document'}
#### All Hyperparameters