Instructions to use UNI-PIC/retail-embeddinggemma-2-tw with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use UNI-PIC/retail-embeddinggemma-2-tw with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("UNI-PIC/retail-embeddinggemma-2-tw") sentences = [ "那是 個快樂的人", "那是 條快樂的狗", "那是 個非常幸福的人", "今天是晴天" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
retail-embeddinggemma-2-tw
Note: Preliminary results. The scores below are from the development split; the held-out test split has not yet been scored.
retail-embeddinggemma-2-tw is a text embedding model fine-tuned from google/embeddinggemma-2 for Traditional Chinese (Taiwan) retail product search. It matches short shopper queries (for example, 洗衣精, Mizuno 慢跑鞋, and 客廳 邊桌 小空間) against product titles.
Model Details
| Developed by | President Information Corp. (統一資訊, PIC) and Uni-President Information Philippines Corp. (UNI-PIPC) |
| Model type | Text embedding model (Sentence Transformers) |
| Base model | google/embeddinggemma-2 |
| Adaptation method | Full fine-tuning (all weights trainable) |
| Parameters | 271M |
| Embedding dimension | 768 |
| Max sequence length | 192 tokens (training) |
| Domain | Taiwan retail and e-commerce product search |
| Languages | Traditional Chinese (zh-TW) |
| License | Apache 2.0 |
Key Features
- 🛒 Retail Search Adaptation: Trained mainly on real shopper search queries whose candidate products were graded by an LLM judge, supplemented with LLM-generated queries.
- 🏷️ Keyword-Tag Support: Accepts bare queries as well as
query + keyword tagsinputs, as produced by some search stacks. Training included noisy and incorrect tags so that a wrong tag does not override the query. - 🎯 Hard-Negative Training: Trained with judge-graded hard negatives, with near-duplicate products and overly broad titles filtered out to avoid false negatives.
- 🇹🇼 Taiwan Query Style: Covers short brand and product-type keywords, typographical errors, mixed Chinese–English queries, and descriptive or scenario queries.
Training Data
The training data is a proprietary Taiwan retail (zh-TW) dataset and is not publicly available. Queries come from two sources:
- Real shopper search queries. Candidate products were retrieved by several retrievers, and an LLM judge graded each (query, product title) pair as 0, 1, or 2. Grade-2 products serve as positives and grade-0 products as hard negatives. Grade-1 products are never used as negatives. Near-identical products (color or size variants) and broad titles that match many queries are filtered out.
- LLM-generated queries grounded in real products and written in the style of real traffic, with a smaller share of descriptive and scenario queries.
About 70% of training queries carry keyword tags and 30% are bare queries; a fraction of the tags are deliberately noisy. Held-out evaluation queries were excluded from training.
Training Procedure
| Objective | Contrastive learning (CachedMultipleNegativesRankingLoss) with in-batch negatives and 3 mined hard negatives per example |
| Batch size | 128 (effective) |
| Batch sampler | NO_DUPLICATES |
| Optimizer | Learning rate 2e-5, 10% warm-up, linear decay |
| Precision | bf16 |
| Epochs | 3 |
| Max sequence length | 192 tokens |
| Training hardware | 1× NVIDIA H100 |
Evaluation
Evaluation Setup
The fine-tuned model is compared against its base model, google/embeddinggemma-2, and a BM25 baseline (character bigrams). Evaluation uses real shopper search queries that were never used in training (split by query group), restricted to the 1,023 queries with at least one relevant product in the judged pool. Retrieval is performed over one proprietary retail product catalog, with product titles as documents.
Relevance is graded by an LLM judge (DeepSeek-V4-Flash) as 0, 1, or 2. Every product returned by any compared system is graded, so no system is penalized for retrieving a product that was not graded. Metrics are nDCG@10 against all graded products of each query and strict P@1 (the top-ranked product has grade 2); higher is better. Confidence intervals are 95% paired bootstrap intervals (5,000 resamples over queries), and gains are computed from unrounded scores.
🟢 improvement · 🔴 degradation · ⚪ no change (in the gain figures, 🟢 indicates that the 95% confidence interval excludes zero)
Retrieval Quality (Development Split)
Bare Query
Query + Keyword Tags
BM25 is not evaluated with keyword tags.
nDCG@10 Gain over the Base Model
Training-Overlap Analysis
The gain over the base model is reported by whether the relevant products of each query appeared in this model's training data (evaluation queries themselves were never used):
- Clean: no grade-2 product of the query was a training positive.
- Leaked: at least one grade-2 product of the query was a training positive.
- Never seen: no product of the query, positive or negative, appeared in training (a subset of Clean).
Usage
Input Format
The model was trained with the base model's own retrieval prompts, which must be passed at inference. Documents are product titles only.
Sentence Transformers
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("UNI-PIC/retail-embeddinggemma-2-tw")
Q = "task: search result | query: " # the base model's own retrieval prompts
D = "title: none | text: "
queries = ["洗衣精", "透明貼紙 文具", "客廳 邊桌 小空間"]
docs = ["Hampton 漢汀堡 迪亞小圓桌 寶石藍", "狐吉機場 透明割型貼紙", "白蘭 洗衣精 補充包 1.6kg"]
q = model.encode(queries, prompt=Q, normalize_embeddings=True)
d = model.encode(docs, prompt=D, normalize_embeddings=True)
print(q @ d.T)
Queries with Keyword Tags
If a search stack expands a query into keyword tags, the model was also trained on the input query + " " + ",".join(tags), for example 寶可夢 寶可夢,神奇寶貝,周邊. Bare queries remain fully supported.
Intended Use and Limitations
- Intended use: Dense retrieval and candidate generation for zh-TW retail product search, alone or combined with lexical search.
- Judge-based evaluation: Relevance labels come from an LLM judge rather than human annotators or click data. Absolute scores should be read as comparisons between systems under this setup, not as production accuracy.
- Single catalog: Training and evaluation used one proprietary catalog and its search logs; behavior on substantially different catalogs has not been tested.
- Tag dependence: Results are reported with and without keyword tags. If your tagger differs from the one used here, evaluate both input formats.
- Language scope: Taiwan Traditional Chinese only; other languages have not been evaluated.
- Use policy: Per the base model card, deployments must adhere to the Gemma Prohibited Use Policy.
License and Attribution
This model is released under the Apache License 2.0 (see LICENSE). It is a fine-tuned derivative of google/embeddinggemma-2 by Google DeepMind, which is also licensed under Apache 2.0; all model weights were modified by fine-tuning.
Citation
@misc{retailembeddinggemma2tw,
title = {retail-embeddinggemma-2-tw},
author = {President Information Corp. (PIC) and Uni-President Information Philippines Corp. (UNI-PIPC)},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/UNI-PIC/retail-embeddinggemma-2-tw}
}
Contact
- Taiwan: pic.net.tw/contactUs
- Philippines: pic.net.ph/about/contactUs
- Downloads last month
- 5
Model tree for UNI-PIC/retail-embeddinggemma-2-tw
Base model
google/embeddinggemma-2