Back to Data
Optimizing bakery production & sales with AI
June 9, 2021

The Carrefour-Google Lab embarked on an ambitious project to build an AI solution that delivers accurate predictions for fresh products demand, for all its French hypermarkets. The goal was two-fold: minimize food waste and reduce empty shelves by helping bakery managers to prepare the right amount to get as close as possible to the real demand.

Ensuring that customers always find their favorite baked goods

Stores need to strike a balance between risking shrinkage, by putting too many products on shelves, and running out of the products customers want. In fact, empty shelves are one of the main reasons customers make complaints and do not buy a substitute product. Indeed, according to a study, when customers do not find the product they are looking for, less than half will make a substitute purchase, and nearly a third will leave the store and  buy the item elsewhere. This translates into a ~4% sales loss for a typical retailer. To address this issue, the Lab chose to focus on an area where this problem is particularly acute: fresh products, which typically have to be sold the same day. Fresh products can be anything from meat, to fish, to fruits and vegetables. We chose to start the project with freshly baked goods, where product shelf life is extremely short, and so we started using AI to predict the sales of croissants.

Carrefour France already had a forecasting system only based on the average daily sales and with poor predictive performance: “After comparing predictions with final sales we observed that the model performed with low forecast accuracy” says Paul Devienne, Data Scientist. He further adds, “So we saw room for improvement, and the chance to create a more accurate algorithm by integrating new features,  and therefore reducing the error rate”. 

Exploring historical data to understand trends and build models

The team looked for seasonal variations in the sales data over the past two years, and combined this information with important events, such as public holidays or major promotions. Specific product information was factored in, as well as store characteristics such as the store size. A lot of attention was paid to price evolution and promotional activity. “Product promotions are an interesting factor, because when most people come into the bakery section of a hypermarket, they do not know exactly what they want to buy,” says Adeline Bodemer, former Head of Bakery Department at Carrefour France. “They’ll go in for a cheesecake, but if they see a raspberry cake on sale, they might buy it instead. With product families such as these, people are happy to switch their choice when they see a promotion.”

When you collect tons and tons of data, you need to watch out for errors and outliers that can skew your calculations. It’s really easy to take a first look at your data with Google BigQuery. We often use Google Data Studio to visualize the data and look at its shape and behaviour. This makes it much easier to spot trends that we might have missed otherwise. We explore these trends, understand them, and build them into our models.

Inviting Artificial Intelligence onto the shop floor 

After having built a model using historical data, we “back tested” it (that is comparing predictions with real historical sales) to face the real world of retail with all of its constraints and surprises. It is quite common to see a drop in performance during initial tests – this was the case on this project as well. However by working closely with bakery managers through weekly meetings to deepdive into each prediction they receive, the necessary adjustments were made. For example, we found out that our customers’ behaviors during the vacation were in fact the same a few days before and a few days after the vacation. Thus, we were able to feed this information into the model so it could observe behaviors from past years and improve the quality of predictions. 

The solution was initially tested in seven hypermarkets between June and July 2020, and then in 9 hypermarkets in October of the same year. Despite the challenging test conditions in the time of Covid-19 with changing curfews & store opening hours, and consuming behavior adaptation, the results from in-store tests showed that the algorithm had a solid increase of forecast accuracy compared to the existing solution. When we extrapolate these results, we expect to reduce out-of-stock and shrinkage up to 5% and 12% respectively, for French hypermarkets. 

Furthermore the team is confident that the model will continue to improve its forecasting with time as the solution takes advantage of Machine Learning principles. That is, every week, new data is fed to the model and by learning from millions of historical data points, the algorithm improves and even learns to adapt to special cases. For instance, it learns that if a given product is on promotion, the sales of similar products will decline over the period of promotion if they are not discounted.

Delivering a solution that will reduce shelf-out and shrinkage for bakery and beyond

The Lab’s sales forecasts are smoothly replacing those of the historical forecasting tool. Collaboration with IT and the Bakery department allowed us to deploy the forecast to the Viennoiserie products for the 200+ hypermarkets beginning of March 2021. “So far, most shop managers are welcoming the forecasts with a positive astonishment on how precise it can be! We implemented a feedback loop with the stores via a form button integrated to the tool, so the Lab can receive feedback and optimize the model in real time” explains Charlotte Recorbet, new head of the Bakery Department. Nothing changes in terms of interface or functionalities for bakery managers, thus guaranteeing easy adoption and keeping capital investment to a minimum. 

We had a promising start on Viennoiserie with a 15% reduction of the waste rate (representing ≈ 12,500 products) in the first full month of exploitation for all the hypermarkets. Additionally, we also reduced the error rate by 30% and improved our forecast accuracy by 10%. The goal is now to extend the solution to the remaining Bakery products in the upcoming days. As for the roadmap, our aim is to test the model, which has been built for croissants, on other fresh products such as fish, meats and fruits & vegetables. 

As part of our Act For Food program, we are doing our best to minimize food waste. Beside our AI solution introduced in this article, we are multiplying initiatives such as forging a strong partnership with Too Good To Go. Our collaboration has allowed us to save more than 2.5 tons of food in 2019. 

Interested to know more about the Lab’s projects? Check out their Assortment Recommendation System to personalize in-store product selection

About the Author

Rony is Data Scientist @ Carrefour Google Lab With over 6 years experience as a Data Scientist, Rony works in various sectors (e-commerce, retail, bank, health insurance). Paul is Senior Data Consultant @Artefact Acting as Product Owner within Carrefour Google Lab he has acquired a strong expertise in Data Marketing and AI Product management.

What’s new?