Melt Digital
Back to Blog
AI contentAI

How to generate high quality & factually correct AI generated ecommerce content

Producing AI generated content using an LLM out-of-the-box is likely to yield poor results - here's how to generate factually correct content using AI.

Charlie Jackson
Charlie Jackson
July 3, 20265 minutes
Share:
How to generate high quality & factually correct AI generated ecommerce content

We regularly produce AI generated content for our ecommerce clients - whether that’s FAQs for products, high level summaries on PLPs, or technical specifications. To ensure it is factually correct, we use strict guidelines.

Before we get into the details, it's worth noting AI content generation is highly context-dependent; in depth write ups, thought leadership pieces, very detailed technical specifications, heavy research requirements, etc - you’ll want a human copywriter.

The workflow at a glance:

  1. Prompt engineering & template - make prompts restrictive and instruct within the prompt to only use the product information provided to it.
  2. Large language model selection - find the right balance in the LLM selected between speed, price & quality. This is done by testing multiple models.
  3. Inject product information & data into prompts - that includes existing content, product data, technical specifications and imagery from existing systems (CMS, internal documentation & specifications, product inventory management systems, etc)
  4. AI output validation - use an LLM to validate the output against the inputs as a fact checker.
  5. Human Q&A - review a sample of outputs. If you're producing content at scale, you want to manually review between 5-10% of the final output.

With each aualitu check alona the wau. uou test. refine and update as required. until uou aet to an output that is ready to go to full production.

The guidelines

The following guidelines and examples are largely tailored to programming to generate AI content. With that said, the same principles apply for non programmers and you could use an AI chat application like Claude, or ChatGPT with the same fundamental principles.

Prompt engineering and prompt template

When you're using an LLM to produce AI generated content, the first thing to do is produce your prompt.

Always create a list of rules to immediately address factual accuracies - for example, if we are generating some content for a PDP (product description page), start with some rules like so:

Rules:

  • Do not invent any specifications.
  • Do not infer features.
  • If a feature is not provided, do not mention it.
  • Preserve every measurement exactly.
  • Etc

You typically want the more important information higher in the prompt instructions - a typical prompt would look like so (with the 'factual' rules within the 4th header after the role, objective and instructions):

# ROLE
<role>

# OBJECTIVE
<objective>

# INSTRUCTIONS
<instructions>

# FACTUAL RULES (Highest Priority)
<hallucination rules>

# Other RULES e.g. format, keyword usage, etc
<other rules>

# TONE OF VOICE
<tone of voice>

# OUTPUT FORMAT
Return JSON:

<output>

# EXAMPLE

## Input
{{inputs}}

## Output
{{example_output}}

# PRODUCT DATA
{{product_json}}

Tip: Once you’ve got a first draft of your prompt, feed it through an LLM to see if there are further suggestions for rules to add.

Large language model selection

AI companies are constantly bringing out new models with varying capabilities, and thus, at the point you're reading this, there will likely be a new hot LLM model to choose from*.

The basic premise is to test multiple models; there's a balance between speed, price and quality; test multiple models until you find the balance you're looking for.

Tip: As of the date of writing this article, the consensus is that Claude models produces the best marketing copy.

Inject product information & data into prompts

I'm talking about product details and context needed to produce the content. The same way a human copywriter will do desk research ahead of writing, we need to provide an LLM with context for it to use in production.

Product information will likely come from your existing data sources - it could be stored in your CMS, PIM software, be on your warranty page, terms & conditions and an existing web page on the site.

You’ll need to work out exactly what you need, store it in a suitable format (which is often markdown or JSON), then pass through to an LLM within your prompt.

For example, if I'm writing an FAQ for a PLP (product listing page) about delivery prices, I'll need to pass through the delivery costs to the LLM for context - the prompt might be structured like so:

# Instructions
Answer the following question using the delivery price information provided

# Question
How much does it cost to have a bed delivered? Can I have named day delivery?

# Delivery price information

Product             | Standard Delivery | Named Day Delivery
----------------------------------------------------------
Bed (Double)        | £49               | £89
Sofa (3-Seater)     | £39               | £79
Mattress            | £29               | £59
Wardrobe            | £59               | £109
Dining Table        | £35               | £75

AI output validation

Once you’ve got your output, you want to feed this into another LLM to fact check the output against the data input.

For example, a prompt would look like so:

# ROLE

You are a factual accuracy validator for ecommerce product content.

# OBJECTIVE

Compare the generated product content against the supplied product data.

Your job is NOT to improve the writing.
Your ONLY job is to determine whether every factual statement is supported by the supplied data.

# VALIDATION RULES

- Treat the product data as the single source of truth.
- Do not use external knowledge.
- Do not make assumptions.
- Do not infer missing information.
- A claim is factual only if it is explicitly supported by the product data.
- Marketing language (e.g. "beautiful", "stylish", "premium") should be ignored unless it contains a factual claim.
- Measurements, colours, materials, warranties, delivery information and specifications must match exactly.
- If information is missing from the product data, mark the claim as "Unsupported".
- If a claim contradicts the product data, mark it as "Incorrect".

# OUTPUT

Return JSON only.

{
  "overall_result": "PASS | FAIL",
  "accuracy_score": 0-100,
  "summary": {
    "supported_claims": 0,
    "unsupported_claims": 0,
    "incorrect_claims": 0
  },
  "claims": [
    {
      "claim": "",
      "status": "Supported | Unsupported | Incorrect",
      "source_field": "",
      "reason": "",
      "correction": ""
    }
  ]
}

# PRODUCT DATA

{{product_json}}

# GENERATED CONTENT

{{generated_content}}

If the output suggests an inaccuracy, it should be reviewed and the workflow should be considered again (looking back at that prompt, LLM selection and product data injected).

Human Q&A

If your AI generated content passes validation, it's on for a final check; to do this, produce a reasonable sample - you want to check between 5-10% of the final production output to ensure its up to standards. Then we hand over to our clients do final, full review of the copy before it's published.

If the output isn’t up to scratch, it's back to revisiting the workflow and ironing out where further optimisations can be had. If it passes, then it's on to publication.

Charlie Jackson
Charlie Jackson
Technical SEO Lead

Related Articles

Ready to Boost Your Organic Traffic?

Let's discuss how Melt Digital can help transform your SEO strategy.

Get in Touch