Preparing retail product data for SLM fine tuning: A practical guide

Learn the exact steps for preparing retail product data for SLM fine tuning to improve catalog accuracy, search relevance, and automated tagging for SMBs.

Preparing retail product data for SLM fine tuning requires a systematic approach to auditing your current catalog, cleaning noise from unstructured descriptions, and formatting the results into instruction-response pairs. By focusing on data quality rather than quantity, retail brands can train custom slm models that outperform general-purpose LLMs on specialized tasks like SKU categorization and attribute extraction. This process transforms your raw ERP or PIM exports into a high-signal dataset that a small language model (SLM) can ingest to learn your brand's specific terminology and logic.

Why fine-tune an SLM for retail data

For many small and mid-sized retailers, large models like GPT-4 are often overkill for repetitive back-office tasks. Fine-tuning a smaller model, such as Mistral 7B or Phi-3, allows for faster inference times and significantly lower operational costs. However, an SLM is highly sensitive to the quality of the training data. If your product descriptions are riddled with HTML tags, inconsistent units of measurement, or conflicting category labels, the model will learn these errors as features.

Fine-tuning is particularly effective when you need a model to understand niche product attributes that general models might miss. For example, a specialized hardware retailer might have highly technical specifications that a standard model confuses. By preparing retail product data for SLM fine tuning correctly, you enable the model to act as a digital expert on your specific inventory.

Step 1: Auditing your data sources

Before you begin cleaning, you must identify where your "source of truth" resides. For most retailers, this is a mix of an ERP (Enterprise Resource Planning) system, a PIM (Product Information Management) tool, or a platform like Shopify or BigCommerce.

The Data Audit Checklist

  1. Consistency check: Do all products in a specific category have the same set of attributes? (e.g., Do all shoes have a 'size' and 'material' field?)
  2. Volume check: Do you have at least 500 to 1,000 high-quality examples for the specific task you want the model to perform? (e.g., 1,000 examples of converting a messy manufacturer description into a clean marketing blurb.)
  3. Label accuracy: Are your current categories correct? If 10% of your 'Outdoor' gear is accidentally labeled as 'Indoor,' the model will struggle to find the pattern.
  4. Uniqueness: Remove duplicate SKUs that offer no new information. A model learns best from variety within a structured framework.

Step 2: Cleaning and normalizing product attributes

Raw retail data is notoriously messy. It often contains legacy formatting from old web systems or shorthand used by warehouse staff that makes no sense to an AI. You must normalize this data before it touches a training pipeline.

Removing noise

Product descriptions often contain "noise" that dilutes the signal. This includes:

  • HTML Tags: <p>, <ul>, and &nbsp; should be stripped.
  • Promotional Fluff: Phrases like "Free shipping" or "Best seller" that aren't intrinsic to the product itself.
  • Boilerplate: Standard return policies or warranty text that appears on every single page.

Standardizing units of measure

A common failure point in retail AI is inconsistent units. If one supplier provides weight in pounds (lbs) and another in ounces (oz), the model will struggle to perform comparisons or logic-based tasks. Choose a standard and convert all records during the preparation phase.

AttributeRaw Data ExampleNormalized Data (Target)
Material100% Cotton, Pre-shrunkCotton
Weight1.2 lbs / 19oz1.2 lbs
ColorMidnight / Dark BlueNavy
Dimensions10x12x5 in.10" x 12" x 5"

For more on how this process works at scale, see our guide on Training SLM Models for Automated Catalog Data Normalization.

Step 3: Structuring data into JSONL instruction pairs

SLMs do not learn from spreadsheets; they learn from sequences of text. To fine-tune a model, you must convert your tabular data into a series of "Instruction" and "Output" pairs. This format is typically saved as a JSONL (JSON Lines) file.

The Instruction-Response Format

You want to simulate the exact task the model will perform in production. If the goal is to generate SEO titles from technical specs, your data structure should look like this:

{"instruction": "Generate a SEO-optimized product title for a retail listing based on the following attributes.", "input": "Brand: Zeon, Category: Running Shoes, Material: Mesh, Color: Neon Green", "output": "Zeon Neon Green Mesh Running Shoes - Breathable Performance Footwear"}

Worked Example: Attribute Extraction

Suppose you want a model that takes a messy manufacturer paragraph and extracts a clean JSON object of specs. Your training data would look like this:

  • Instruction: Extract the material, color, and country of origin from the text.
  • Input: "This rugged 100% leather boot in earthy brown is handcrafted in Italy for maximum durability."
  • Output: {"material": "leather", "color": "brown", "origin": "Italy"}

