Problem
Square needs to know what type of business each seller runs. Product wording, segment-level metrics, marketing, beta eligibility and card-issuer merchant category codes (MCCs, which affect interchange fees) all depend on it. Sellers pick a category from a list during onboarding. They hurry, face granular options such as "Nail Salon" and "Hair Salon", and see no category definitions, so many choose wrongly. Earlier ML attempts used older methods, took the self-selected category as the label and ignored post-onboarding data.
Example from the article: a seller named "Jay's Real Estate" who picked "Hair Salon" at onboarding receives auto-created services "Shampoo, Conditioner, Haircut", so the wrong category even looks confirmed by the catalog.
Solution in brief
Fine-tune roberta-large as a text classifier on a random sample of over 20,000 manually reviewed sellers. The input is one string with the business name, catalog items ranked by purchase frequency (auto-created items the seller never edited are removed) and the onboarding category. Predictions refresh daily through multi-GPU PySpark inference, and only sellers whose inputs changed are rescored.
Questions this case answers
- How to assign a business category to each customer account when the self-reported category is unreliable and free-text catalog data is available
- How to refresh predictions of a transformer classifier daily for tens of millions of records when only a small share of inputs changes
- How to classify sellers by business type when the category they picked at onboarding is often wrong?
- How to turn a huge item catalog into a bounded text input for a transformer classifier?
Tools and methods
- RoBERTa (roberta-large) — pretrained transformer fine-tuned for sequence classification
- Hugging Face Transformers — tokenizer,
AutoModelForSequenceClassification,Trainer, inference pipeline - Databricks — GPU clusters for training and daily inference
- Apache Spark (PySpark) — distributes inference across GPU workers
- scikit-learn —
LabelEncoderfor category ids - Manual review — human labels for training and the test set
Google or a one-time email code. No password.