From Supplier to Doorstep: The ML Behind Your Picnic Delivery
Co-authored with Ă–ykĂĽÂ Kapcak
Have you ever wondered what happens between the moment you place your order in the Picnic app and the moment your Runner rings your doorbell?
To a customer, it’s a simple process of groceries arriving at the door. But behind the scenes, your order is supported by a series of Machine Learning (ML) models that manage everything from inventory levels to delivery timing.
At Picnic, we operate a “just-in-time” supply chain. This means we have little time to react to orders; we use data to anticipate them, optimize their path through our warehouses, and calculate their arrival down to the minute. Machine Learning (ML) is making thousands of decisions to ensure your groceries are fresh, affordable, and on time.
Let’s follow the journey of a single order to see exactly where these models keep our operations running.
The steps in the process
- Demand Forecasting: Anticipating the order before the basket is filled.
- Resource Optimization: Securing a delivery slot for the order.
- Intelligent Automation: Using Vision AI to eliminate blind spots.
- Last-Mile Modeling: Calculating the exact arrival time at the doorstep.
- From predictions to decisions: Fulfilling the promise of the modern Milkman
1. Demand Forecasting: Anticipating the order before the basket is filled
The journey of your groceries actually begins weeks before you even open the app. Long before you realized you were out of milk, our models were already expecting your order.
By predicting demand for specific articles accurately, we can order exactly what we need from our suppliers right when we need it. This just-in-time approach keeps products fresh, prevents frustrating stockouts, and reduces food waste to a fraction of what traditional supermarkets experience.
You might assume that after years of refinement, we’d have a single demand forecasting model that “just works” forever. In reality, forecasting at Picnic is a continuously evolving problem that changes as fast as our business does. Our product assortment is constantly expanding, the way customers shop adapts to our app improvements, and even our promotion strategies shift over time. For example, we now offer additional personalized promotions, providing a more tailored experience to our customers. This makes the data and the patterns behind what people buy even more dynamic. Our models need to stay flexible and learn fast, otherwise they’d quickly become out-of-date the moment we try something new in the business.
One of the trickiest problems we deal with is the cold-start problem: how do you forecast demand for a brand-new product with little or no historical sales data? Launching new articles (or bringing back seasonal favorites that only sell during the holidays) is a routine challenge. Because these items lack a rich order history, we have to get creative. We often leverage everything we know, from the product’s description to sales patterns of similar items, to make an educated prediction. It’s a bit like giving the model a hint: a new vegan burger might not have past sales, but knowing it’s similar to our regular burger (and that the weather is perfect for a BBQ) can guide the forecast. In short, demand forecasting isn’t a static puzzle to solve once; it’s an ever-moving target that combines domain knowledge with data science finesse.
Over the years, our modeling approaches have also evolved. In Picnic’s early days, we relied on gradient-boosted decision trees, which did a decent job capturing basic patterns. However, when the world turned upside down during COVID-19, people’s buying habits changed overnight and our models were not able to extrapolate to completely new behaviour. These days, we use advanced deep learning models for our core forecasts, such as the Temporal Fusion Transformer (TFT), a state-of-the-art time-series model that can ingest a rich mix of features and detect complex patterns over time. The TFT model helps us capture subtle trends and interactions (like “when it rains and there’s a soup promo, demand triples”).
Of course, building clever models is only half the battle; we also need to prove they work. Before trusting a new forecasting model to order millions of euros in groceries, we put it through rigorous evaluation. This disciplined approach to validation means that as an ML engineer at Picnic, you’re not optimizing models in isolation. You’re conducting live experiments that directly shape how we stock our warehouses and fill our delivery trucks. It’s a challenging, highly rewarding loop: build, test, learn, and deploy. All to make sure that when you run out of milk, we’ve already got a fresh bottle headed your way.
2. Resource Optimisation: Securing a delivery slot for the order
Now that you’ve placed your order, you obviously would like to receive it at home. In order to do that, it’s our challenge to schedule enough people and vehicles to make you a happy customer. Once we know which articles customers are likely to buy, we have to determine if our network can physically move them. This is a multi-layered forecasting challenge that spans our entire infrastructure: from our Distribution Centers (DCs) and Fulfilment Centers (FCs) to our local delivery Hubs.
At the heart of this planning sits another TFT model that forecasts delivery volumes every day. The model learns from historical order patterns, but also incorporates signals about the future that we already know at prediction time. This includes calendar effects like public holidays, when long weekends or festive periods can noticeably shift ordering behavior, as well as external signals such as weather forecasts, because rainy days and sunny days rarely look the same in our data.
This forecast is used to plan every part of our operations, from scheduling the Runners who will drive to your street to the Customer Success agents ready to help if you have a question. Therefore, we have to estimate the total workload. This is where it gets complex. Picnic’s operational capacity, the number of available Shoppers, Runners, and Electric Picnic Vehicles (EPVs), acts as a constraint on the number of deliveries we can actually make.
If we underforecast demand, we plan for lower capacity than we actually need, which means we reach fewer customers. This creates an interesting challenge: our historical data only shows us the orders we allowed based on past capacity, not the “true” demand that might have existed. To solve this, our models aim to estimate unconstrained demand first. By calculating what the demand would be without any limitations, we can then determine our constrained demand based on our actual capacity. This ensures we are optimising our resources and opening as many delivery slots as possible for you and your neighbours.
Finally, while our machine-learning models provide the quantitative backbone of our forecasts, we apply a layer of business logic and expert insight at the end. Our business and operations teams, who know the context on the ground, review the model’s output and adjust for any factors the data might not fully capture. For instance, they might account for an upcoming local event, a last-minute promotion, or any anomaly that the model wasn’t aware of. By incorporating this human-in-the-loop step, we ensure that the final delivery plan is not only data-driven but also aligned with real-world context and expertise. This collaborative approach lets us confidently meet true customer demand, using our capacity in the smartest way possible to make sure your groceries can be picked and delivered.
3. Intelligent Automation: Using Vision AI to eliminate blind spots
Read the full blog here:Â link
Once your order is placed, the clock starts ticking. We know exactly when it needs to leave the warehouse to reach your street on time. For customers in the center of the Netherlands, this process begins in our automated Fulfilment Centre in Utrecht. Here, our in-house warehouse control software coordinates where totes should go when. This starts with matching your order tote with the necessary stock totes to begin picking the articles you ordered.
Throughout this process, inventory accuracy is key. By mounting high-resolution cameras directly above the conveyor lines, we’ve added a layer of visual intelligence that allows us to look inside the totes. A powerful application of this technology is automated inventory counting. Instead of relying on manual audits that interrupt the picking flow, our Vision AI performs counts as totes move at high speeds. This ensures our digital inventory remains 100% in sync with physical reality, enabling a leaner supply chain and significantly fewer stockouts.
In order to do this, we leverage cloud-hosted AI. Instead of building a traditional computer-vision model (which would require thousands of labeled images and custom training), we tapped into a state-of-the-art Vision Language Model (VLM) from Google’s Gemini family. These multimodal AI models have demonstrated the ability to handle complex visual reasoning tasks out-of-the-box, making them a perfect fit for our counting challenge. We started by prompting the Gemini model to count items in a tote image, providing extra context like the product’s reference photo to improve accuracy. This prompt engineering alone made the model far more robust to different item orientations and packaging. To push performance even further (and reduce costs), we fine-tuned a lighter variant of the model on our warehouse images. All these steps enabled the model to count the items accurately, even when products are partially overlapping or oddly shaped.
Having a real-time visual understanding of our inventory unlocks endless opportunities, from detecting potential quality issues to verifying the exact placement of items in order totes. All to ensure that your order arrives at your doorstep with all the articles you ordered.
4. Precision Delivery: Calculating the exact arrival time at the doorstep
Now that your order has been picked and verified, it’s loaded onto one of our electric vehicles. But the real world is unpredictable. To provide our signature 20-minute delivery window, we move beyond calculating simple arrival times. Instead, we predict the exact number of minutes it takes to park the vehicle and bring the groceries to your doorstep. At that point, estimating drop-off time becomes a modeling problem rather than a routing one.
A delivery stop can look quite different depending on where it ends and what it involves. A runner carrying multiple heavy totes up multiple floors to a first-time customer in a dense city center faces a very different situation than a quick drop at a suburban doorstep. Capturing those differences requires a model that goes beyond linear assumptions. We use a neural network to learn non-linear interaction effects between factors like order size, building characteristics, and customer familiarity. For example, carrying three heavy totes up those four floors might take much more than three times the effort of carrying just one.
In practice, this means trading off model complexity and inference speed to make accurate predictions for millions of deliveries at scale. These predictions are then aggregated along the route, ensuring that the time window you receive for your order is as accurate as possible.
5. From predictions to decisions: Fulfilling the promise of the modern Milkman
At Picnic, an ML model doesn’t just produce a number for a dashboard, it drives an automated decision. The true power of our supply chain lies in the translation of data into action.
The journey of your order is managed by a series of automated handshakes across the entire chain. From the moment our demand forecasting models triggered a supplier order, to the delivery forecasts balancing our capacity, and finally, the stop time predictions precisely timing your delivery. Machine Learning is the invisible thread that connects our digital systems to our physical operations.
By bridging the gap between a “prediction” and an “action,” we use data to build a grocery service that is more efficient, more sustainable, and more reliable for every customer. We don’t just use ML to see the future; we use it to build a smarter supply chain, reinventing the traditional milkman.
Interested in the deep dive? If you are interested in reading more about our machine learning models and AI journey, check out our previous blog posts:
- Building an AI-first company: lessons from scaling from a small start-up to a Machine Learning powerhouse
- Running Demand Forecasting ML Models at Scale
- Using Transformers to Cut Waste
- Signal vs Noise: Choosing the right granularity for demand forecasting
- Adding Eyes to Picnic’s Automated Warehouses
Sounds interesting? Make sure to follow the Picnic Engineering blog and keep your eyes open for new blog posts! If you are interested in helping to build the most data-driven modern milkman, head over to picnic.app/careers and take a look at our vacancies!
From Supplier to Doorstep: The Machine Learning Behind Your Delivery was originally published in Picnic Engineering on Medium, where people are continuing the conversation by highlighting and responding to this story.









