Journals / Case study

How Wayfair spots business buyers on a consumer storefront

In January 2023 two Wayfair data scientists described Hamlet, a model that asks of every order whether a business placed it. The hard part was not the model but the labels, because most business shoppers never say they are one. Wayfair says the model is twice as effective as the rules before it, with no numbers behind that. We found nothing later on Hamlet itself.

25 NOV 202617 min readCustomer classification · B2B sales · Real-time ML · Labelling Based on: Wayfair, 2023
Our diagram titled Find the business behind a consumer order, in three bands. Labels in three tiers: known, where Pro members are positive and shoppers who opted out of Pro marketing are negative; matched, where shipping and billing addresses linked to records of known businesses add positives; synthetic, where an offline neural net scores the rest and only the confident ends become labels. One score when the order is placed: streaming features, the current order and recent searches, minutes to hours old, plus precomputed features, order history and browsing refreshed every 12 hours in a feature store, feed an xgboost model with more than 100 features that gives the probability the order is for a business in under a second. One score, a threshold per channel: a phone call needs high precision because calls are expensive, an on-site message needs high recall because a banner is cheap. A note says that, as reported by Wayfair with no absolute numbers, customers are 3x as likely to enroll if contacted right after the order, and the model is twice as effective as the business rules it replaced.
Diagram: MORARI. Source: Wayfair

Some of the people buying sofas on a consumer website are not furnishing a home. They are fitting out an office, a café or forty hotel rooms. They would buy more, and buy again, if someone offered them trade prices and an account manager. Most of them never say who they are.

Wayfair, the Boston-based online retailer of furniture and homeware, described how it finds them in Hamlet: Wayfair's ML Approach to Identifying Business Shoppers, a post on its tech blog by Sanjana Kacholia and Nick Coleman, dated January 19, 2023. The post opens: "To B2B, or not B2B, that is the question." Its text is unchanged between a 2023 archive copy and the live page in 2026. The page carries an ordinary Wayfair copyright line and no reuse licence, so every diagram here is our own. Every result is Wayfair's own; there is no outside evaluation, code or data.

The problem: business buyers who look like consumers

Wayfair runs a separate site for trade customers: "Wayfair Professional, our site that caters exclusively to business shoppers, continues to grow year after year." Members get, in the post's list, an expanded catalogue, bulk orders, delivery to several addresses and special pricing.

The trouble is who never finds it: "Business customers might be office managers looking to furnish a corporate location, or a hotel chain that wants to furnish rooms in elegant and consistent ways. However, many business customers might not be aware of Wayfair's business-to-business (B2B) offerings." Wayfair gets business leads in three ways: people who say so, people who respond to business marketing, and models that flag shopping as business-like. Of the models it says: "These ML models are an important source of B2B leads for Wayfair."

The post covers one of them, the one that runs at checkout: "This post focuses on Hamlet Order Confirmation (OC), which is triggered after an order placed on the website to estimate the probability that a customer is shopping for a business." What happens with the score is simple: "High scoring customers (high likelihood of being a business) will be contacted by our sales team to confirm their status as a business and to present them with the benefits of enrolling in Wayfair Professional."

The authors name two hard parts. Labels: "Since we do not know if an arbitrary site visitor is shopping for business or not, we took a three-step approach" to build them. And speed, because the score must be ready while the order is still fresh.

The design: three choices that matter

1. Do not call everyone else a consumer

The obvious training set would be Pro members as businesses and everyone else as consumers. The post rejects it: "As many “true” business customers browse and shop our consumer storefront without enrolling in Wayfair Professional, we cannot assume that all shoppers in the B2C experience should be negatively labeled for model training." A model trained that way would learn that the businesses it is meant to find are consumers.

So the labels come in three tiers.

First, the people who have said what they are. Pro members are positive, and the negatives are customers who "self-identified as consumers (for example, by opting out of Wayfair Professional marketing in the past)."

Second, address matching. Wayfair uses "an in-house record linkage algorithm to match customers to known businesses based on shipping and billing addresses. Known business data is acquired through public records or third-party firmographic data providers." A sofa shipped to a registered office address is a fair sign of a business, even if the buyer never said so.

Third, synthetic labels for the rest. The first two steps "provide high quality labels, but at a low volume compared to the overall Wayfair customer universe." So a neural network, trained offline, estimates the chance that each unlabelled customer is a business. Only the confident ends are kept: above a threshold c they become positive, below 1 minus c negative, and the uncertain middle is left out. In the post's words: "c is our confidence threshold for synthetic labeling, which becomes a hyperparameter in the overall model training exercise." The offline network can be slow and heavy, because, as the post notes, it "does not have the SLA constraint of our real-time model". Its labels then train the small, fast model that runs at checkout.

Our diagram titled Do not call everyone else a consumer, in three numbered steps. Step 1: known businesses, existing Wayfair Professional members, are positive; known consumers, shoppers who said so, for example by opting out of Pro marketing, are negative. Step 2: record linkage adds more positives, as an in-house matcher links shipping and billing addresses to known businesses from public records and paid firmographic data. Step 3: synthetic labels for the rest, where an offline neural net free of the real-time limit estimates the probability of being a business for every still-unlabelled customer. A bar shows the split: below 1 minus c negative, an unsure middle that is dropped, above c positive. A note says c is the confidence threshold, tuned like any other setting, and the fast xgboost model then trains on all three tiers.
The three label tiers as the post describes them. The bar widths are ours; the post gives no counts. Diagram: MORARI. Source: Wayfair

This is the idea worth copying, and it costs little: never treat silence as a no.

2. One score at checkout, from two speeds of features

The customers vary widely: "Wayfair Professional serves a diverse array of clients ranging from small businesses such as designers and contractors, to institutional clients such as universities and hotel chains." So the model reads a lot: "In total, Hamlet uses over 100 features pulled from real-time site browsing activity, order data, marketing interactions (e.g., ad clicks or email engagement), public databases, and third-party firmographic data vendors."

It has to do that fast, under "real-time service level agreements (sub-second inference + response time)". The trick is to split features by age. Fresh ones, such as the current order and recent searches, come from Aerospike; the post calls it "an open-source real-time data streaming platform", while Aerospike's own README says: "Aerospike is a distributed, scalable NoSQL database." Older ones, such as lifetime order count and average order value, are computed ahead of time in Google's Vertex feature store: "we precompute feature values every 12 hours and retrieve them in real time when the model is triggered." The authors are clear about what makes the deadline possible: "Precomputing many of our feature values and then retrieving them at inference time is a critical enabler to meeting our sub-second SLA."

The model itself is a gradient-boosted tree model from the xgboost library, chosen from several frameworks because it met the speed limit with more than 100 features. It was tuned for precision and recall rather than accuracy: "We then trained and tuned a model with the objective of maximizing PR AUC: the area under the precision-recall curve." The reason is the imbalance: "B2B customer identification is a highly imbalanced classification task (there are far more B2C customers than B2B customers)". A model that called everyone a consumer would score high on accuracy and find nobody.

3. One score, a threshold per channel

The score is a probability. Turning it into an action depends on what the action costs, which is why Wayfair optimised the whole precision-recall curve: "Different business applications require different minimum precision standards, so maximizing PR-AUC helps us optimize for all of these applications simultaneously."

The post gives two cases. For a call, be sure: "when reaching out to customers via phone calls, we want a high level of precision (most of the people we call are really businesses), because making phone calls is relatively expensive." For a message on the website, be generous: "showing on-site messaging is low cost as long as it doesn’t slow down page load time, so we prefer high recall". One model, several cut-offs. "Based on their model score, customers may receive different types of outreach / treatment in order to encourage them to join Wayfair Professional."

Serving: why it runs at checkout

Wayfair could have scored orders in a nightly batch, which is simpler. It chose not to, and gives the reason: "We decided on a real time architecture for Hamlet OC (as opposed to batch next-day processing) because customers are 3x as likely to enroll in Wayfair Professional if we reach out immediately after an order is placed". The outreach can be a call, an email, or a message on the site if the customer is still there.

The post does not say how that 3x was measured: not the period, the sample, the channel, or whether it was a controlled test or a comparison of customers who happened to be reached at different times. If the second, people still on the site right after ordering may simply be keener buyers. The number is Wayfair's and should be read as a direction, not a size.

How they measured it

There is one result sentence for the model: "When we benchmark Hamlet OC's performance, we find the model is twice as effective as prior methods that relied on simpler business rules."

That is all. "Effective" is not defined; it could mean precision, enrolments per call, leads found, or revenue. There is no baseline rate, no sample size, no time window and no test design. The post shows a precision-recall curve as an illustration, without values we could read off as results.

