AnnouncementIntroducing MongoDB 8.0, the fastest MongoDB ever! Read more >>

Building AI With MongoDB: How Delivery Hero Expands Revenue With Real-Time Product Recommendations

Delivery Hero employee photo image.

INDUSTRY

Computer Software/SaaS
Ecommerce

PRODUCT

MongoDB Atlas Vector Search

USE CASE

Catalog

CUSTOMER SINCE

2021

Founded in Germany in 2011 as a food delivery service, Delivery Hero has grown to become the world’s leading local delivery platform. The company had a landmark year in 2023, delivering on its ambitious financial targets, including generating €11.3bn ($12.4bn) Gross Merchandise Value in Q4 2023. Connecting a vast ecosystem of riders, restaurants, retailers, and partners, the company delivers everything from prepared meals to groceries, flowers, coffee, medicine, and more directly to the customer’s door — often in less than one hour.

Delivery Hero operates at global scale. With a product catalog offering more than 100 million items, it serves customers in over 70 countries across four continents under household names such as PedidosYa in South America, Glovo spanning Europe, Central Asia and Africa, foodpanda in Asia-Pacific, and talabat in the Middle East, amongst others.

The company is constantly exploring new technologies to improve the experience of its customers. Ensuring stock outages never leave customers wanting, Delivery Hero has built a new Item Replacement Tool providing hyper-personalized product recommendations in real time using state-of-the-art AI models and MongoDB Atlas Vector Search.

Batch processing slows down Quick Commerce

Delivery Hero’s Quick Commerce service enables customers to select fresh produce for delivery from local grocery stores. Around 10% of the inventory is fast-moving perishable produce that can quickly go out of stock. Without being able to recommend a suitable alternative to the customer, the company risks revenue loss and customer churn. Delivery Hero’s engineering and data science team built the Item Replacement Tool to address these risks.

“If a product is not available, our Item Replacement Tool recommends a suitable alternative,” explains Mundher Al-Shabi, Senior Data Scientist at Delivery Hero.

An image of Quick Commerce ordering and delivery cycle

Figure 1: The Quick Commerce ordering and delivery cycle is completed in under one hour

The first version of the replacement tool was built against product information stored in the company’s Google BigQuery data warehouse. Alternatives for each product were pre-computed and cached in a local Redis instance that served the Quick Commerce stock picking service used in-store by the Delivery Hero riders.

While this first version of the replacement tool helped the Delivery Hero engineering team showcase the art of the possible, there was one major drawback: The recommendations it generated were stale. This was because they were computed in batch runs once every 24 hours. If in the meantime an item went out of stock, was discontinued or delisted, or if the customer set a preference for a different replacement item in the app, the tool was still serving old, and therefore inaccurate data to the riders. Being unable to provide a suitable substitute, or with the replacement not being accepted by the customer, both revenue and satisfaction were impacted.

“We needed to move to an up-to-second real-time recommendations system, and that is what MongoDB Atlas Vector Search enabled us to do.”

Mundher Al-Shabi, Senior Data Scientist at Delivery Hero

Real-time replacements with multi-lingual embedding models and Atlas Vector Search

Prior to the Item Replacement Tool, Delivery Hero migrated its product catalog from a relational database to MongoDB Atlas running in Google Cloud in 2021. It adopted Atlas Search shortly afterwards to accelerate new feature development while rationalizing and simplifying its technology portfolio.

With the introduction of MongoDB Atlas Vector Search, the data science team saw the opportunity to move to a real-time replacement tool harnessing a platform that was already widely used by the company. This would avoid incurring expensive and complex technology sprawl.

“Within the MongoDB Atlas platform, we can store, index, and query vector embeddings right alongside our product and customer data, with everything fully synchronized,” says Al-Shabi. “However they are working with data, our developers benefit from a consistent query syntax and a single driver, which reduces their learning curve and increases their productivity. It also avoids us having to maintain and manage a separate vector store with a separate mechanism to sync it with the operational database. By using MongoDB Atlas, we have a more agile, streamlined, and efficient platform architecture that enables us to build and deploy faster and run at lower costs.”

An image of real-time architecture with MongoDB Atlas

Figure 2: The reactive, real-time architecture with MongoDB Atlas keeps recommendations fresh and hyper-relevant to Delivery Hero’s customers.

In the new version of the Item Replacement Tool, embeddings of product information are generated using a bidirectional multilingual sentence encoder model which is trained using a Hugging Face library and runs in Google Vertex AI. As product details change, vector embeddings are continuously updated, persisted, and indexed by Atlas Vector Search.

When a rider picking a customer order in store comes across an item that is not available, the Delivery Hero picking service uses Atlas Vector Search to recommend up to 20 suitable replacement items. Atlas semantically searches across vector embeddings of the product catalog to identify similar products with its approximate nearest neighbor algorithms. The recommendations are then sent to the customer to select their preferred replacement. The total roundtrip latency from query in the app to returning recommendations to the user cannot exceed more than one second.

Building upon this workflow, customers will soon be also able to select preferred replacements when they place their order, should their first choice not be available. Again, total latency cannot exceed more than a single second.

“With Atlas Vector Search we can compose sophisticated queries that quickly filter across product data, customer preferences, and vector embeddings to precisely identify hyper-relevant product recommendations in real time.”

Mundher Al-Shabi, Senior Data Scientist at Delivery Hero

The results and how to get involved

The new Item Replacement Tool is being piloted first in the Middle East. By providing personalized recommendations against live inventory, Delivery Hero expects to see an increase in its monthly Gross Merchandise Value. Global rollout of the new Item Replacement tool is expected to follow over the next couple of quarters.

“With MongoDB Atlas’ distributed architecture, we can cost-effectively scale-out the service across our global operations,” says Al-Shabi. “The flexibility of its document data model means we can dynamically add new product attributes and embeddings for different markets without being blocked by slow and complex schema changes. We have a strong preference for managed cloud services as they reduce operational overhead and opportunity costs. This is exactly what Atlas gives us.”

Beyond recommendations Al-Shabi and team have many other potential use cases for Atlas Vector Search. This includes price comparisons against matching products in competitor catalogs, as well as identifying gaps and duplicates in Delivery Hero’s own product portfolio. To learn more about how the Delivery Hero data science team has implemented both lexical and semantic matching, read Al-Shabi’s Semantic Product Matching blog post.

If you are excited about this technology and its use cases, Al-Shabi and team are hiring. Check out the opportunities on Delivery Hero’s careers page.
AI, vector embeddings, and semantic search are opening up many new possibilities for smarter applications. If you want to learn more about the technology and its possibilities, take a look at our Atlas Vector Search learning byte. In just 10 minutes you’ll get an overview of use cases and how to get started.

What will your story be?

MongoDB will help you find the best solution.