Inferensys

Prompt

Product Mention Detection and Resolution Prompt Template

A practical prompt playbook for detecting product mentions in unstructured text and resolving them to canonical catalog entries, handling model numbers, generational variants, and informal nicknames.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the ideal use cases, required context, and boundaries for the Product Mention Detection and Resolution prompt before integrating it into your pipeline.

This prompt is designed for operational teams—e-commerce catalog managers, market intelligence analysts, and support operations engineers—who need to extract product references from unstructured text and resolve them to canonical SKUs or catalog entries. The core job-to-be-done is consistent entity resolution: turning a messy mention like 'the new iPhone' or 'Coke Zero' into a structured, queryable reference such as SKU:IPH15P-256-BLK or Brand:Coca-Cola, Product:Coke Zero Sugar. Use this when your workflow requires downstream analytics, ticket routing, or competitive monitoring that depends on accurate product identification, not just keyword matching.

This prompt assumes you have a catalog, SKU list, or product master data available to inject as [CONTEXT]. It is designed to handle model numbers ('XPS 15 9530'), generational variants ('iPhone 14' vs 'iPhone 14 Pro'), informal nicknames ('Coke' for 'Coca-Cola Classic'), and ambiguous mentions by using that context to disambiguate. Do not use this prompt when the goal is product search, recommendation, or marketing copy generation. It is not a retrieval system on its own; it resolves mentions against a provided catalog. It is also not a general-purpose NER model—it focuses exclusively on products and SKUs, not people, locations, or organizations. For high-risk domains like regulated product claims or safety recalls, you must route low-confidence resolutions to a human review queue and never treat the model's output as authoritative without verification.

Before wiring this into production, define your [OUTPUT_SCHEMA] to match your downstream ingestion contract—typically a JSON array of objects with fields for mention_text, resolved_sku, canonical_name, and confidence. Plan for failure modes: the model may resolve a mention to the wrong SKU if your catalog context is incomplete, or it may miss a mention entirely if the product is described in highly idiomatic language. Start by running this prompt against a golden dataset of 50–100 annotated examples to calibrate your confidence thresholds and decide when to escalate to human review. The next section provides the copy-ready template.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Product mention detection requires clear catalog contracts and tolerance for informal language.

01

Strong Fit: E-Commerce Catalog Matching

Use when: You have a known product catalog with canonical SKUs, model numbers, and variant structures. The prompt maps informal mentions ('iPhone 15 Pro Max 256GB') to exact catalog entries. Guardrail: Provide the catalog as structured context with explicit fields for SKU, brand, model, and generation.

02

Strong Fit: Market Intelligence Monitoring

Use when: Scanning reviews, social media, or competitor content for product references that need normalization before trend analysis. Guardrail: Set a confidence threshold for ambiguous mentions and route low-confidence matches to human review queues.

03

Poor Fit: Open-Ended Product Discovery

Avoid when: You need the model to identify products it has never seen in training or catalog context. The prompt resolves mentions to known entities, not discovers new ones. Guardrail: Pair with a separate novelty detection step that flags unrecognized product references for catalog expansion.

04

Required Input: Canonical Catalog Contract

Risk: Without a structured catalog, the model hallucinates SKUs or normalizes to plausible but incorrect entries. Guardrail: Always supply the catalog as a JSON array with required fields (id, name, brand, model, variants). Validate output SKUs exist in the input catalog before ingestion.

05

Operational Risk: Informal Nickname Drift

Risk: Users refer to products by nicknames ('Coke Zero' vs 'Coca-Cola Zero Sugar'), regional names, or legacy branding that differs from current catalog entries. Guardrail: Maintain a synonym map or alias table alongside the catalog. Test regularly against real user language samples.

06

Operational Risk: Generational Variant Confusion

Risk: 'iPhone 15' vs 'iPhone 15 Pro' vs 'iPhone 15 Pro Max' with storage and color variants creates combinatorial ambiguity. Guardrail: Require the prompt to output both the resolved base product and the specific variant. Flag mentions where variant disambiguation confidence is below threshold.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A production-ready prompt for detecting product mentions in text and resolving them to canonical catalog entries.

This template is designed to be pasted directly into your system instructions for a model call. It instructs the model to identify product references—including informal nicknames, model numbers, and generational variants—and map them to your canonical SKU or catalog ID. The prompt uses strict square-bracket placeholders that you must replace with your specific data before sending the request to the model. Do not leave any placeholder unresolved in production; missing context will cause the model to hallucinate catalog entries or miss mentions entirely.

text
You are a product mention detection and resolution system. Your task is to analyze the provided text and identify all references to products. For each mention, you must resolve it to a single canonical entry from the provided product catalog. If a mention cannot be confidently resolved, flag it for human review instead of guessing.

## INPUT
[INPUT_TEXT]

