Prompt
How do I set up a semantic indexing platform for duplicate detection in product records?
Latest observation
To set up a semantic indexing platform for duplicate detection in product records, you want a pipeline that converts product data into searchable vector embeddings, indexes them efficiently, and compares likely matches using both semantic and exact signals.
Here’s a practical blueprint.
1. Define the duplicate problem clearly
Product duplicates usually come from one or more of these:
- same product entered multiple times by different vendors
- slightly different formatting of the same item
- variants mistaken as duplicates
- multilingual descriptions
- missing or inconsistent metadata
Decide what counts as a duplicate:
- Exact duplicate: same product, same variant
- Near duplicate: same product with minor wording/format differences
- Variant: same family but different size/color/model
- False positive risk: do you want conservative or aggressive matching?
This matters because semantic indexing can find “similar,” but you still need business rules to decide “duplicate.”
2. Standardize your product data first
Before indexing, normalize fields as much as possible.
Typical fields:
- product title
- brand
- manufacturer
- category
- description
- SKU / UPC / EAN / GTIN
- size, weight, color, pack count
- attributes/specs
- images (optional, later)
Normalization steps:
- lowercase text
- remove punctuation noise
- standardize units (
12 oz=340 g) - normalize brand names
- canonicalize categories
- parse structured attributes into key-value pairs
- deduplicate obvious exact matches on identifiers like GTIN/UPC first
A good pattern is to store both:
- raw text
- normalized canonical text
3. Build a product representation for embedding
For semantic indexing, create a single textual representation per product.
Example:
Brand: Nike
Title: Air Zoom Pegasus 40
Category: Running Shoes
Size: Men's 10
Color: Black/White
Description: Lightweight road running shoe with responsive cushioning.
You can create multiple embeddings per product:
- title-only embedding
- title + brand embedding
- full metadata embedding
- attribute embedding
This helps when one field is noisy or missing.
4. Choose an embedding model
Use a sentence embedding model suitable for short structured product text.
Options:
- general-purpose text embeddings from OpenAI or similar APIs
- open-source models like:
sentence-transformerse5bge- domain-tuned embedding models if available
Consider:
- dimensionality
- latency
- cost
- multilingual support
- ability to fine-tune or domain-adapt later
For product duplicate detection, embeddings work best when combined with metadata and exact match features.
5. Set up a vector index
Store embeddings in a vector database or vector-capable search engine.
Common choices:
- FAISS for local / high-performance prototype
- Milvus
- Pinecone
- Weaviate
- Qdrant
- Elasticsearch/OpenSearch with vector search
Index design:
- one vector per product record, or multiple vectors per record
- metadata stored alongside vectors
- filters for category, brand, region, language, etc.
Recommended:
- use metadata filters to reduce comparisons
- use ANN search for fast nearest-neighbor lookup
- keep an internal product ID mapping
6. Use a two-stage matching pipeline
Do not rely on embeddings alone.
Stage A: Candidate generation
Find top-K similar products using:
- vector similarity
- exact/approximate text search
- identifier matches
- category filters
Example:
- query product embedding
- retrieve top 50–200 candidate records
- restrict to same category if appropriate
Stage B: Candidate re-ranking / duplicate decision
Apply stronger logic to decide duplicates:
- exact match on UPC/EAN/GTIN = very high confidence
- brand similarity
- title similarity
- normalized attribute comparison
- size/pack count mismatch detection
- cross-encoder model or LLM-based pair classifier if needed
A pairwise score can combine:
- cosine similarity of embeddings
- Jaccard similarity of token sets
- exact identifier matches
- structured field matches
- penalties for conflicting attributes
7. Create matching rules and thresholds
You’ll need thresholds for:
- duplicate
- possible duplicate
- not duplicate
Example heuristic:
- if GTIN matches exactly → duplicate
- if brand matches and embedding similarity > 0.92 and title similarity > 0.85 → likely duplicate
- if same title but different size/pack count → likely variant, not duplicate
- if category differs significantly → reject
Calibrate thresholds using a labeled validation set.
8. Build a labeled dataset
To make the system reliable, create a gold-standard set of product pairs:
- duplicate
- variant
- non-duplicate
Label examples from real data:
- same product with formatting differences
- same product in different languages
- same product but different pack size
- different products with similar names
Use this dataset to:
- evaluate precision/recall
- tune thresholds
- train a classification/ranking model if needed
For duplicate detection, precision is often more important than recall if false merges are costly.
9. Add business rules for edge cases
Semantic similarity can over-match. Add rules like:
- different pack size = not duplicate unless same package count is acceptable
- different color may be duplicate or variant depending on business definition
- different voltage/model number = not duplicate
- same base product but accessory bundle = not duplicate
- different region-specific editions = maybe not duplicate
These rules often matter more than the embedding model.
10. Design the architecture
A common architecture:
-
Ingest
- pull product records from ERP/PIM/commerce DB
-
Normalize
- clean text and structured fields
-
Embed
- generate embeddings for chosen text fields
-
Index
- store vectors + metadata in vector DB/search engine
-
Match
- on new/updated record, query nearest neighbors
-
Score
- combine semantic and structured similarity
-
Decide
- auto-merge, flag for review, or reject
-
Feedback loop
- human decisions feed back into threshold tuning and model improvements
11. Operational considerations
Incremental updates
When a product is updated:
- re-embed changed fields
- update vector index
- re-run duplicate checks against relevant subset
Batch vs real-time
- Batch: good for large catalog cleanup
- Real-time: good for preventing duplicates on product creation
Scalability
For large catalogs:
- partition by category/brand
- use metadata filters
- precompute vectors
- periodically rebuild index if needed
Monitoring
Track:
- duplicate precision/recall
- manual review rate
- false merge rate
- time to match
- index health
12. Recommended implementation stack
A practical stack could be:
- Data processing: Python, pandas, Spark if large scale
- Embedding model: sentence-transformers / API embeddings
- Vector DB: Qdrant, Milvus, Pinecone, or FAISS
- Metadata store: Postgres / Elasticsearch / OpenSearch
- Workflow: Airflow, Dagster, or simple cron jobs
- API: FastAPI
- Labeling/review: internal UI or task system
13. Example matching logic
A simplified scoring approach:
score = (
0.45 * cosine_similarity(title_brand_embedding) +
0.25 * exact_brand_match +
0.15 * token_overlap(title) +
0.10 * attribute_match_score +
0.05 * identifier_match_score
)
Then:
score > 0.90→ duplicate0.75 < score <= 0.90→ review- otherwise → not duplicate
Adjust by category, since product similarity varies by domain.
14. Practical recommendations
If you’re starting from scratch:
- normalize structured fields
- use exact identifier matching first
- generate embeddings for title + brand + category
- store in a vector DB with metadata filters
- retrieve top-K candidates
- apply a rule-based scorer
- validate with labeled pairs
- introduce human review for uncertain matches
This gives you a system that is fast, explainable, and tunable.
If you want, I can also provide:
- a reference architecture diagram
- a Python/FastAPI example
- a schema for product indexing
- or a duplicate scoring function you can use as a starting point.
Observation history
Unlock observation history
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.