Real-time context based smart type-ahead suggestions

The journey towards incorporating a short-term context into type-ahead suggestions for an e-commerce platform

Hoosein
Hoosein
Nov 16, 2018 · 5 min read

Chapter I: The Motivation

TL;DR We want to provide smart type-ahead suggestions, based on short-term user activity context. We aim to reduce the friction of finding the right product for a shopper at Myntra.

Our Contextual Type-Ahead in Progress. Elucidation: Here we glance over regular suggestions, set Cushion Covers as the context and then revisit.

Measuring Impact

As an important engineering aspect, we must measure the impact in terms of CTR, click depth and quality of suggestions. We want to improve the user experience, leading to better conversion rates. For Myntra, it also means better discoverability of its products.

Chapter II: A First Cut Model

TL;DR We have an evolving model that incorporates a short-term context that is dynamic and available in real time.

Chapter III: The Engineering

TL;DR <Not this one>

Main Components and Subsequent Flow

Our final architecture. We will discuss the details as we move forward. But feel free to speculate from here.

I. Events & Pipeline

Examples of an Event can be what the user searched, its underlying semantic understanding or a user’s subsequent interactions with the search results. We need to convert them into a generic payload containing a set of annotations. Annotations are just an array of key-value pairs with associated weights. The annotation weights determine the importance of each annotation in an event, a number between 0 and 1.

{
"userid": "john.doe@gmail.com",
"annotations": [
{
"field": "category",
"value": "shoes",
"weight": 1
},
{
"field": "brand",
"value": "nike",
"weight": 1
}
],
"timestamp": 1539863345763,
"source": "search"
}

II. Processing Events with the User-context Model

Next, once the pipeline is up, we need to process this payload in near real-time. We need a processing engine, which can help us smartly batch the events, process them in parallel and pivot into a User-level Context. Let’s now come up with a contract for the Context of a user.

{
"userid": "john.doe@gmail.com",
"annotations": [
{
"field": "category",
"value": "shoes",
"weight": 0.7
},
{
"field": "brand",
"value": "nike",
"weight": 0.7
},
{
"field": "brand",
"value": "gucci",
"weight": 0.02
}
],
"lastTimestamp": 1539863345763
}

III. Integrating context with existing type-ahead suggestions

A Logic to integrate the context into Type-Ahead Suggestions

Chapter IV: Where we are…

TL;DR It’s a good start. We have set up the pipeline that allows us to experiment with different algorithms. First version has shown an improved CTR.

Architectural Benefits

  • The Model plugs in and out of the system; helps in rapid experimentation.
  • The Event(s) contract allows better configurability across event sources.
  • The Context contract allows reusability across use cases. For example, we can now recommend similar products based on context.
  • We can also ship the model with the app itself; albeit it has its own challenges.

What’s next?

We rolled this out as an A/B test and found an increase of 3% in CTR for contextual type-ahead users. This has encouraged us to roll it out to all the users. Do give it a shot!

Myntra Engineering

Stories of code.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store