## PRODUCT CATALOG
[PRODUCT_CATALOG_JSON]

## RESOLUTION RULES
- Match against product names, model numbers, SKUs, and known informal nicknames listed in the catalog.
- For generational variants (e.g., 'iPhone 14' vs. 'iPhone'), resolve to the most specific matching entry. If the text is ambiguous, select the latest generation unless context indicates otherwise.
- If a mention matches multiple catalog entries with equal confidence, flag it as ambiguous.
- If a mention has no plausible match in the catalog, flag it as 'unresolved'.
- Do not infer a product mention from accessory, part, or service descriptions unless the core product is explicitly referenced.

## OUTPUT SCHEMA
Return a valid JSON object with a single key "product_mentions" containing an array of objects. Each object must have the following fields:
- "mention_text": The exact string from the input text.
- "canonical_sku": The resolved SKU from the catalog, or null if unresolved.
- "canonical_name": The resolved product name from the catalog, or null if unresolved.
- "confidence": One of "high", "medium", or "low".
- "status": One of "resolved", "ambiguous", or "unresolved".
- "resolution_notes": A brief explanation of the resolution decision or the reason for flagging.

## CONSTRAINTS
- Do not return any text outside the JSON object.
- If no product mentions are found, return {"product_mentions": []}.
- Do not fabricate SKUs or catalog entries.

Before deploying this template, replace [INPUT_TEXT] with the raw text you want to analyze and [PRODUCT_CATALOG_JSON] with a structured JSON array of your canonical product records. Each catalog record should include at minimum sku, name, and aliases (an array of known nicknames or model numbers). For high-risk e-commerce workflows where incorrect resolution could lead to mis-shipments or pricing errors, always route low confidence and ambiguous status results to a human review queue. After adapting the prompt, run it against a golden dataset of 50+ annotated examples to measure precision and recall before production release.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Product Mention Detection and Resolution prompt. Validate these before sending to prevent silent extraction failures, SKU hallucination, and downstream catalog mismatches.

PlaceholderPurposeExampleValidation Notes

[INPUT_TEXT]

Unstructured text containing product references to detect and resolve

The new MacBook Air M3 is 20% faster than the XPS 13 Plus.

Must be non-empty string. Check for encoding issues with special characters (®, ™, °). Truncate if exceeding model context window minus prompt overhead.

[PRODUCT_CATALOG]

Canonical product records for resolution: SKU, full name, aliases, generation, variant attributes

JSON array with fields: sku, canonical_name, aliases[], generation, variant, category

Validate JSON schema before prompt assembly. Must contain at least one product record. Check for duplicate SKUs and conflicting aliases across records.

[OUTPUT_SCHEMA]

Expected JSON structure for each detected product mention

{"mention_text": string, "canonical_sku": string|null, "confidence": 0.0-1.0, "resolution_method": "exact_match"|"alias_match"|"context_disambiguation"|"unresolved", "span_start": int, "span_end": int}

Validate schema is valid JSON Schema or example structure. Ensure downstream ingestion can handle null canonical_sku for unresolved mentions. Check that confidence field is float, not string.

[CONFIDENCE_THRESHOLD]

Minimum confidence score for automated resolution without human review

0.85

Must be float between 0.0 and 1.0. Mentions below this threshold should route to human review queue. Set to null if all mentions require human review.

[CONTEXT_WINDOW_SIZE]

Number of surrounding characters to include for disambiguation context

500

Must be positive integer. Too small causes resolution failures for ambiguous mentions. Too large wastes tokens. Test with ambiguous product names that require distant context (e.g., 'Apple' fruit vs. company).

[MAX_MENTIONS]

Upper limit on product mentions to extract per document

50

Must be positive integer. Prevents runaway extraction on product-heavy pages. Set based on expected document length and downstream processing capacity. Return error if exceeded rather than silent truncation.

[UNRESOLVED_POLICY]

Instruction for handling mentions that cannot be resolved to any catalog entry

"flag_for_review"

Must be one of: 'flag_for_review', 'return_null_sku', 'skip_mention', 'guess_nearest'. 'guess_nearest' is high-risk and should require explicit approval. Document choice in audit log.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Product Mention Detection and Resolution prompt into a production application or data pipeline with validation, retries, and catalog integration.

This prompt is designed to be called from an application layer that manages the catalog context, not as a standalone chat interface. The application is responsible for assembling the [CATALOG_CONTEXT] variable—typically a pre-retrieved set of candidate SKUs, product names, model numbers, and aliases from your product master database. Do not send the entire catalog; instead, use a retrieval step (keyword search, vector search, or hybrid) to fetch the top-N candidates based on the input text before populating the prompt. This retrieval step is the single most important factor in resolution accuracy, as the model can only resolve mentions to products it can see in the context window.

