SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Fabian Spaeh
fspaeh@bu.edu
Display Ads and the generalized assignment problem are two well-studied online packing problems with important applications in ad allocation and other areas. In both problems, ad impressions arrive online and have to be allocated immediately to budget-constrained advertisers. Worst-case algorithms that achieve the ideal competitive ratio are known, but might act overly conservative given the predictable and usually tame nature of real-world input. Given this discrepancy, we develop an algorithm for both problems that incorporate predictions and can thus improve the performance beyond the worst-case. Our algorithm is based on the work of Feldman et al. (2009a) and similar in nature to Mahdian et al. (2007) who were the first to develop an algorithm with predictions for the related, but more structured Ad Words problem. We use a novel analysis to show that our algorithm is able to capitalize on a good prediction, while being robust against poor predictions. We experimentally evaluate our algorithm on synthetic and real-world data on a wide range of predictions. Our algorithm is consistently outperforming the worst-case algorithm without predictions.
Advertising on the internet is a multi-billion dollar industry with ever growing revenue, especially as online retail gains more and more popularity. Typically, a user arrives on a website which fills an empty advertising spot (called an impression) by allocating it instantly to one of many advertisers. Advertisers value users differently based on search queries or demographic data and reveal their valuations in auctions or through contracts with the website. Formulations of increasing complexity have been studied to capture this problem, creating a hierarchy of difficulty (Mehta, 2013). The most basic is online bipartite matching, where each vertex on one side arrives online with all its adjacent edges and has to be matched immediately to one of the vertices on the other side, which were supplied offline. The problem and all generalizations admit a hard lower bound of  $1 - \frac{1}{e}$  due to the uncertainty about future vertices. Motivated by online ad exchanges, where advertisers place bids on impressions, Mehta et al. (2007) introduced the Ad Words problem, which is a generalization of online bipartite matching where we charge each advertiser for the amount they bid. Going beyond the Ad Words setting, Feldman et al. (2009a) considered the more expressive problems Display Ads and the generalized assignment problem (GAP), and proposed algorithms for these settings with worst-case guarantees.
Classic algorithms that defend against the worst case of  $1 - \frac{1}{e}$  are often overly conservative given that the real world does not behave like a contrived worst-case instance. Recently, researchers have thus been trying to leverage a prediction about some problem parameter to go beyond the worst-case (Mitzenmacher and Vassilvitskii, 2022). In the context of ad allocation, a prediction can be the keyword distribution of users on a certain day, or simply the advertiser allocation itself. Such a prediction is readily obtainable in practice, for example through learning on historic data. Two opposing properties are important: The algorithm has to be consistent, meaning that its performance
should improve with the prediction quality. Simultaneously, we want the algorithm to be robust against a poor prediction, i.e. not to decay completely but retain some form of worst-case guarantee. This is particularly important in the advertising business as much revenue is extracted from fat tails containing special events that are difficult or impossible to predict, but extremely valuable for the advertising business (e.g. advertising fan merchandise after a team's victory). To this end, Mahdian et al. (2007) developed an algorithm with predictions for the Ad Words problem and Medina and Vassilvitskii (2017) show how to use bid predictions to set reserve prices for ad auctions. Inspired by their work, we develop an algorithm with predictions for Display Ads and GAP.
Our Contributions: We design the first algorithms that incorporate predictions for the well-studied problems Display Ads and GAP. The two problems are general online packing problems, that capture a wide range of applications. Our algorithm follows a primal-dual approach, which yields a combinatorial algorithm that is very efficient and easy to implement. It is able to leverage predictions from any source, such as predictions constructed from historical data. Using a novel analysis, we show that the algorithm is robust against bad predictions and able to improve its performance with good predictions. In particular, we are able to bypass the strong lower bound on the worst-case competitive ratio for these problems. We experimentally verify the practical applicability of our algorithm under various kinds of predictions on synthetic and real-world data sets. Here, we observe that our algorithm is able to outperform the baseline worst-case algorithm due to Feldman et al. (2009a) that does not use predictions, by leveraging predictions that are obtained from historic data, as well as predictions that are corrupted versions of the optimum allocation.
Problem Definition: In this work, we study the Display Ads problem and its generalization, the generalized assignment problem (GAP) (Feldman et al., 2009a). In Display Ads, there are advertisers  $a \in \{1, \dots, k\}$  that are known ahead of time, each of which is willing to pay for at most  $B_{a}$  ad impressions. A sequence of ad impressions arrive online, one at a time, possibly in adversarial order. When impression  $t$  arrives, the values  $w_{at} \geq 0$  for each advertiser  $a$  become known. These values might be a prediction of click-through probability or any valuation from the advertiser, but we treat them as abstractly given to the algorithm. We have to allocate  $t$  immediately to an advertiser, or decide not to allocate it at all. The goal is to maximize the total value  $\sum_{a,t} x_{at} w_{at}$  subject to  $\sum_{t} x_{at} \leq B_{a}$  for all  $a$ , where  $x_{at} = 1$  if  $t$  is allocated to  $a$  and  $x_{at} = 0$ , otherwise. GAP is a generalization of Display Ads where the size that each impression takes up in the budget constraint of an advertisers is non-uniform. That is, each impression  $t$  has a size  $u_{at} \geq 0$  for each advertiser  $a$ , and advertiser  $a$  is only willing to pay for a set of impressions whose total size is at most  $B_{a}$ . More precisely, we require that  $\sum_{a,t} x_{at} u_{at} \leq B_{a}$ .
Free Disposal Model: In general, it is not possible to achieve any competitive ratio for the online problems described above. Motivated by online advertising, Feldman et al. (2009a) introduced the free disposal model which makes the problem tractable: when a new impression arrives, the algorithm allocates it to an advertiser  $a$ ; if  $a$  is out of budget, we can decide to dispose of an impression previously allocated to  $a$ . The motivation for this model is that advertisers are happy to receive more ads, as long as they are only charged for the  $B_{a}$  most valuable impressions. We refer the reader to the paper of Feldman et al. (2009a) for additional motivation of this model. In this work, we consider both Display Ads and GAP in the free disposal model.
Related Problems: Display Ads and GAP are significant generalizations of well-studied problems such as online bipartite matching and Ad Words. In online bipartite matching, all values are 1. In Ad Words, values and sizes are identical. The latter setting allows for more specialized algorithms that exploit the special properties of this problem, as we discuss in more detail later.
Algorithms with Predictions: The algorithms we study follow under the umbrella of algorithms that leverage predictions to obtain improved performance. These were studied in an extensive line of work, see e.g. the survey of Mitzenmacher and Vassilvitskii (2022). Following this established research, we use two important measures for the performance of the algorithm: The robustness ALG/OPT indicates how well the algorithm's objective value ALG performs against the optimum solution OPT; the consistency ALG/PRD measures how close the algorithm gets to the prediction's objective value PRD. Most algorithms with predictions, including the one presented in this work, allow to control the trade-off between robustness and consistency with a parameter  $\alpha$ .
Online Ad-Allocation with Predictions: To the best to our knowledge, we are the first to study Display Ads and GAP with predictions. Related problems were considered in the work by Mahdian et al. (2007) and Medina and Vassilvitskii (2017) for Ad Words, and by Lattanzi et al. (2020) for online capacitated bipartite matching. Medina and Vassilvitskii (2017) use bid predictions to set reserve prices for ad auctions. Lavastida et al. (2021) incorporate predictions of the dual variables into the proportional-weights algorithm (Agrawal et al., 2018; Karp et al., 1990; Lattanzi et al., 2020) for online capacitated bipartite matching. Chen and Indyk (2021) analyze an algorithm that uses degree predictions by matching arriving vertices to vertices with minimum predicted degree. Jin and Ma (2022) provide an algorithm for batched allocation in bipartite matching under predictions, based on the model of Feng et al. (2021). As noted above, Ad Words and bipartite matching have additional structure, which is exploited in these prior works. In particular, the algorithms proposed in these works are not applicable to the more general problems Display Ads and GAP. Our algorithm builds on the approach of Mahdian et al. (2007) for the Ad Words problem, but substantial new ideas are needed in the algorithm design and analysis, as discussed in more detail in Section 2.
There has been further extensive work in the design of worst-case algorithms and under random input models without predictions, which we now summarize.
Worst-Case Algorithms: The design of worst-case algorithms has been the focus of a long line of work which can, for instance, be found in the survey of Mehta (2013). A large focus has been on Ad Words. Several combinatorial algorithms have been proposed, based on the work of Karp et al. (1990). The combinatorial approach is tailored to the structure of these special cases. The primal-dual approach is a more general approach that can handle more complex problems such as Display Ads and GAP (Buchbinder et al., 2007; Feldman et al., 2009a). In this work, we build on the primal-dual algorithm of Feldman et al. (2009a) and show how to incorporate predictions into their framework. The worst-case guarantee for online bipartite-matching, and therefore for all generalizations, is  $1 - \frac{1}{e}$  (Karp et al., 1990).
Stochastic Algorithms: The lower bound of  $1 - \frac{1}{e}$  can be circumvented under distributional assumptions. This has been extensively studied for online bipartite matching (Karande et al., 2011; Feldman et al., 2009b; Jin and Williamson, 2022). Further work has been done for the Ad Words problem (Devanur and Hayes, 2009; Devanur et al., 2012) with generalizations due to Feldman et al. (2010) for a more general stochastic packing problem.
2 Our Algorithm
In order to illustrate the algorithmic ideas and analysis, we consider the simpler setting of Display Ads in this section. Our algorithm for GAP is a generalization of this algorithm and we include it in Appendix B. For simplicity, we assume that our prediction is a solution to the problem, which is as in prior work (Mahdian et al., 2007). However, due to our general analysis framework, we also consider our algorithm a starting point towards incorporating weaker predictors, such as partial solutions or predictions of the supply, which we leave for future work.
Prediction: We assume that we are given access to a prediction, which is a fixed solution to the problem, given as an allocation of impressions to advertisers. With each impression  $t$ , we also receive the advertiser  $\mathrm{PRD}(t)$  to which the prediction allocates  $t$ . In particular, this means that the prediction does not have to be created up front, but can be adjusted on the fly based on the observed impressions.
Given a solution to the problem, we could also consider the following random-mixture algorithm: For some parameter  $q \in [0,1]$ , run the worst-case algorithm; with probability  $1 - q$ , follow the prediction exactly. This algorithm achieves a robustness of  $q \cdot (1 - \frac{1}{e})$  and consistency of  $q \cdot (1 - \frac{1}{e}) + 1 - q$ . However, this is only in expectation and against a weak adversary that is oblivious to the algorithm's random choices. In contrast, Algorithm 1 is designed to obtain its guarantees deterministically against the strongest possible adversary that can adapt to the algorithm's choices, which is identical to the setup in Mahdian et al. (2007). We observe that Algorithm 1 clearly outperforms this random-mixture algorithm in our experiments (cf. Section 4) which shows that our stronger setting is indeed valuable in practice. Furthermore, the random-mixture algorithm cannot be adapted to different predictors that are not solutions, such as the ones mentioned above.
Algorithm Overview: Our Algorithm, shown in Algorithm 1, incorporates predictions in the
Display Ads Primal
$$
\max \sum_ {a, t} w _ {a t} x _ {a t}
$$
$$
\forall a \colon \sum_ {t} x _ {a t} \leq B _ {a}
$$
$$
\forall t \colon \sum_ {a} x _ {a t} \leq 1
$$
$$
\forall a, t: x _ {a t} \geq 0
$$
Display Ads Dual
$$
\min  \sum_ {a} B _ {a} \beta_ {a} + \sum_ {t} z _ {t}
$$
$$
\forall a, t: z _ {t} \geq w _ {a t} - \beta_ {a}
$$
$$
\forall a: \beta_ {a} \geq 0
$$
$$
\forall t: z _ {t} \geq 0
$$
Figure 1: Primal and dual of the Display Ads LP
Algorithm 1 Exponential Averaging with Predictions
1: Input: Robustness-consistency trade-off parameter  $\alpha \in [1,\infty)$ , advertiser budgets  $B_{a}\in \mathbb{N}$
2: Define the constants  $B \coloneqq \min_{a} B_{a}$ ,  $e_{B} \coloneqq \left(1 + \frac{1}{B}\right)^{B}$ , and  $\alpha_{B} \coloneqq B\left(e_{B}^{\alpha / B} - 1\right)$
3: For each advertiser  $a$ , initialize  $\beta_{a} \gets 0$  and allocate  $B_{a}$  zero-value impressions
4: for all arriving impressions  $t$  do
5:  $a_{(\mathrm{PRD})}\gets \mathrm{PRD}(t)$
6:  $a_{(\mathrm{EXP})}\gets \arg \max_a\{w_{at} - \beta_a\}$
7: if  $\alpha_{B}(w_{a_{(\mathrm{PRD})}t} - \beta_{a_{(\mathrm{PRD})}}) \geq w_{a_{(\mathrm{EXP})}t} - \beta_{a_{(\mathrm{EXP})}}$  then
8:  $a\gets a_{(\mathrm{PRD})}$
9: else
0:  $a\gets a_{(\mathrm{EXP})}$
1: end if
12: Allocate  $t$  to  $a$  and remove the least valuable impression currently assigned to  $a$ .
13: Let  $w_{1} \leq w_{2} \leq \dots \leq w_{B_{a}}$  be the values of impressions currently assigned to  $a$  in nondecreasing order
14: Update  $\beta_{a}\gets \frac{e^{\alpha / B_{a}} - 1}{e^{\alpha}_{B_{a}} - 1}\sum_{i = 1}^{B_{a}}w_{i}e^{\alpha (B_{a} - i) / B_{a}}$
15: end for
primal-dual algorithm of Feldman et al. (2009a). The algorithm is based on the primal and dual LP formulations in Figure 1. The algorithm constructs both a primal integral solution which is an allocation of impressions to advertisers as well as a dual solution, given explicitly by the dual variables  $\beta_{a}$ . Analogously to other algorithms with predictions, the algorithm takes as parameter the value  $\alpha$ ; a larger value of  $\alpha$  means that we trust the prediction more. Similarly to the worst-case algorithm of Feldman et al. (2009a), the dual variables  $\beta_{a}$  play an important role in the allocation of impressions. When an impression  $t$  arrives, we evaluate the discounted gain  $w_{at} - \beta_{a}$  for each advertiser. The worst-case algorithm allocates the impression to the advertiser  $a_{(\mathrm{EXP})}$  maximizing the discounted gain and only allocates if the discounted gain is positive, i.e. the value exceeds the threshold  $\beta_{a}$ . Our algorithm modifies this base algorithm to incorporate predictions as shown in Line 7 and it follows the prediction  $a_{(\mathrm{PRD})}$  if its discounted gain is a sufficiently high fraction of the discounted gain of  $a_{(\mathrm{EXP})}$ . We refer the reader to the discussion below for more intuition on the choice of update. After selecting the advertiser to which to allocate the impression  $t$ , we remove the least valuable impression currently assigned to  $a$  to make space for  $t$ , and then allocate  $t$  to  $a$ . Another crucial part of the algorithm is the update rule for  $\beta_{a}$  in Line 14, which is updated in a novel way based on the parameter  $\alpha$ . More precisely, we set  $\beta_{a}$  as an exponential averaging of the values of impressions currently allocated to  $a$ . Compared to the worst-case algorithm, we assign higher weight to impressions with less value which is essential for leveraging predictions.
To simplify the algorithm description and analysis, we initially allocate  $B_{a}$  impressions of zero value to each advertiser  $a$ . Furthermore, we assume that there exists a "dummy" advertiser with large budget that only receives zero value impressions. Instead of not allocating an impression explicitly (either in the algorithm or the prediction), we allocate to the dummy advertiser, instead.
Figure 2: We illustrate the consistency-robustness trade-off of Algorithm 1 for various values of  $\alpha$  and budgets  $B$ .
Intuition for our Algorithm: As noted above, we make two crucial modifications to the worst-case algorithm to incorporate predictions: The advertiser selection (Line 7) and the update of  $\beta_{a}$  (Line 14). We now provide intuition for both choices.
First, let us illustrate the difficulties in incorporating predictions in the advertiser selection. Based on the worst-case algorithm, a natural way to incorporate predictions is to allocate to the prediction if the distorted gain  $w_{a_{(\mathrm{PRD})}t} - \frac{1}{\alpha} \cdot \beta_{a_{(\mathrm{PRD})}}$  exceeds the maximum discounted gain. However, this approach does not work as shown by the following example: Consider a scenario where the prediction suggests a constant advertiser  $a_{(\mathrm{PRD})}$ . Impressions are split into two phases: Phase 1 contains  $B_{a_{(\mathrm{PRD})}}$  impressions  $t$  where only  $a_{(\mathrm{PRD})}$  can derive a value of  $w_{a_{(\mathrm{PRD})}t} = 1$  and  $w_{at} = 0$  for  $a \neq a_{(\mathrm{PRD})}$ . The algorithm allocates all these impressions to  $a_{(\mathrm{PRD})}$  and at the end of phase 1 has  $\beta_{a_{(\mathrm{PRD})}} = 1$ . In phase 2, a large amount of impressions with  $w_{a_{(\mathrm{PRD})}t} = 1$  and  $w_{at} = \frac{\alpha - 1}{2\alpha}$  for  $a \neq a_{(\mathrm{PRD})}$  arrive. Since the distorted gain  $w_{a_{(\mathrm{PRD})}t} - \frac{1}{\alpha}\beta_{a_{(\mathrm{PRD})}} = \frac{\alpha - 1}{\alpha}$  exceeds the discounted gain  $w_{at} - \beta_{a} = \frac{\alpha - 1}{2\alpha}$  for  $a \neq a_{(\mathrm{PRD})}$ , the algorithm allocates to  $a_{(\mathrm{PRD})}$  which yields 0 gain. However, we forfeit an unbounded amount of potential value derived from allocating to advertisers  $a \neq a_{(\mathrm{PRD})}$ . An important takeaway of this example is the crucial observation that the algorithm should never allocate to the predicted advertiser if its discounted gain is 0. The selection rule in our algorithm is designed to meet this important consideration.
Second, we need to change the update rule for  $\beta_{a}$ . We update  $\beta_{a}$  using a carefully selected exponential average of the values of impressions currently assigned to  $a$ , that incorporates our confidence in the prediction parameterized by  $\alpha$ . In contrast to the worst-case algorithm, we weigh less valuable impressions more. This lowers the threshold for the addition of new impressions, which allows us to exploit more potential gain from the predicted advertiser.
Theorem 1. Let  $B \coloneqq \min_{a} B_{a}$  and  $e_{B} \coloneqq \left(1 + \frac{1}{B}\right)^{B}$ . Let OPT and PRD be the values of the optimal and predicted solutions, respectively. For any  $\alpha \geq 1$ , Algorithm 1 obtains a value of at least
$$
\mathrm {A L G} \geq \max  \left\{R (\alpha) \cdot \operatorname {O P T}, C (\alpha) \cdot \operatorname {P R D} \right\}
$$
where the robustness is
$$
R (\alpha) := \frac {e _ {B} ^ {\alpha} - 1}{B e _ {B} ^ {\alpha} \left(e _ {B} ^ {\alpha / B} - 1\right)} \to \frac {e ^ {\alpha} - 1}{\alpha e ^ {\alpha}} (B \to \infty)
$$
and the consistency is
$$
\begin{array}{l} C (\alpha) := \left(1 + \frac {1}{e _ {B} ^ {\alpha} - 1} \max \left\{\frac {1}{\alpha_ {B}} \left(e _ {B} ^ {\alpha} - \frac {e _ {B} ^ {\alpha} - 1}{\alpha_ {B}}\right), \ln (e _ {B} ^ {\alpha}) \right\}\right) ^ {- 1} \\ \rightarrow \left(1 + \frac {1}{e ^ {\alpha} - 1} \max \left\{\frac {1}{\alpha} \left(e ^ {\alpha} - \frac {e ^ {\alpha} - 1}{\alpha}\right), \alpha \right\}\right) ^ {- 1} (B \rightarrow \infty). \\ \end{array}
$$
Figure 2 shows the above trade-off between consistency and robustness. We can observe that the guarantee rapidly improves as the minimum advertiser budget  $B$  increases, which is very beneficial both in theory and in practice. The trade-off is comparable to the one obtained by Mahdian et al. (2007) for the more structured Ad Words problem.
Comparison to Prior Work: The work most closely related to ours is the work of Mahdian et al. (2007) which incorporates predictions into the algorithm of Mehta et al. (2007). These works are for the related but different Ad Words problem, and do not apply to Display Ads and GAP. In the Ad Words problem, the value of an impression is equal to the price that the advertiser pays for it, i.e., the size of the impression in the budget constraint. In contrast, in Display Ads and GAP, the values and the sizes are independent of each other (e.g., in Display Ads an impression takes up 1 unit of space in the advertiser's budget but it can accrue an arbitrary value). Thus there is no longer any relationship between the total value/profit of the impressions and the amount of the advertiser's budget that has been exhausted. The Ad Words algorithms of Mehta et al. (2007); Mahdian et al. (2007) crucially rely on this relationship both in the algorithm and in the analysis. Due to the special structure of the problem, these algorithms do not dispose of impressions and consider only the fraction of the advertiser's budget that has been filled up in order to decide the allocation and to incorporate the prediction. Moreover, the algorithm and the analysis do not need to account for the loss incurred by disposing impressions. These crucial differences require a new algorithmic approach and analysis, which was given by Feldman et al. (2009a) using a primal-dual approach. Since we build on their framework as opposed to the work of Mehta et al. (2007), we also need a new approach for incorporating predictions, as described above in the intuition for our algorithm. Further, the primal-dual framework only helps in establishing the robustness but not the consistency of our algorithm, and we develop a novel combinatorial analysis for proving the consistency.
In the following, we outline the analysis of Algorithm 1 to prove Theorem 1. Specifically, we show separately that  $\mathrm{ALG} / \mathrm{OPT} \leq R(\alpha)$  (robustness) and  $\mathrm{ALG} / \mathrm{PRD} \leq C(\alpha)$  (consistency).
Notation: We denote with superscript  $(t)$  the value of variables after allocating impression  $t$ . E.g.  $a^{(t)}$  is the algorithm's choice of advertiser for impression  $t$  and  $\beta_{a}^{(t)}$  is the dual variable after allocating  $t$ . Let
$$
\mathbf {X} _ {a} := \left\{t: a ^ {(t)} = a \right\} \quad \text {a n d} \quad \mathbf {P} _ {a} := \left\{t: a _ {\text {(P R D)}} ^ {(t)} = a \right\}
$$