What the post does not show

  • No numbers. Neither "3x" nor "twice as effective" comes with a metric, a baseline, or a test. Nobody outside Wayfair can check them.
  • No error rates for the labels. The address matcher and the offline network both make mistakes, and the final model partly learns them. The post gives no match accuracy and no value for c.
  • A possible bias in the labels. Positives are Pro members and businesses found in records; negatives include people who opted out of Pro marketing. A small business that once opted out is labelled a consumer, and businesses unlike today's Pro members are under-represented. The post does not discuss this. This is our observation.
  • Nothing on privacy or wrong calls. No word on consent, on how a household called by mistake is handled, or on fairness across customer groups.
  • Only one model. Hamlet is described as a suite; only the checkout model is covered.
  • A recruiting post. It sits on the careers tech blog, written partly to show the team's skill. Expect the good parts.

What has changed since

Nothing further on Hamlet that we could find. We searched Wayfair's tech blog (120 of the posts it lists, not all), both authors' pages and the web, and found no later post, talk, paper or code about Hamlet or about classifying business shoppers. Absence is not proof; we can only say we found none.

Wayfair Professional kept growing. In August 2024 it launched a programme for design professionals, Tastemakers: "Becoming a member is free and includes access to exclusive benefits like everyday Pro Pricing up to 15% off". On the Q2 2025 earnings call on 4 August 2025, the chief executive said Wayfair Professional had grown by double digits "after a few quarters of increasing momentum", with no percentage. In October 2025 it added a project tool, My Projects: "More than 6,700 Wayfair Professional members participated in the pilot across industries including design, construction, property management and hospitality." None of these pages mentions Hamlet, and nothing links the growth to the model.

The company as a whole. Wayfair's fourth-quarter 2025 results, released on 19 February 2026, say total net revenue, leaving out its exit from Germany, "grew 6.1% year over year" for the full year.

The feature store it used is being retired. Google's deprecations page says: "Vertex AI Feature Store (Legacy) is deprecated." It adds that "On February 17, 2027, the service will be fully sunset and APIs will no longer be available." Its successor was "introduced on November 17, 2023", ten months after the Hamlet post, so the store the post describes can only have been the legacy one. That is our inference; whether Wayfair has moved off it is not public.

Free business data got scarcer. The enrichment vendor Clearbit, now part of HubSpot, posted in its changelog that "Clearbit’s free tools will be discontinued on April 30, 2025", pointing users to a paid HubSpot product. Firmographic data, Hamlet's third-party input, is mostly a paid product.

Platforms mostly ask instead of guess. Shopify's B2B help pages offer a company account request form and, for shops with an existing customer base, a way to "add your existing D2C customers and their order history to an existing company." That is matching done by the merchant, not a model. On Amazon Business, tax exemption for an organisation "isn’t automatically set up when you create an Amazon Business account"; the buyer uploads documents. We found no public description of a model like Hamlet at either.

Why it matters for your business

Plenty of Indonesian shops sell to both kinds of buyer without knowing which is which. A building-supply store sells to homeowners and to contractors. A grocery distributor's app is used by families and by warung owners. An office-furniture or electronics shop sells to households and to companies that need a tax invoice. The business buyers order more and come back; the shop usually finds out by accident.

Dedicated B2B platforms solve this by asking first. Mbizmarket's buying guide says: "Daftarkan diri dan perusahaan terlebih dahulu agar dapat bertransaksi melalui sistem Mbizmarket.co.id". Then the buyer requests a quote. That is the opposite of Wayfair's problem, and for most shops the cheaper half of the answer.

Tax registration helps, but not alone. The tax office's Coretax article of 28 February 2025 says: "Sejak tanggal 14 Juli 2022, mulai diberlakukan Nomor Pokok Wajib Pajak (NPWP) dengan format 16 digit." It also confirms "berlakunya NIK sebagai NPWP untuk Wajib Pajak Orang Pribadi yang merupakan penduduk". So an NPWP on an order does not prove a company: for a resident individual it is the identity number. Store the entity type, badan or orang pribadi, and the company name with it. The same article says "Coretax DJP juga sudah tidak mengakomodasi transaksi non-NPWP seperti pada aplikasi terdahulu." Our reading: buyers who need a proper tax invoice already have to hand over their number, which makes asking at checkout natural.

