Image source: undraw.co

Get to your favorite food faster — Swiggy it!

Taruna Manchanda
Swiggy Bytes — Tech Blog
6 min readJan 22, 2018

--

Hungry? Want to eat something interesting? Don’t know what that is? And want it ASAP? Allow us to help! :)

At Swiggy, our biggest goal is to match you with the most amazing food available, in the minimum amount of time, in a hassle-free way. One way we achieve this is by sorting restaurants on Swiggy intelligently, according to our customers’ taste & preferences.

On a given day when you open Swiggy, there’s a huge probability that more than 300 restaurants would be serviceable in your area. Given the breadth of options available, it’s not always easy to make a pick. And any time spent figuring out what to eat, adds up in the time taken for the food to come to you. In order to help our customers with this choice, we decided to come up with a way to sort all serviceable restaurants smartly.

Illustration: Pallavi Bhargava

Understanding our customers & restaurants better

To be able to rank these 300+ restaurants in a manner that is relevant to you, it was important that we understood not just you, but also all the restaurants on our platform very well. As the work began, we were faced with a couple of interesting challenges.

First, taste and food preferences are very subjective and very personal.

Some time back, we did a quick hallway test at the Swiggy office, and it was an interesting find that most of us couldn’t describe our own taste preferences very well. “It depends” was an answer that came up most often.

Illustration: Pallavi Bhargava

One’s choice in food on a given day & time not just depends on internal factors such as his/her dietary habits, the favorites, mood of the day, but also on external factors such as time of the day, the weather outside, and things such as the food items that we were exposed to in recent past and got tempted by.

Second, while we thought humans were the only ones who are unique and special, we couldn’t have been proven more wrong when we started digging deeper into the restaurant space. On analyzing thousands of menus, we realized that there was absolutely no coherency in the dish naming space. Some restaurants decided to call their dal makhani, dal makhan wali, others called it dal-e-bukhara and still others called it kali daal (with butter). At the end of the exercise, we realized that a dal makhani in India could be called by 100+ different names. And pizzas, we discovered, were also called flat-breads!

Illustration: Pallavi Bhargava

It was clear that a simple text based matching would never work in this domain.

Third, even after we decided that the dish behind the jazz was actually a dal makhani, we couldn’t score it or say with any accuracy whether it was better or worse than the dal makhanifrom any other restaurant.

It wasn’t as simple as an iPhone, is an iPhone, is an iPhone. For meals, the description changed with every next person who tasted it.

Solution

To bring structure to this problem and solve it, we came up with a homogeneous scoring system. Each restaurant was scored on a set of predefined ‘topics’.

A topic was anything from a dish family (biryani), to a dish (lemon cheesecake), to a group of similar dishes (Indian sweet dishes such as gulaab jamun, phirni etc.). We iterated on a number and variety of such topics to come up with a combination which was useful, could be exhaustively applied to each of the 4 million+ dishes from the 25,000+ restaurants on our platform, and could scale up in tandem to our growth.

So every restaurant on our platform was scored on each topic, keeping the total for a restaurant equal to 1. The total was kept 1 to make the comparison easier. For example, and putting it very simply — a restaurant whose score was a 0.54 on biryani would be matched more frequently with a biryani lover, than another restaurant with a score of 0.16 on biryani.

Illustration: Pallavi Bhargava

This scoring or tagging was a function of many different variables such as, items on a restaurant’s catalogue, what’s an item’s repeat within a restaurant, how were people rating an order from a restaurant, and so on.

In parallel, we were also continuously learning about our customers’ preferences and their affinity to each of these topics/dishes. Some of the variables we used here were, which restaurants a customer digitally browsed, which ones did she order from, the dishes ordered, ratings given and so on.

Illustration: Pallavi Bhargava

Once we could confidently match a few restaurants with a user, ranking within them was done by adding a few more variables to the equation. These were variables such as discounts, time to deliver, popularity of the restaurant in the neighborhood, and more.

Illustration: Pallavi Bhargava

After all these hundred ingredients (err… variables we talked of above) are permuted & combined, we are able to come up with a secret sauce to uniquely rank restaurants for millions of users, according to their taste & food preferences. This way of sorting is called the ‘relevance’ ranking logic in your Swiggy app.

And all of this magic happens in the nanoseconds you open Swiggy and we present to you the list of restaurants serviceable in your area. :)

Testing the Solution

To ensure that all of these months of hard work to come up with the ‘relevance’ sorting, were actually in the right direction, we tested it against a number of different ordering ranking logics.

Illustration: Pallavi Bhargava

Results

Below we compare the results of the ‘relevance’ logic with a commonly known ranking logic: ‘popular’ logic (ranking restaurants based on how often people were ordering from them or how popular they were in a neighborhood).

For users who were shown the list of restaurants sorted by the ‘relevance’ ranking logic (in comparison to the ‘popular’ ranking logic):

1. Time-to-order dropped by 20 seconds.

2. Customers searching for a dish or restaurant reduced by 2%.

Our hypothesis — people were able to find what they were looking for right on the homescreen without having to search for it.

3. For the popular logic, if customers were scrolling past X restaurants before finding the restaurant to order from, for relevant logic, they scrolled only to X-10 restaurants.

4. Number of people who came on the app and left without doing anything dropped by 1%.

Our hypothesis — new users didn’t get bogged down by the amount of choice available and probably found their favorite, known restaurants on the homescreen giving them a sense of familiarity.

5. The median rank of the first restaurant to be digitally checked out bumped up to 9, from 14.

And most importantly, increase in App Store and Play Store reviews with heart stickers! ❤

--

--

awkward | boring | uncool | old school | tastefully creepy | gets high on cheese | not the fattest one in gym anymore | PM at work and a hopeless writer in life