Instructions to use ramitha2002/genieai-product-reranker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ramitha2002/genieai-product-reranker with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("ramitha2002/genieai-product-reranker") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
GenieAI Gift Product Reranker
This CrossEncoder reranks ecommerce products for English gift-shopping queries. It scores each (query, product text) pair; a higher score means the product should rank higher.
Model Details
| Item | Value |
|---|---|
| Repository | ramitha2002/genieai-product-reranker |
| Base model | cross-encoder/ms-marco-MiniLM-L6-v2 |
| Architecture | MiniLM CrossEncoder |
| Language | English |
| Maximum input length | 384 tokens |
| License | Apache 2.0 |
Training Data
The model was fine-tuned on the public tasksource/esci mirror of Amazon's Shopping Queries Dataset. Only English/US Task 1 query groups matching these gift categories were selected:
cakes and desserts
flower bouquets
chocolates and candy
perfume and fragrance
jewelry
fashion and accessories
gift baskets and hampers
skincare and beauty sets
personalized gifts
home decor and candles
All candidates belonging to each selected query were retained, including irrelevant negatives.
| Split | Pairs |
|---|---|
| Train | 20,486 |
| Validation | 8,677 |
| Validation query groups | 424 |
Training-category distribution:
| Category | Pairs |
|---|---|
| Fashion and accessories | 6,608 |
| Jewelry | 6,551 |
| Flower bouquets | 1,707 |
| Chocolates and candy | 1,602 |
| Home decor and candles | 1,328 |
| Cakes and desserts | 1,194 |
| Perfume and fragrance | 834 |
| Gift baskets and hampers | 240 |
| Skincare and beauty sets | 222 |
| Personalized gifts | 200 |
ESCI labels were converted to numeric relevance targets:
Exact = 1.00
Substitute = 0.70
Complement = 0.35
Irrelevant = 0.00
Training Settings
| Setting | Value |
|---|---|
| Epochs | 2 |
| Train batch size | 32 |
| Evaluation batch size | 64 |
| Learning rate | 2e-5 |
| Loss | Binary cross-entropy |
| Train loss | 0.5644 |
| Final evaluation loss | 0.5207 |
Evaluation
Evaluation used complete, grouped ESCI validation queries.
| Metric | Result |
|---|---|
| NDCG@10 | 0.8796 |
| MRR | 0.9591 |
| Hit Rate@4 | 0.9906 |
These results measure the filtered ESCI validation set and do not guarantee the same performance on GenieAI's live catalog.
Usage
from sentence_transformers import CrossEncoder
model = CrossEncoder("ramitha2002/genieai-product-reranker")
query = "birthday flowers for mother"
products = [
"Title: Pink rose bouquet\nDescription: Fresh roses for birthdays",
"Title: Wireless gaming mouse\nDescription: RGB computer mouse",
]
scores = model.predict([(query, product) for product in products])
ranked = sorted(zip(products, scores), key=lambda item: item[1], reverse=True)
print(ranked)
Raw outputs are ranking scores, not calibrated probabilities. Compare scores only among products evaluated for the same query.
Intended Use
- Rerank approximately 30 products retrieved by RAG or search.
- Apply hard stock, delivery, and budget filters before or after retrieval.
- Return the best four products after reranking.
- Fall back to the original retrieval order if model inference fails.
Limitations
- Optimized for English gift-product searches.
- Fashion and jewelry are overrepresented in the training set.
- Weaker performance is expected for skincare, personalized gifts, and hampers.
- The dataset does not represent GenieAI's live prices, stock, delivery rules, or complete catalog.
- Validate the model on real GenieAI queries before production use.
Data and Base Model
- Dataset: https://huggingface.co/datasets/tasksource/esci
- Original ESCI source: https://github.com/amazon-science/esci-data
- Base model: https://huggingface.co/cross-encoder/ms-marco-MiniLM-L6-v2
- Downloads last month
- 15
Model tree for ramitha2002/genieai-product-reranker
Base model
microsoft/MiniLM-L12-H384-uncased