This prompt is designed for e-commerce and catalog search engineering teams who need to normalize user-facing product references into canonical catalog entries before retrieval. The core job-to-be-done is mapping messy, real-world language—product nicknames, version shorthand ('iPhone 15 Pro Max 256GB'), regional naming variants ('Walkman' vs 'WM-1000 series'), and legacy or rebranded product names—to a single, authoritative product identifier or canonical name that your search index or product database understands. The ideal user is a search relevance engineer, RAG developer, or catalog data manager who maintains a product master list and needs to bridge the gap between how customers speak and how products are stored.
Prompt
Product Name Canonicalization Prompt

When to Use This Prompt
Understand the specific job this prompt solves, the ideal user, required inputs, and when it should not be used.
Use this prompt when your retrieval system fails because user queries contain non-canonical terms that don't match your indexed product titles, descriptions, or SKU metadata. It is appropriate when you have a defined product catalog or canonical name list to provide as grounding context. The prompt works best when you can supply a structured mapping table, alias list, or product master data as part of the [CONTEXT] input. It handles discontinued products by mapping them to their successor or closest active equivalent, rebranded items by resolving to the current canonical name, and regional variants by normalizing to a global or market-specific canonical form based on your provided rules. Do not use this prompt when you lack a reliable source of truth for canonical names—without grounding data, the model will hallucinate product mappings. It is also not suitable for open-ended product discovery where no catalog exists, or for generating product descriptions from scratch.
Before implementing, ensure you have a maintained product alias table, canonical name authority, or product information management (PIM) system that can serve as the [CONTEXT] input. The prompt requires explicit handling of edge cases: discontinued products need a defined fallback strategy (map to successor, flag as unavailable, or return the closest match with a deprecation note), and regional variants need clear rules about whether to normalize to a global canonical name or preserve locale-specific identifiers. For high-stakes applications where incorrect product mapping could cause order errors, pricing mistakes, or compliance issues, always pair this prompt with a validation step that checks the output canonical name against your product database and a human review workflow for low-confidence mappings. The next step after reading this section is to gather your canonical product list and alias mappings, then proceed to the prompt template to begin implementation.
Use Case Fit
Where the Product Name Canonicalization Prompt works well and where it introduces risk. Use these cards to decide if this prompt fits your retrieval architecture before you integrate it.
Good Fit: Catalog-Backed Retrieval
Use when: you have a structured product catalog, SKU database, or canonical product master that serves as the source of truth. The prompt maps user shorthand to authoritative entries. Guardrail: always provide the canonical catalog as grounded context in the prompt; never rely on the model's parametric knowledge for product identifiers.
Bad Fit: Unstructured or Missing Catalog
Avoid when: no canonical product list exists, or the catalog is incomplete, stale, or contradictory. The prompt will hallucinate mappings or normalize to incorrect entries. Guardrail: run a catalog completeness check before deployment; if coverage is below threshold, route to a human review queue instead of attempting automated canonicalization.
Required Inputs
What you must provide: a current canonical product catalog with unique identifiers, display names, and known aliases; the user's raw query string; and a defined confidence threshold for matches. Guardrail: version-lock the catalog snapshot used in each prompt call so audit trails can reproduce exactly which catalog version produced a given mapping.
Operational Risk: Rebranding and Discontinuation
What to watch: products that have been renamed, merged, or discontinued. The prompt may map a legacy name to a wrong active product or fail to signal that the referenced item is no longer available. Guardrail: include product lifecycle status in the catalog context and require the prompt to flag discontinued or rebranded matches explicitly rather than silently substituting.
Operational Risk: Regional Variant Collision
What to watch: the same product name referring to different SKUs in different regions. Without region context, the prompt may pick the wrong variant. Guardrail: pass available region or market metadata alongside the query and instruct the prompt to request clarification when multiple region-specific candidates exist with similar confidence.
Operational Risk: Over-Normalization
What to watch: the prompt aggressively mapping vague or underspecified queries to a single canonical product when multiple candidates are plausible. This hides ambiguity from downstream retrieval. Guardrail: set a minimum confidence threshold and return multiple candidates with scores when no single match exceeds it; let the retrieval layer or user disambiguate.
Copy-Ready Prompt Template
A reusable prompt template for mapping user-mentioned product names, nicknames, and version shorthand to canonical catalog entries.
This prompt template is the core instruction set for a product name canonicalization system. It takes a raw user query containing product references and normalizes them against a provided product catalog. The template is designed to be copied directly into your prompt management system, with square-bracket placeholders that you replace with your specific catalog data, output schema, and operational constraints. The prompt handles common e-commerce challenges: nicknames ('iPhone 15 Pro Max' as 'the big one'), version shorthand ('v4' for 'Model X Gen 4'), regional naming variants ('Hoover' for a specific vacuum model), and discontinued or rebranded products.
textYou are a product name canonicalization engine for an e-commerce catalog. Your job is to map user-mentioned product names, nicknames, version shorthand, and regional variants to canonical catalog entries. ## INPUT User query: [USER_QUERY] ## PRODUCT CATALOG Use the following catalog as your source of truth. Each entry includes a canonical name, aliases, and status. [PRODUCT_CATALOG_JSON] ## OUTPUT SCHEMA Return a JSON object with this exact structure: { "original_query": "string", "canonical_matches": [ { "canonical_name": "string", "catalog_id": "string", "matched_term": "string", "match_type": "exact_match | alias_match | nickname_match | regional_variant | version_shorthand | context_inferred", "confidence": 0.0_to_1.0, "status": "active | discontinued | rebranded", "rebranded_to": "string_or_null" } ], "unmatched_terms": ["string"], "disambiguation_needed": true_or_false, "disambiguation_candidates": [ { "term": "string", "candidates": ["catalog_id"], "reason": "string" } ] } ## CONSTRAINTS - Only match against products in the provided catalog. Do not invent products. - If a product is marked as 'discontinued', include it but flag its status. - If a product is marked as 'rebranded', include the original match and populate 'rebranded_to' with the new canonical name. - For ambiguous references (e.g., 'the pro model' when multiple pro models exist), set 'disambiguation_needed' to true and list candidates. - Set confidence below 0.7 for context-inferred matches. Set confidence to 1.0 only for exact catalog name matches. - If a term cannot be matched to any catalog entry, add it to 'unmatched_terms'. - Do not hallucinate catalog IDs, aliases, or product relationships. ## EXAMPLES User query: 'I need a replacement battery for my MacBook Pro 16' Catalog includes: {"canonical_name": "MacBook Pro 16-inch (2023)", "catalog_id": "MBP16-2023", "aliases": ["MacBook Pro 16", "MBP 16"], "status": "active"} Expected match: canonical_name='MacBook Pro 16-inch (2023)', match_type='alias_match', confidence=0.95 User query: 'Show me the latest Galaxy Ultra' Catalog includes: {"canonical_name": "Galaxy S24 Ultra", "catalog_id": "GS24U", "aliases": ["Galaxy Ultra", "S24 Ultra"], "status": "active"} and {"canonical_name": "Galaxy S23 Ultra", "catalog_id": "GS23U", "aliases": ["Galaxy Ultra"], "status": "discontinued"} Expected: disambiguation_needed=true, candidates include both GS24U and GS23U. ## RISK LEVEL Medium. Incorrect canonicalization causes wrong product pages, bad recommendations, and customer confusion. Output must be validated before use in production retrieval or display.
To adapt this template for your catalog, replace [PRODUCT_CATALOG_JSON] with your actual product data structured as an array of objects, each containing canonical_name, catalog_id, aliases, and status. The aliases field should include all known nicknames, abbreviations, common misspellings, and regional variants for each product. If your catalog is large, consider pre-filtering to likely candidates before passing them into the prompt to stay within context limits. The [USER_QUERY] placeholder should receive the raw, unmodified user input. Before deploying, run this prompt against a golden dataset of 50-100 known query-to-product mappings and measure precision, recall, and the rate of false disambiguation flags. If your catalog changes frequently, schedule regular eval runs to detect drift in match quality.
Prompt Variables
Required and optional inputs for the Product Name Canonicalization Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to programmatically verify the input before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_QUERY] | The raw product reference from the user, which may contain nicknames, version shorthand, or regional variants. | I need the latest Macbook Pro 16 with the M3 chip. | Must be a non-empty string. Check for null, empty, or whitespace-only input before prompt assembly. Log raw input for traceability. |
[CATALOG_CONTEXT] | A JSON array of canonical product entries from the catalog, including product IDs, names, aliases, and status fields. | [{"id": "MBP16-M3-2023", "name": "MacBook Pro 16-inch (M3, 2023)", "aliases": ["MBP 16 M3", "Macbook Pro 16"], "status": "active"}] | Must parse as valid JSON array. Each entry must have id and name fields. Aliases array can be empty. Validate schema before prompt injection. If catalog is empty, prompt should return a no-match result, not hallucinate. |
[DISCONTINUED_PRODUCTS] | A JSON array of discontinued or rebranded products with their replacement mappings. | [{"legacy_id": "MBP16-M2-2022", "legacy_name": "MacBook Pro 16-inch (M2, 2022)", "replacement_id": "MBP16-M3-2023", "replacement_name": "MacBook Pro 16-inch (M3, 2023)"}] | Must parse as valid JSON array or be null if no discontinued products exist. Each entry requires legacy_id and replacement_id. Validate replacement_id exists in [CATALOG_CONTEXT] to prevent dangling references. |
[REGIONAL_VARIANTS] | A JSON object mapping region codes to arrays of region-specific product name variants. | {"US": ["MacBook Pro 16"], "UK": ["MacBook Pro 16-inch"], "JP": ["MacBook Pro 16インチ"]} | Must parse as valid JSON object or be null. Region codes should match ISO 3166-1 alpha-2. Validate that variant strings are non-empty. If null, prompt should skip regional matching logic. |
[REBRAND_MAP] | A JSON object mapping old brand or product-line names to current canonical names. | {"PowerBook": "MacBook Pro", "iBook": "MacBook Air"} | Must parse as valid JSON object or be null. Keys and values must be non-empty strings. Validate that values exist as product names or aliases in [CATALOG_CONTEXT] to prevent mapping to nonexistent products. |
[CONFIDENCE_THRESHOLD] | A float between 0.0 and 1.0 that sets the minimum confidence score for returning a canonical match. | 0.7 | Must be a number between 0.0 and 1.0 inclusive. Default to 0.5 if not provided. If threshold is too low, false matches increase. If too high, valid matches are missed. Log threshold in trace for debugging. |
[OUTPUT_SCHEMA] | The expected JSON schema for the canonicalization output, including fields for matched product, confidence, and alternatives. | {"type": "object", "properties": {"canonical_id": {"type": "string"}, "canonical_name": {"type": "string"}, "confidence": {"type": "number"}, "alternatives": {"type": "array"}}} | Must be a valid JSON Schema object. Validate with a schema validator before prompt assembly. Required fields: canonical_id, canonical_name, confidence. Alternatives array can be empty. Schema mismatch between prompt and application parser is a common production failure. |
[MAX_ALTERNATIVES] | An integer specifying the maximum number of alternative matches to return when the top match is below the confidence threshold. | 3 | Must be a positive integer. Default to 3 if not provided. Set to 0 to suppress alternatives entirely. Validate that value does not exceed catalog size to prevent oversized responses. |
Implementation Harness Notes
How to wire the Product Name Canonicalization Prompt into a production retrieval pipeline with validation, retries, and observability.
This prompt is designed to sit directly between the user's raw query and your product catalog retrieval index. The canonicalized output must be treated as a structured transformation, not a conversational reply. Wire it as a synchronous pre-retrieval step: user query in, structured canonicalization payload out. The output should be parsed into a machine-readable object before any downstream search or filter logic executes. Do not pass the raw model response string directly to your search engine—always validate the schema first.
Implement a strict validation layer immediately after the model response. The expected output schema includes canonical_name, product_id, confidence, and alternatives. Your validator must confirm: (1) product_id matches your internal catalog identifier format, (2) confidence is a float between 0.0 and 1.0, (3) alternatives is an array of objects with the same shape, and (4) no hallucinated identifiers appear that are absent from your provided [CATALOG_INDEX]. If validation fails, retry once with the error message injected into the prompt as additional [CONSTRAINTS]. If the retry also fails, fall back to a fuzzy text search using the original user query and log the failure for glossary gap analysis.
For model selection, prefer a model with strong instruction-following and structured output capabilities. This task requires precise schema adherence and low hallucination rates on entity resolution, not creative generation. If your catalog exceeds 50,000 SKUs, do not pass the entire catalog in the prompt. Instead, use a retrieval-augmented candidate set: first run a fast embedding-based similarity search to retrieve the top 20 candidate products, then pass only those candidates in [CATALOG_INDEX] to the canonicalization prompt. This keeps latency low and prevents the model from hallucinating plausible-sounding but nonexistent products from the tail of your catalog.
Observability is non-negotiable. Log every canonicalization attempt: the raw user query, the candidate set provided, the model's output, the validation result, and the final product ID used for retrieval. This trace is essential for debugging false mappings, detecting glossary drift, and identifying products that users refer to with slang or legacy names your catalog doesn't capture. Set up a periodic review of low-confidence canonicalizations (confidence < 0.7) to feed back into your entity alias table and improve coverage. For discontinued or rebranded products, ensure your catalog includes status and replaced_by fields so the prompt can surface appropriate alternatives rather than silently mapping to dead SKUs.
Human review is required when the prompt maps a query to a product with confidence < 0.5 or when the user's query contains terms that appear in your [DISCONTINUED_PRODUCTS] list. In these cases, do not automatically use the canonicalized result for retrieval. Instead, surface the alternatives to the user for disambiguation or route to a customer support queue. This prevents silent failures where the system retrieves irrelevant results for a product the user believes they're searching for. The prompt is a high-precision tool, not a replacement for catalog governance—keep your alias tables and product metadata current.
Expected Output Contract
Defines the structured output fields returned by the Product Name Canonicalization Prompt. Use this contract to validate model responses before passing results to downstream catalog retrieval or product APIs.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
canonical_matches | array of objects | Array must contain at least one entry if input_terms is non-empty. Validate array length >= 1 when input_terms present. | |
canonical_matches[].input_term | string | Must exactly match one entry from the [INPUT_TERMS] list. Validate by string equality check against the original input array. | |
canonical_matches[].canonical_product_name | string | Must be a non-empty string. Validate against [PRODUCT_CATALOG] if provided; otherwise, check for hallucination risk by flagging names not present in catalog context. | |
canonical_matches[].canonical_product_id | string | Must be a non-empty string matching the ID format in [PRODUCT_CATALOG] (e.g., SKU pattern, UUID). Validate format with regex if ID pattern is known. | |
canonical_matches[].match_confidence | string | Must be one of: 'exact', 'high', 'medium', 'low'. Validate against allowed enum values. Reject any other string. | |
canonical_matches[].match_type | string | Must be one of: 'exact_match', 'nickname', 'version_variant', 'regional_variant', 'rebranded', 'discontinued_successor', 'partial_guess'. Validate against allowed enum values. | |
canonical_matches[].alternative_candidates | array of objects or null | If match_confidence is 'medium' or 'low', this field should contain 1-3 alternative product objects with id and name. If null, validate that match_confidence is 'exact' or 'high'. | |
unmapped_terms | array of strings | Must contain any terms from [INPUT_TERMS] that could not be mapped. Validate that the union of canonical_matches input_terms and unmapped_terms equals the original [INPUT_TERMS] set. |
Common Failure Modes
Product name canonicalization fails in predictable ways. These are the most common production failure modes and how to guard against them before they degrade retrieval quality.
Nickname Not in Catalog
What to watch: Users refer to products by community nicknames, slang, or shorthand that never appear in your canonical catalog. The prompt maps 'Coke' to nothing because the catalog only contains 'Coca-Cola Classic 12oz.' Guardrail: Maintain a separate nickname-to-canonical alias table outside the prompt. Run the alias table before the LLM step, or include it as a pre-retrieval lookup. Log unmapped nicknames weekly and add them to the alias table.
Version Ambiguity Collapse
What to watch: A user mentions 'iPhone 15' but the catalog has 'iPhone 15,' 'iPhone 15 Pro,' and 'iPhone 15 Pro Max.' The prompt picks one arbitrarily or returns all three with no disambiguation signal. Guardrail: Require the prompt to output a ranked candidate list with confidence scores, not a single match. When confidence is below threshold, trigger a clarification question to the user before retrieval executes.
Rebranded Product Dead-End
What to watch: A user queries 'Google Bard' but the canonical catalog only contains 'Gemini.' The prompt returns no match or hallucinates a mapping. Guardrail: Include a rebranding and deprecation map in the prompt context. Require the output to distinguish between 'exact match,' 'rebranded successor,' and 'discontinued with no replacement.' Log rebrand queries to verify the map stays current.
Regional Variant Mismatch
What to watch: A user in the UK searches 'Walkers' expecting potato chips, but the US-centric catalog maps it to a different product or returns nothing. Regional naming variants cause silent failures. Guardrail: Include locale as a required input variable. Maintain regional alias tables keyed by market. When locale is missing, output a warning flag rather than guessing. Test canonicalization against each supported region's top 100 queries.
Hallucinated Product ID
What to watch: The prompt fabricates a SKU, UPC, or internal product ID that looks plausible but doesn't exist in the catalog. Downstream systems treat it as valid and return wrong inventory or pricing. Guardrail: Validate every returned product ID against the canonical catalog before passing it to retrieval or inventory systems. Add a strict instruction: 'Only return product IDs that appear verbatim in the provided catalog. Never generate or infer IDs.'
Discontinued Product Silent Drop
What to watch: A user searches for a discontinued product. The prompt either maps it to a dissimilar active product or returns no match without explanation. The user gets irrelevant results and no signal about why. Guardrail: Require the prompt to output a status field: 'active,' 'discontinued,' 'rebranded,' or 'unknown.' When discontinued, include the closest active successor with an explanation. Surface this status to the user so they understand the result.
Evaluation Rubric
Criteria for evaluating the quality and safety of the Product Name Canonicalization Prompt before deploying to production. Use these checks to gate releases and monitor drift.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Canonical Match Accuracy | Output canonical name matches the single correct catalog entry for the input variant with 100% precision on a golden set of 50 nicknames and shorthand terms. | Output maps 'iPhone 15 Pro Max 256GB' to 'iPhone 15 Pro' or returns a different SKU entirely. | Run prompt against a labeled golden dataset of [USER_QUERY] to [CANONICAL_PRODUCT_NAME] pairs. Assert exact string match or normalized equality. |
Discontinued Product Handling | When [USER_QUERY] references a discontinued product, output includes [STATUS]: 'discontinued' and a [SUCCESSOR] field pointing to the current replacement product. | Output returns [STATUS]: 'active' for a known discontinued SKU or leaves [SUCCESSOR] null when a valid replacement exists in the catalog. | Test with a list of 10 known discontinued products. Verify [STATUS] field and non-null [SUCCESSOR] where applicable. |
Rebranded Product Resolution | When [USER_QUERY] uses a legacy brand name, output maps to the current canonical name and sets [IS_REBRAND]: true. | Output returns the legacy name as canonical or sets [IS_REBRAND]: false for a known rebranding event. | Query using old brand names like 'Google Bard' expecting 'Gemini'. Check boolean flag and canonical name accuracy. |
Regional Variant Disambiguation | When [USER_QUERY] contains a regional nickname without a locale, output returns multiple candidates in [ALTERNATIVES] with distinct [REGION] tags rather than guessing. | Output confidently maps 'Galaxy S24 Ultra' to the North American variant when the user's context is ambiguous or unknown. | Input ambiguous regional shorthand without providing [USER_LOCALE]. Assert that [ALTERNATIVES] array length > 1 and no single canonical is forced. |
Hallucination Prevention | Output must not generate a canonical product name or SKU that is not present in the provided [PRODUCT_CATALOG] context. | Output returns a plausible-sounding product name that does not exist in the catalog, such as fabricating a 'Pro Max Mini' variant. | Scan output against the provided catalog. Use a strict string containment check. Fail if [CANONICAL_NAME] is not a substring of any catalog entry. |
Confidence Scoring Calibration | [CONFIDENCE] score is 0.9 or above for exact string matches, 0.5-0.9 for fuzzy or alias-based matches, and below 0.5 for no match or ambiguous cases. | [CONFIDENCE] is 0.99 for a vague nickname like 'the new Samsung' or 0.1 for an exact SKU match. | Run 20 test cases with known difficulty. Calculate correlation between human-labeled difficulty and model confidence. Fail if variance exceeds 0.3. |
Output Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and no extra keys. | Output is missing the [CANONICAL_SKU] field, includes a markdown fence, or adds an undefined 'explanation' key. | Validate output programmatically with a JSON schema validator. Fail on any schema violation. |
Version Shorthand Normalization | Input 'iPhone 15' correctly maps to the base model, while 'iPhone 15 Pro' maps to the Pro variant, respecting the distinction in the catalog. | Output maps both 'iPhone 15' and 'iPhone 15 Pro' to the same generic 'iPhone 15 Series' canonical entry. | Test with adjacent model tiers. Assert that distinct input strings map to distinct canonical entries when the catalog differentiates them. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a small catalog sample. Use a simple JSON output schema without strict enum validation. Run against 20–50 known product references and manually spot-check canonical matches.
codeMap the following product reference to its canonical catalog entry. User reference: [USER_INPUT] Catalog excerpt: [CATALOG_SAMPLE] Return JSON with canonical_name, product_id, and confidence.
Watch for
- Nicknames that map to multiple products with no disambiguation logic
- Discontinued products silently matched to active SKUs
- Regional variants collapsed into a single canonical entry without flagging

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us