The implementation should follow a structured pipeline: (1) Accept raw text input from the source system (chat transcript, review, support ticket, social post). (2) Run a lightweight pre-filter to detect whether the text contains any product-like language at all—this avoids wasting LLM calls on irrelevant content. (3) Retrieve candidate catalog entries using a search over product names, aliases, model numbers, and SKUs. (4) Assemble the prompt with the input text, retrieved candidates, and output schema. (5) Call the model with response_format set to json_schema (OpenAI) or equivalent structured output mode (Claude tool use with a strict schema, Gemini controlled generation). (6) Validate the output JSON against the expected schema before ingestion. (7) Route low-confidence results (below your defined threshold, typically confidence < 0.7) to a human review queue with the original text and retrieved candidates pre-loaded.

For retry logic, implement a single retry on schema validation failure with the validation error message appended to the prompt as additional [CONSTRAINTS]. If the second attempt also fails validation, log the failure and route to human review—do not loop indefinitely. For model choice, a capable mid-tier model (GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro) is sufficient for most product mention tasks; reserve larger models for cases with high ambiguity or when the catalog contains thousands of near-duplicate variants. If your product catalog changes frequently, implement a cache-busting mechanism on the retrieval step to ensure the prompt always receives fresh catalog data. Log every resolution with the input text, resolved SKU, confidence score, and model version for audit and eval dataset construction.

The output schema should include a resolved_sku field (null if no match), a confidence float between 0 and 1, a candidate_matches array with ranked alternatives, and a mention_spans array citing the exact text positions where products were detected. Downstream systems should treat confidence < 0.5 as 'no reliable match' and null resolved_sku as 'product mentioned but not in catalog.' Build an eval harness that tests against a golden set of 50–100 examples covering exact SKU mentions, nicknames, generational variants ('iPhone 14' vs 'iPhone 14 Pro Max'), misspellings, and texts with no product mentions. Run this eval on every prompt or model change before deployment. For high-stakes use cases like automated inventory linking or pricing, always require human approval on resolutions below your confidence threshold and maintain an audit trail linking each resolution to its source text and catalog state at time of processing.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the strict JSON schema for the Product Mention Detection and Resolution response. Each field must be validated before the payload enters a downstream catalog or analytics pipeline.

Field or ElementType or FormatRequiredValidation Rule

product_mentions

Array of objects

Must be a JSON array. If no products are detected, return an empty array [], not null or a missing key.

product_mentions[].mention_text

String

The exact verbatim substring from [INPUT_TEXT]. Must pass a substring existence check against the source.

product_mentions[].canonical_sku

String or null

If resolved, must match the [SKU_PATTERN] regex. If unresolved, must be null. No placeholder strings like 'N/A' allowed.

product_mentions[].canonical_name

String or null

If resolved, must be a non-empty string from the [PRODUCT_CATALOG]. If unresolved, must be null.

product_mentions[].confidence

Number

Float between 0.0 and 1.0. Values below [CONFIDENCE_THRESHOLD] must trigger a human review flag in the application layer.

product_mentions[].resolution_type

Enum string

Must be one of: 'exact_match', 'model_number_match', 'nickname_resolution', 'generational_variant', 'unresolved'. No other values permitted.

product_mentions[].source_offset

Object

If present, must contain start (integer) and end (integer) keys representing the character offset of mention_text in [INPUT_TEXT]. Validate bounds.

product_mentions[].disambiguation_note

String or null

If multiple catalog entries match, provide a brief rationale for the chosen SKU. If null, no ambiguity was detected.

PRACTICAL GUARDRAILS

Common Failure Modes

Product mention detection breaks in predictable ways when moving from a demo to production. These are the most common failure modes and the guardrails that prevent them.

01

Informal Nicknames Map to Wrong SKUs

What to watch: Users refer to products by community nicknames ('Coke' for Coca-Cola, 'Ultra' for a specific Samsung model). The model resolves the nickname to a plausible but incorrect canonical SKU because it lacks a nickname-to-SKU mapping table. Guardrail: Provide a nickname alias dictionary as part of the prompt context. When no alias match exists, force the model to output canonical_name: null and resolution_confidence: low rather than guessing.

02

Generational Variants Collapse into Base Model

What to watch: 'iPhone 15 Pro Max 256GB' gets resolved to the base 'iPhone 15' SKU. The model strips modifiers (storage, color, generation) and loses the variant specificity needed for inventory or pricing lookups. Guardrail: Require the output schema to include a variant_attributes object that preserves storage, color, region, and generation as separate fields. Validate that variant attributes are populated when present in the mention text.

03

Model Numbers Parsed as Quantities or Dates