By providing 500+ examples of this specific transformation, the SLM becomes highly efficient at this single task, often surpassing the accuracy of much larger models.

Step 4: Handling missing or sparse data

In retail, it is rare to have a 100% complete catalog. Some SKUs will be missing dimensions; others will be missing material data. You have two choices during preparation:

  1. Filter out incomplete records: Only use the "gold standard" rows for your training set.
  2. Train for the gap: Include some examples where the model is taught to say "Information not available." This prevents the model from hallucinating or guessing when it encounters missing data in the future.

We generally recommend a 90/10 split: 90% complete records to teach the pattern, and 10% sparse records to teach the model's limitations.

Step 5: Validation and the "Holdout" set

Never use your entire dataset for training. You must reserve a portion (typically 10-20%) as a "validation set." This data is never seen by the model during the fine-tuning process. After training, you run the validation set through the model to see if it can handle data it hasn't encountered before. If the model performs perfectly on the training data but fails on the validation data, you have "overfitted" the model—it has memorized your catalog rather than learning the logic behind it.

Common mistakes in retail data preparation

  • Including price data: Prices change weekly. Unless you are building a very specific price-prediction model, including price in your fine-tuning data usually just confuses the model and makes the training data obsolete quickly.
  • Ignoring the 'long tail': If 80% of your training data is for 'T-shirts' and only 1% is for 'Outerwear,' the model will be biased toward T-shirt logic. Ensure your training set represents the diversity of your inventory.
  • Poor encoding: Ensure your text is UTF-8 encoded. Retail data often contains special characters (like the degree symbol for temperatures or accented characters in brand names) that can break training scripts if not handled correctly.

When preparing data for SLM fine tuning is NOT worth it

Fine-tuning is a powerful tool, but it is not always the right move. It may not be worth the effort if:

  • Your catalog is under 200 items: At this scale, simple prompt engineering or a few-shot approach with a standard model will likely yield better results for less effort.
  • Your data changes daily: If your product attributes are in constant flux and don't follow a repeatable logic, the model will be out of date before the training run completes.
  • You can solve it with RegEx: If your data cleaning can be solved with simple search-and-replace rules or regular expressions, do not use an AI model. Use the simplest tool for the job.

For businesses looking to move away from expensive API-based models, migrating business workflows from GPT-4 to private SLM provides a roadmap for when and how to make that transition.

Summary of the workflow

To prepare your retail data this week, follow these steps:

  1. Export 1,000 diverse product rows from your PIM/ERP into a CSV.
  2. Clean the CSV by removing HTML, fixing units, and deleting promotional text.
  3. Map the fields into a JSONL format with clear 'instruction', 'input', and 'output' keys.
  4. Review a random sample of 50 rows to ensure the 'output' is exactly how you want the model to behave.
  5. Split the file into train.jsonl (800 rows) and valid.jsonl (200 rows).

By following this structured approach, you ensure that your investment in AI results in a model that actually understands your business, reduces manual labor, and improves the customer experience through better data accuracy.

Frequently asked questions

How many product examples do I need to fine-tune an SLM?

While it varies by task complexity, a good starting point for retail applications is 500 to 1,000 high-quality, manually verified examples. Quality is more important than quantity; 500 perfectly cleaned and labeled records will produce better results than 5,000 messy records that contain conflicting information or formatting errors.

What is the best format for retail training data?

JSONL (JSON Lines) is the industry standard. Each line in the file should be a standalone JSON object containing an instruction, an optional input (like raw product text), and the desired output. This format allows training scripts to stream data efficiently without loading a massive single file into memory.

Can I use an SLM to fix my existing messy product catalog?

Yes, this is one of the most common uses for SLMs in retail. By fine-tuning a model on a 'gold standard' subset of your data where attributes are correctly mapped, you can then run the model against the rest of your messy catalog to automate normalization, attribute extraction, and category assignment at scale.

Should I include product images in the fine-tuning process?

Standard SLM fine-tuning focuses on text. If you need the model to understand images, you would need a Vision-Language Model (VLM). For most retail operations tasks like SEO, categorization, and technical spec management, text-based SLMs are more cost-effective and easier to deploy than multi-modal models.

Sources
  1. Microsoft Phi-3 Cookbooks
  2. Mistral AI Fine-tuning Documentation
  3. Hugging Face Data Preparation Guide

Next /Done for you

Want this done for your business?

Small language models tuned to your catalog and knowledge. Talk to the ZEON team about Custom SLM Models.

Explore Custom SLM Models

ZEON /Built around your ambition

Let’s connect
the dots.

Tell us which job you want off your desk first. A ZEON engineer will reply, and the first conversation is free.

Request a consultation