Our Techie Tuesdays’ candidate for this week, Nipun Bhatia, built the pricing platform of Walmart.com from ground up. He’s now the CTO of Magicpin.
When Nipun Bhatia left Walmart Labs in 2016, almost 80 percent of the products on Walmart.com were algorithmically priced, based on the platform he built. But it wasn’t at one go that he got it right. A major mistake was made in the process. Something big enough to be known as ‘Black Wednesday’ in the history of Walmart. It took quite some time and efforts to convince Walmart to continue using pricing algorithms. That experience taught some of the best lessons in tech and organisation building which come in handy now.
There is something about Nipun that comes across as unusual yet familiar. Unusual, because unlike most of techies featured in this column, he didn’t start coding at an early age. In fact, he wrote the first line of a code in the first year of college. He’s still familiar because of his ability to learn, unlearn, and build. Read his story to know more.
Left the college after one month…
Nipun was born in Chandigarh and grew up in Delhi. Both his parents worked in banks. At school, he was an average student. He recalls, “I wasn’t one of those who started coding at the age of 10 or who used to tinker with the systems. We didn’t have a computer till late.”
Nipun wanted to study at the IIT but couldn’t get through. So, he joined the civil engineering branch at Delhi College of Engineering. But after spending a month, his gut feeling made him leave Delhi College of Engineering for IIIT-Allahabad, where he got introduced to computer science. Nipun says, “I had never written a program before or done anything related to computers in the past. Looking back, it was certainly a life-changing decision.”
At that time, internships weren’t a craze at IIIT-Allahabad. In his entire batch, only Nipun and his roommate managed to get an internship. Nipun went to the National University of Singapore. The new experience and exposure he got there made him realise that engineering wasn’t just about going from point A to point B — there are open-ended problems as well. He worked at the School of Computing (NUS) on Computer Vision, specifically in detecting motion under water (blurry scenarios). He also pursued mini-projects in college to learn more since he had a lot to catch up. The first one was on semantic web, which he followed up in an internship at the University of Zurich. He recalls, “That’s when I decided I wanted to focus on semantic web. In semantic web, I was working on how to do information retrieval with structured data. My first project was around building Resource Description Framework (RDF) datasets.”
Data mining, AI and ML @ Stanford University
Nipun figured that he needed to study further in order to keep learning in the field of AI and semantic web and to get more exposure to open-ended problems. When he joined Stanford University in 2007 to pursue MS in Computer Science, at that time machine learning had started picking up. The likes of Google had started focusing on building learning systems rather than a knowledge system.
Nipun took up intensive coursework in machine learning and AI at grad school. He even built a full-fledged system for face detection based on algorithms based on — how one generates data, how one annotates it, and the kind of features that are extracted. He recalled attending a Data Mining class taught by Anand Rajaraman, Founder of Kosmix. Nipun went on to work with Anand later. He adds,“This class introduced me to the applications of algorithms to solve real-world problems. We took a stab at Netflix challenge — where we had to predict the rating a person would give to a movie (based on a dataset).”
In parallel, Nipun was doing a research internship in semantic web which was more open-ended. One of the problems he worked on was the vertical search of biomedical databases leveraging ontologies and other structured meta data sources. He explains,
There was some component of entity extraction. In a paragraph, based on previous word, next word and training data, we had written classifiers on entity extraction. It would understand the data and would identify if the text was talking about cancer or something else.
No bandwidth for PhD
Nipun believes that he didn’t have the intellectual bandwidth to do a PhD to figure out new algorithms or new machine learning techniques, but he really liked applying cutting-edge technology for building an end-to-end system. So, he chose to work after grad school and joined Oracle in their search team. The team was responsible for developing technology to enable organisations to search across protected and disparate information sources like email servers, web applications, and databases. Nipun’s specific contribution was around reducing the indexing time by detecting duplicates. His projects included the following:
- Evaluating and implementing techniques for detecting similar web pages.
- Providing parameters for the administrator to customise the relevance of search algorithm.
When in Silicon Valley, work in a startup
However, Nipun soon realised that Oracle was a huge organisation and he wasn’t doing or learning much there. He reached out to Kosmix with the thought that being in the Silicon Valley and not working in a startup was simply not done.
Nipun got hired by Kosmix to work on its vertical search engine, RightHealth. The way the company translated research into actual implementation and product impressed him. Given his background in biomedical research (at Stanford), he proposed to give consumers data on latest research around medical topics.
Kosmix at that time was C++ and mostly homegrown. Describing the tech stack, Nipun says,
We had our own file system built on top of an indexing system ferret. We had our own distributed query processor, query categoriser written in C++. I remember we were moving using a NoSQL system and we decided to use Cassandra which used to be very buggy and unstable at that time. So, everything was C++ or Java. Some of the front end was Ruby.
The Walmart acquisition
Almost a year later, Kosmix was acquired by Walmart and Nipun joined the search team of Walmart labs. But within three months, an opportunity came to build the pricing platform and Nipun switched teams. He adds,
We started building a data set that would allow us to know the prices of same product on across the web (on Amazon, Target, etc.). This information was then presented to internal stakeholders so that they could do the pricing.
The logical next step was to build a system to price products. That’s where the team faced a lot of roadblocks and errors.
Nipun and his team had built convex optimisation algorithm that would take the cost of a product, look at its competitive price, its business goals around revenue and profits and then come up with an optimal price for the product. In the beginning the company took a conservative approach and started with 5,000 tail products. Nipun says, “We proved that we could always make sure that prices were competitive using these algorithms. By building this system, we allowed the pricing to become dynamic for the first time (algorithmically). We scaled up very quickly and in that journey, I took one of the biggest missteps ever.”
The biggest mistake
It was 2013 and Nipun was leading the pricing team at Walmart Labs. He recalls,
As we were growing, we were blindsided by some of the good things. One day, which we internally call as the ‘Black Wednesday’, we ended up mispricing around 100,000 products and by a huge margin. We sold TV sets for $2.
That day, Nipun was in India for his engagement ceremony. Due to the error, the number of transactions going through Walmart were the highest, beating the record of the last Black Friday. And because the system wasn’t robust enough, the team couldn’t roll back prices quickly. Nipun recalls it as one of the darkest days. His team was shut down for a couple of weeks until he could convince the management that they were building safeguards in the system to avoid the repetition of any such thing. He says,
We had messed up. We had messed up really bad. It was a code bug. We were using Python. There was a loop to update the price of each product. We missed a ‘space’ and because of that all the prices were same as the first product (which happened to be $2). For most part of it, I thought Walmart will never do algorithmic pricing again.
The team recovered from there to build a system that was pricing 80 percent of Walmart.com products in a very robust, scalable and efficient way with the safeguards and learnings they had. They even went to Brazil, Canada and the UK to work with Walmart stores (on pricing).
Nipun says, “That misstep taught me a lot about how to build a team and an organisation — and how it is not just about doing the glamorous stuff, but making sure that you deliver whatever you’ve promised to your end user. You can’t mess up and blame the algorithm. I enjoyed the experience of how to grow an idea into a product. I presented to the board of Walmart twice about the impact of the algorithm and its work.”
You may also like – How Akiba is cultivating the maker-hacker culture in the countryside
Tech stack of pricing platform
Backend had a lot of heavy lifting whether it was costs, stream of competitive data, inventory, page views, conditions (rules). It was built all on HDFS or Hive. Walmart had its own extract, transform, load (ETL) pipeline which would take this data, massage it, store it into different data sources (MySQL and Cassandra). All the machine learning side was in Python. Nipun adds,
We started using open-source solvers for these equations. But we realised that those won’t scale for our problems. So, our data scientists rewrote solvers that were specific for our problem. The output was in MySQL database which would be picked and pushed to site by Java code.
Back to India
Nipun always wanted to come back to India because he had seen the tremendous growth happening here, and was convinced that the next big product for Indian consumers had to be built in India. Internet and smartphone revolution had made the situation further favourable. He felt that in order to be updated with the current skills and to be relevant, he needed to push himself towards new opportunities.
Nipun moved to India to build a development centre for BlueShift which was started in the Silicon Valley by his ex-boss from Walmart. It was a programmatic CRM company that worked with Indian companies like Snapdeal and Jabong. While at BlueShift, he was introduced to Anshoo Sharma, Founder of Magicpin, by LightSpeed Venture Partners. Nipun says,
I wanted to meet him to figure out how did he go about finding a co-founder. Few months down the line, I was invited by him to speak to the tech team about AI and machine learning. I then realised that Magicpin had a large set of interesting data set and they truly had a chance to use that data to make a difference for users. I left impressed and later on we connected again and I joined the team.
The tech story @ Magicpin
Nipun has worked on the following key technologies over the last one year at Magicpin:
1. How to do fraud preventions in the bills uploaded by the users- The company is building an application based on deep neural network to help with fraud preventions. Combining with classical machine learning techniques like SPN (Sum-Product Networks), it’s able to build very sophisticated fraud systems.
2. Magicpin has built a data infrastructure (on open-source technologies) using Mesosphere for real-time scaling; Kafka for real-time queues, Cassandra, Golang, and Spark. Nipun says,
In order to be at the cutting edge of technology, we’ve used Docker, Mesosphere, Kafka, Golang. All of that has allowed us to be cost and time efficient.
Hiring the techies
Nipun finds hiring difficult because not many people are prepared to tackle open-ended problems. Rather than just evaluating a techie based on solving a problem statement, he prefers to have a holistic idea of how they approach a problem, and their ability to learn. He says, “We give them a problem which doesn’t belong to their domain and see how they approach it.”
Collaboration is another important quality which Nipun seeks in the potential hires.
Solving open-ended problems
Nipun wants to push himself to be in places where there are people solving open-ended problems, and where he can learn from best technologies and systems. He would love to be in a place where he’s solving bigger challenges and he’s ready to unlearn and pick up new skills for that. That’s been his theme throughout.
Nipun believes that technology isn’t a silver bullet and that there’s lot more that needs to happen with it to make a difference.
You can connect with Nipun on LinkedIn.