What to watch: A model number like 'XPS 15 9530' gets misinterpreted—'15' becomes a quantity, '9530' becomes a zip code or year. The extraction confuses product identifiers with numeric entities. Guardrail: Add a pre-extraction hint listing known model-number patterns for the target catalog. Use few-shot examples showing model numbers in context with correct boundaries. Post-process with a regex validator that flags extracted SKUs not matching known catalog patterns.

04

Ambiguous Mentions Resolve Without Confidence Signal

What to watch: A mention of 'the standard model' or 'the pro version' in a comparison article gets confidently resolved to a specific SKU based on weak contextual cues. The downstream system trusts the resolution and surfaces incorrect pricing. Guardrail: Require a resolution_confidence field (0.0–1.0) in the output schema. Set a product-level threshold below which resolutions route to a human review queue. Include an ambiguity_note field explaining why confidence is low.

05

Multi-Product Sentences Produce Single Extraction

What to watch: 'The Pixel 8 outperforms the Galaxy S24 in battery life' yields only one product extraction. The model anchors on the first product and ignores the comparison target. Guardrail: Instruct the model to extract all product mentions in a single pass and return them as an array. Add a post-extraction count check: if the sentence contains comparison language ('vs', 'versus', 'compared to', 'outperforms') but only one product is extracted, flag for re-extraction.

06

Discontinued or Regional-Only SKUs Returned as Active

What to watch: A mention of a discontinued product or a region-locked variant gets resolved to a canonical SKU marked as active in the catalog. Downstream pricing or availability checks return incorrect results. Guardrail: Include product status metadata (active, discontinued, region-locked) in the resolution context. Require the output to include a product_status field. When status is discontinued or unknown, suppress automated pricing or availability claims and route to manual review.

IMPLEMENTATION TABLE

Evaluation Rubric

How to test output quality before shipping. Run these checks on a golden dataset of at least 50 annotated examples. Each row targets a specific failure mode for product mention detection and resolution.

CriterionPass StandardFailure SignalTest Method

Product Mention Recall

= 95% of annotated product mentions are detected with a matching [canonical_sku] or [resolved_name]

False negatives: product mentioned in text but missing from output array

Exact string match on mention spans against golden annotations; count missed spans

Canonical SKU Precision

= 98% of resolved SKUs match the golden canonical SKU for that mention

Wrong SKU assigned: [canonical_sku] differs from annotated ground truth

Join output on [mention_text] to golden dataset; compare [canonical_sku] field equality

Model Number Variant Handling

= 90% of mentions with generation or regional variants resolve to the correct base SKU

Variant resolved to wrong base product or left as unresolved [canonical_sku]: null

Filter golden set to variant mentions; check [canonical_sku] matches annotated base product

Informal Nickname Resolution

= 85% of informal product nicknames map to correct canonical entry

Nickname left unresolved or mapped to wrong product; [confidence] < 0.7 on nickname rows

Isolate nickname-annotated examples; verify [resolved_name] and [canonical_sku] match golden

Null vs. Missing Handling

100% of documents with zero product mentions return empty array; no hallucinated products

Non-empty output for product-free documents or [canonical_sku]: null when product is clearly present

Run prompt on 20+ product-free documents; assert output array length is 0

Confidence Score Calibration

= 90% of high-confidence predictions (>= 0.85) are correct; low-confidence (< 0.7) flags ambiguous cases

High confidence on incorrect resolutions; low confidence on unambiguous mentions

Bucket predictions by [confidence] threshold; compute precision per bucket against golden labels

Boundary Precision

= 95% of extracted [mention_text] spans match annotated mention boundaries exactly

Partial extraction: 'iPhone' instead of 'iPhone 15 Pro Max'; over-extraction capturing non-product tokens

Character-offset comparison between extracted [mention_text] and golden mention span

Ambiguous Mention Abstention

= 80% of genuinely ambiguous mentions (annotated as unresolvable) have [canonical_sku]: null and [confidence] < 0.7

Forced resolution on ambiguous mentions; high confidence on unresolvable cases

Isolate ambiguous-annotated examples; check [canonical_sku] is null and [confidence] below threshold

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and lighter validation. Focus on getting the extraction shape right before adding guardrails. Remove confidence scoring and source attribution requirements initially. Accept a simple JSON array of [product_mention, canonical_sku, match_type] triples.

Prompt snippet

code
Extract product mentions from [INPUT_TEXT]. For each mention, return:
- mention_text: the exact text span
- canonical_name: your best guess at the official product name
- sku: [CATALOG_SKU] if you can match it, otherwise null

Watch for

  • Model hallucinating SKUs for products not in your catalog
  • Generational variants ("iPhone 15" vs "iPhone 15 Pro") collapsed incorrectly
  • Informal nicknames ("Coke" for "Coca-Cola") mapped to wrong canonical entries
  • Missing schema checks causing downstream ingestion failures
Prasad Kumkar

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.