Data law applies here more than in most of our cases, because this is scoring people. UU 27/2022 (UU PDP) defines personal data around natural persons: "Subjek Data Pribadi adalah orang perseorangan yang pada dirinya melekat Data Pribadi." A one-person business is a person, so scoring a sole trader is scoring personal data. Pasal 10 gives people the right to object to decisions "yang hanya didasarkan pada pemrosesan secara otomatis, termasuk pemrofilan". Pasal 34 asks for an impact assessment for high-risk processing and lists both "evaluasi, penskoran, atau pemantauan yang sistematis" and "pencocokan atau penggabungan sekelompok data". A model that scores customers and matches their addresses to a list of businesses is, on its face, both. The implementing PP 33/2026, in a regional government's copy, was enacted on 16 July 2026 and takes effect six months later, on 16 January 2027 (Pasal 225). Our reading, not legal advice: a sales call prompted by a score, with a person deciding, is lower risk than a price or service changed automatically by it. Do the impact assessment before launch, record the lawful basis (Pasal 20), and take counsel's view.

How we would build it today

Our diagram titled Ask first, count second, score last, for an Indonesian retailer or distributor whose shop mixes households and small businesses, in three bands. Let businesses say so: one tick at checkout, beli untuk usaha or butuh faktur pajak, with company name and NPWP, then store the entity type, because a person's NPWP is their NIK so the number alone does not mean a company. Rules first, a small model second: plain rules such as bulk quantity, the same item again, many delivery addresses, a shop or office address and a company email domain, then gradient-boosted trees trained on tiered labels, tuned on precision and recall, that must beat the rules. Two thresholds and a loop: a high score gets a call, WhatsApp or phone from sales soon after the order; a medium score gets a banner with a harga grosir offer, a faktur prompt or an email; every call becomes a label, business or household, back into training. A note says that under UU PDP scoring and matching are named high-risk cases in Pasal 34, so keep a person between the score and the customer and let people opt out.
Wayfair's three ideas at the size of an Indonesian shop. Most of the value comes before any model. Diagram: MORARI. Source: Wayfair

Picture an Indonesian retailer or distributor: a few hundred thousand customers, households and small businesses mixed together, its own site or app plus a marketplace store, and a sales team of a handful of people.

  1. Ask first. Add one optional tick at checkout and in the account page, beli untuk usaha / butuh faktur pajak, with company name, NPWP and entity type. Reward it with something real: a tax invoice, trade prices, a contact person. Every tick is a clean positive label, and it costs nothing. Wayfair had to infer what many shops could simply ask.
  2. Label in tiers, as Wayfair did. Positives: declared businesses and customers you have already invoiced as companies. Negatives: a small set you are sure of, for example households confirmed by your sales team. Everyone else: unlabelled, not negative.
  3. Write plain rules and measure them. Order quantity above a threshold, the same item bought again, several delivery addresses on one account, delivery to a shop, office, hotel or warehouse, payment by bank transfer on invoice. Wayfair's own baseline was "simpler business rules". Rules are your baseline too, and for many shops they will be enough.
  4. Match against what you already know. Compare delivery addresses and email domains with businesses you already deal with: past invoices, the sales team's contact list. A company email domain is a strong sign; a free webmail address is not. This is the local version of Wayfair's record linkage. The post does not say whether Hamlet uses email domains.
  5. Then train a small model. Gradient-boosted trees, as Wayfair used, on what you already hold: basket size, product mix, how often they order, address type, coupon use. Score it on precision and recall, never accuracy, because businesses are a small share of customers. Ship it only if it beats the rules.
  6. Use two thresholds. A high one for the expensive action: a person from sales calls or sends a WhatsApp. A lower one for cheap actions: an on-site banner offering trade prices, a tax-invoice prompt, an email.
  7. Test the timing yourself. Wayfair says contacting right after the order works three times better, but does not show how it knows. Hold back a random group that is contacted a day later and compare.
  8. Turn every call into a label. Log each outcome, business or household, joined or not, and feed it back. The sales team becomes the source of your best labels.
  9. Treat it as personal data. Do the Pasal 34 impact assessment, record the lawful basis, keep a person between the score and the customer, let people opt out of being contacted, and never change a price or refuse a service on the score alone.

A first version, the checkout tick, the rules and a weekly list for the sales team, is two to three weeks for one developer working with the sales lead. The model can wait until there are a few hundred confirmed labels from calls.