KatInterview

NER for E-Commerce Text: Design, Models, and Evaluation

Machine LearningModel answer
MediumModel answerMachine LearningNERsequence labelingtransformers

Last updated

Design a named entity recognition system for short e-commerce text, covering task framing, model families, data pipeline, and the right metrics.

You are designing a named entity recognition (NER) system for an e-commerce platform. The input is short, often noisy text — product listing titles like "Nike Air Max 90 Men's Running Shoe Size 10 White/Black" and search queries like "red adidas hoodie medium". The entities you care about are product attributes: brand, product type, color, size, and model name.

Answer the three parts below in order. Before diving in, briefly state any clarifying questions you would ask in a real design session.


Part 1 — Frame the task

Define NER as an ML problem for this setting. Cover:

  • What goes in, what comes out, and how the output is represented as labels on tokens
  • Which tagging scheme you would use and how spans are recovered from tags
  • At least three reasons this setting is harder than standard NER benchmarks

Part 2 — Pick a modeling approach

Walk through the main families of NER methods. For each, give its strengths, weaknesses, and when it fits. Then commit to a specific choice for this use case and explain your reasoning. Include a fallback.

The families to address:

  • Rule-based and dictionary lookup
  • Feature-engineered sequence models (e.g., CRF)
  • Neural sequence taggers (e.g., BiLSTM-CRF)
  • Fine-tuned transformer encoders (e.g., BERT-family)
  • Generative LLM extraction (e.g., prompted GPT-style models)

Part 3 — Data and metrics

Explain how you would build a training set and measure success. Cover:

  • How to get labeled data, keep it consistent, and reduce its cost
  • The preprocessing steps specific to this setting (subword alignment, normalization, class imbalance, train/test splits)
  • Which metrics you report at the entity span level and which downstream metrics tell you whether the system is actually useful

Hints

Hint 1

For Part 1, think carefully about what happens at token boundaries when the same surface form can belong to different entity types depending on context — 'Black' is a color in one listing and part of a model name in another.

Hint 2

For Part 2, latency matters differently depending on whether NER runs at indexing time over a fixed catalog or in the live query path. That constraint can rule out entire model families before you weigh accuracy.

Hint 3

For Part 3, exact-match F1 can look poor even when the system is practically useful — a span that gets the right entity type but wrong boundary still helps downstream filtering. Think about whether you need strict or relaxed matching, and why micro vs. macro F1 tells different stories on a skewed label distribution.