Data & machine learning · 5 min read · Answerwell
Recommender systems for mid-size e-commerce
What a mid-size online shop needs to run its own recommender system: interaction data, model choices, compute estimates and how to prove it adds revenue.
Key takeaways
- At mid-size scale, compute is rarely the constraint. A full training pass for a shop with a million users fits in minutes on one GPU. Data quality, freshness and evaluation are the real work.
- You need clean interaction events (views, add-to-basket, purchases) tied to stable item and visitor IDs, plus a product catalog with useful attributes.
- Start with strong baselines: popularity by segment, item-to-item co-occurrence and matrix factorization. Move to two-stage retrieve-and-rank models when the baselines plateau.
- Prove value with an A/B test against a holdout group, measured in revenue per session, not just clicks on recommendations.
What “mid-size” means here
This article assumes an online shop or marketplace with roughly hundreds of thousands to a few million identifiable visitors a year and thousands to a few hundred thousand active items. That is large enough for personalization to beat a static “bestsellers” block, and small enough that the architecture of the largest consumer platforms would be overkill.
The data you need
A recommender learns from behavior. Before choosing a model, check that these inputs exist and can be trusted.
Interaction events
Each event needs at least a visitor ID, an item ID, an event type and a timestamp:
- Product views, including from search and category pages
- Add-to-basket and removal events
- Purchases, with item IDs and quantities
- Context such as device, landing source and position of the item on the page, so you can correct for what visitors were shown
Most shops have far more views than purchases, so models usually learn from implicit feedback: a view or a purchase is treated as a signal of interest, weighted by strength. Hu, Koren and Volinsky’s 2008 paper on collaborative filtering for implicit feedback datasets remains the standard reference for this approach.
Catalog data
Titles, categories, brands, attributes, availability and images. Catalog features let the system recommend new items that have no interaction history yet, which is the cold start problem.
Quality checks
Before training, look for duplicated events, bot traffic, items that changed IDs, and gaps after a site migration or a tag manager change. A model trained on broken events learns the breakage.
Consent
Personalization relies on behavioral data, so it must follow the consent your visitors gave. Use pseudonymous IDs, respect opt-outs and set retention periods. If you operate an online platform within the scope of the EU Digital Services Act, Article 27 also requires explaining the main parameters of your recommender systems.
Model choices, from simple to advanced
1. Baselines
- Popularity by segment: top items per category, market or season.
- Item-to-item co-occurrence: “viewed together” and “bought together” counts, normalized so popular items do not dominate.
- Matrix factorization (for example alternating least squares on implicit feedback): learns a vector per visitor and per item from the interaction matrix.
These are fast to build, easy to explain and often hard to beat on small catalogs. Every later model should be compared against them.
2. Two-stage retrieve and rank
Large platforms split recommendation into two steps, a design described in Covington, Adams and Sargin’s 2016 paper on YouTube recommendations:
- Retrieval narrows the full catalog to a few hundred candidates, typically with a two-tower model that embeds visitors and items in the same vector space and finds nearest neighbors with a library such as FAISS.
- Ranking scores those candidates with richer features: value band, availability, recency, margin and the visitor’s recent behavior. Gradient-boosted trees (CatBoost, LightGBM, XGBoost) are a strong, interpretable choice at this scale.
3. Sequence-aware models
When the sequence of recent views matters, as in fashion or electronics browsing sessions, sequence models such as SASRec (Kang and McAuley, 2018) or attention-based ranking models like Alibaba’s Deep Interest Network weight past interactions by their relevance to each candidate. They help most on sites with long sessions and many anonymous visitors.
What it costs in compute
The arithmetic is simple enough to do on a whiteboard. These are planning estimates, not benchmarks:
- Embedding parameters = (visitors + items) × embedding dimension. A shop with 1 million visitors and 200,000 items at dimension 64 has 1.2M × 64 ≈ 77 million parameters.
- Memory = parameters × 4 bytes in 32-bit floats, so about 0.3 GB, and roughly three times that during training with the Adam optimizer.
- Training compute ≈ 6 × dense parameters × training examples. With 2 million examples a day over 30 days (60 million examples) and a 1-million-parameter ranking network, one pass is 6 × 10⁶ × 6 × 10⁷ ≈ 3.6 × 10¹⁴ floating-point operations. At an effective 10 teraFLOP/s on one GPU, that is under a minute.
- Serving a nearest-neighbor index of 200,000 item vectors at dimension 64 takes about 51 MB of memory, which fits on an ordinary application server.
Real projects add data pipelines, repeated training runs for tuning, evaluation and serving infrastructure, so budget for those rather than for raw GPU time. The technology page shows the same method applied to marketplace and large-platform scales, where sharded hardware does become necessary.
Freshness and cold start
- Retrain on a schedule that matches how fast your assortment and demand change: daily for fast-moving catalogs, weekly for stable ones.
- Update features in near real time for signals such as availability and the visitor’s current session, even if model weights update less often.
- Handle new items with catalog-based similarity and a small exploration budget, so they can collect interactions.
- Handle new visitors with session-based and popularity-by-context recommendations until they have history.
How to prove it works
Offline evaluation
Split data by time, training on earlier weeks and testing on the following week, so the model never sees the future. Report recall@k and NDCG@k against the baselines, by segment and by device. Offline gains are a filter, not proof.
Online A/B test
Run the new recommender against the current one, or against a holdout with no personalization, on randomly assigned visitors:
- Primary metric: revenue per session or per visitor, because clicks on recommendations can rise while overall revenue stays flat.
- Guardrails: conversion rate, average purchase value, return rate and page speed.
- Duration: long enough to cover full weekly cycles and reach the sample size you calculated before starting.
Watch for cannibalization: a block that redirects visitors to items they would have bought anyway shows high engagement but little incremental revenue.
Build or buy
Hosted recommendation widgets are quick to install and fine for a first test. Building your own pays off when you need control over ranking rules and margins, want to use your own features, must keep data in a specific region, or want recommendations to reuse the same embeddings as on-site search. Either way, the event data and the evaluation method are yours to get right.
Put it into practice
Recommendation Engine builds and tunes two-stage recommenders on your own interaction data and tests them against a holdout. Product & End-to-End Analytics fixes the event tracking that a recommender depends on, and the technology page explains the data, models and compute behind our tools.
Put this into practice
All Data & machine learning services →Have a question about your own site? Request a proposal →
More insights (6)
How to connect SEO and GEO work to revenue
Build a measurement chain from search and AI visibility to leads and revenue: event dictionaries, attribution limits, controlled tests and predictive models.
IndexNow, sitemaps and Google Indexing API
IndexNow, XML sitemaps and the Google Indexing API solve different problems. Which engines support each, their limits, and one setup that covers all three.
How to control AI crawlers with robots.txt
Which AI crawler tokens to allow or block in robots.txt, how training, search and user-triggered bots differ, and how to confirm the rules in your logs.
Schema markup and entities: a practical guide
How to plan schema markup around entities: choosing Organization, Service and Product types, linking them with @id and sameAs, and validating the result.
How to measure AI search visibility
A practical method for measuring AI search visibility: prompt sets, repeated sampling, mention, citation and accuracy scores, and AI referrals to revenue.
What is generative engine optimization?
A practical definition of generative engine optimization (GEO): how AI answers choose sources, how GEO relates to SEO, and the work that earns citations.
