
How iFood uses machine learning and operational research to optimize coupon distribution at massive scale
Providing discounts or coupons has become a natural marketing strategy for digital products to increase business metrics like purchases or user engagement. However, a follow-up question that these businesses need to answer is: what discount should be given, to whom, and when?
While this may seem simple, a single coupon allocation has huge impacts on business results and requires complex engineering solutions to be applied to millions of users at scale.
In this article, we describe how iFood uses machine learning and operational research to provide business teams with a platform that maximizes business metrics based on a target audience and business constraints. First, let’s define the problem we set out to solve.

What is iFood? In a nutshell, iFood is the largest delivery platform in Brazil operating in over 1,000 cities and connecting users with restaurants and grocery stores through its mobile and web apps. As of November 2025, it reached the landmark of 180M monthly orders. With such a high number of orders, any coupon distribution strategy plays a critical role in maintaining both user engagement and business profitability.
At iFood, we define an allocation strategy using 4 pillars:
All these 4 components are defined by business teams based on their specific demands, which varies on specific areas of the product. For instance, teams that operate on groceries units will probably have different optimization settings from food delivery units.
Once an allocation strategy has been defined, it can be translated into an optimization problem. But before doing that, we need to take a quick trip to the economics realm.
Price elasticity measures how much a change in price affects a product’s demand. When an item is elastic, a change in price results in a significant change in sales. If a price change creates a small or no change in sales, then we say that the item is inelastic.
In the context of providing discounts to users, elasticity curves tell you how sensitive users are to incentives. Say we have the following incentive variants:
Most people would think that the higher the incentives, the higher the conversion rate. However, as we say in Brazil: life is not a strawberry! Not all users react the same way when given incentives. In fact, we can operate on 3 types of environments:

With that being said, let’s move forward to our optimization problem.
Most optimization problems fall into the following framework:
Given a set of variables X, find the values of X that maximizes an objective function F restricted to a set of constraints C.
Or, in mathematical terms:

Let’s break it down to simpler problems and gradually make it more complex. Consider the previously defined set of coupon variants V (v1, v2 e v3) and a set of decision variables X(x1, x2 and x3) that decides the fraction of users that will receive each of these variants.
Problem 1: Maximize Orders
Since variable X represents a fraction, each of its values must sum up to 100%. Thus, it is translated as an allocation constraint Ca to our optimization problem:

Next, we need to define the Orders objective function in terms of our decision variables x1, x2 and x3.
To do so, we look at historical data and estimate how many orders of these coupon variants would generate if they operated separately. For instance, on a given audience we can infer from historical data that variant v1 would provide ô1 = 40 orders when x1 = 100%. Alternatively, we infer that ô2 = 70 orders and ô3 = 150 for v2 and v3, respectively. Basically, we are estimating the price-elasticity curves:
Based on these oi values, we can assume that if we allocated a xi fraction of users on variant vi, we would get xi oi orders, which leads to the missing objective function:

Finally, we have defined the complete optimization problem:

Problem 2: Maximize Orders, keeping at most an average R$4 discount per order
Now, besides the allocation constraint, the business team requested that iFood gives, on average, a R$4 discount at most.
Given that variants v1, v2 and v3 represent R$2, R$5 and R$10 discounts, respectively, we can translate this request into an additional budget constraint Cb:

Once we have the optimization problem set, we need to implement an algorithm that solves it based on historical data.
The optimization problem is an abstraction of the Predict + Optimize framework, which involves two main steps:
Based on the presented optimization problem, we need to make predictions on the orders considering each coupon variant.
Let’s say we are making decisions on a daily basis, that is, everyday we change the coupon distribution. Then, predictions can be done by fetching a historical time series for each of the variants and estimating each metric for the next day.

Time series forecasting is a challenge in itself and many algorithms have been developed in this field. Most algorithms rely solely on past data, in which case the prediction function would be something like:

where N is the number of past data points to consider and “o_t” is the metric value on day t. One of the simplest algorithms one could use is the Exponential Weight Moving Average, which makes predictions by averaging past data on a given time window and weighting data according to their recency.
Once the inference models are trained and predictions are computed, one can use several optimization algorithms like linear and mixed linear programming, which are available in python libraries such as PuLP or SciPy.
More recently, we used iFoods Large Commerce Models as the main engine to make those inferences which greatly improved our inference capacity by leveraging the contextual knowledge of LLMs to overcome cold-start problems, that is, when we do not have enough information to create empirical time series.
As you can see, many different settings might be configured for a single coupon allocation strategy: the audience to be impacted, the coupon portfolio to be offered, the business constraints to be set and so many other parameters. All of these can vary depending on the business unit, and so we need to provide different operations teams with a robust and scalable solution architecture.
To this end, we built the Smart Rollout Models, a framework capable of abstracting all these configurations and concise solutions into a single python library.

By setting execution metadata for both inference and optimization modules, the library orchestrates the workflow and outputs the allocation results, which are then fed to external engineering services responsible for serving the coupons at scale.
As of early January 2026, the framework processes:
In this article, we presented iFood’s “Smart Rollout”, a platform designed to optimize coupon allocation at massive scale. We demonstrated how machine learning and operational research are combined to solve the complex challenge of determining what discount to give, to whom, and when, while maximizing key business metrics and adhering to strict business constraints.
By defining an allocation strategy based on four key pillars (Audience, KPI, Coupon Portfolio, and Business Constraints), we translate business needs into a clear optimization problem. The core of the solution lies in the Predict + Optimize framework, where time series forecasting models predict the expected performance of various coupon variants (Predict), and an optimization algorithm then determines the optimal user allocation to maximize the objective function (Optimize).
Finally, the Smart Rollout Models framework abstracts this complex workflow into a scalable Python library, currently managing numerous distinct strategies, many coupon variants, and thousands of time series forecasts across various business units. This system ensures that iFood’s incentive strategy is data-driven, efficient, and highly effective in driving engagement and profitability.

Data Scientist
Engenheiro de Machine Learning no iFood desde 2024. É formado em Engenharia Eletrônica e de Computação pela Universidade Federal do Rio de Janeiro e possui mestrado em Inteligência Computacional pela Coppe/UFRJ.
Estamos sempre em busca de desenvolvedores, designers e cientistas de dados apaixonados para nos ajudar a revolucionar a experiência de entrega de alimentos. Junte-se à iFood Tech e faça parte da construção do futuro da tecnologia alimentar.
Conheça nossas Carreiras
Como o iFood usa machine learning e pesquisa operacional para otimizar a distribuição de cupons em escala massiva Oferecer descontos ou cupons tornou-se uma estratégia natural de marketing para produtos digitais aumentarem métricas de negócio como compras ou engajamento dos…




Catálogos vivos exigem sistemas vivos. E, em um catálogo com milhões de itens, a consistência é o fator mais importante. Em um catálogo com milhões de itens, a classificação de produtos enfrenta desafios que vão além da simples categorização. Descrições…







Como a IA generativa do iFood conecta personalização e comunicação através de padrões rigorosos de engenharia para escalar experiências únicas de usuário De Campanhas Agrupadas para Decisões Individuais [16:30, terça-feira] Não almoçou ainda, né? O Risoto de Funghi que você…


Cada artigo é resultado da visão e expertise dos nossos autores. Veja quem contribui com nosso blog: