SlowGuess/NeurIPS_2023_OCR huggingface dataset:
be the impressions that were assigned to  $a$  and potentially disposed of, and the impressions that the prediction recommended for assignment to  $a$ , respectively. We set  $I_{a} \coloneqq |\mathbf{X}_{a}|$  and  $\ell_{a} \coloneqq |\mathbf{P}_{a} \cap \mathbf{X}_{a}|$  as the size of the overlap. Let also  $T$  be the last impression and  $\mathbf{S}_a$  is the final allocation, i.e., the  $B_{a}$  impressions allocated to  $a$  at the end of the algorithm. Finally, let ALG and PRD be the total value of the solution created by the algorithm and the prediction, respectively.
Robustness: Our proof for robustness closely follows the analysis in Feldman et al. (2009a) by using the primal-dual formulation of the problem, with some additional care that is needed not to violate dual feasibility whenever we follow the prediction. We defer the full proof to Appendix A.1.
Consistency: We now show the consistency, i.e. that PRD is bounded by a multiple of ALG. The complete analysis can be found in Appendix A.2, while we only give a high-level overview here.
A common approach in the analysis of online primal-dual algorithms is to employ a local analysis where, in each iteration, we relate the change in the value of the primal solution to the change in the dual solution (Buchbinder and Naor, 2009). However, it is not clear how to employ such a strategy in our setting due to the complications arising from our algorithm following a mixture of the worst-case and predicted solutions. We overcome this challenge using a novel global analysis that relates the final primal value to the prediction's value.
We now provide a high level overview of our global analysis. We start by noting that the objective value of our algorithm and the prediction is the sum of the impression values allocated to each advertiser, i.e.
$$
\mathrm {A L G} = \sum_ {a} \sum_ {t \in \mathbf {S} _ {a}} w _ {a t} \quad \text {a n d} \quad \mathrm {P R D} = \sum_ {a} \sum_ {t \in \mathbf {P} _ {a}} w _ {a t}
$$
However, note that PRD contains values of impression that do not appear in ALG since we ignore the prediction in some iterations, or already disposed of the impression. It is further unclear which advertiser to "charge" for an impression that does not agree with the prediction.
Consider an impression for which we followed the worst-case choice  $a_{(\mathrm{EXP})}$  that maximizes the discounted gain instead of the prediction. Due to our selection rule, the reason for this departure is
due to the discounted gains satisfying the following key inequality:
$$
w _ {a _ {\left(\mathrm {P R D}\right)}} \leq \frac {1}{\alpha_ {B}} \left(w _ {a _ {\left(\mathrm {E X P}\right)}} - \beta_ {a _ {\left(\mathrm {E X P}\right)}}\right) + \beta_ {a _ {\left(\mathrm {P R D}\right)}}. \tag {1}
$$
By using this important relationship, we upper bound the value PRD of the prediction using a linear combination of the values of impressions allocated by the algorithm (but possibly disposed of) and the thresholds. By grouping the impression values and dual variables by advertiser in the resulting upper bound, we are able to correctly charge each impression for which we deviated from the prediction to a suitable advertiser, thus overcoming one of the challenges mentioned above. To summarize, using (1) we obtain a bound  $\mathrm{PRD} \leq \sum_{a} \mathrm{PRD}_{a}$  where each  $\mathrm{PRD}_{a}$  is a linear combination of impression values and dual variables for advertiser  $a$ , and we want to compare this quantity to  $\mathrm{ALG}_{a} \coloneqq \sum_{t \in S_{a}} w_{at}$ .
Let us now consider a fixed advertiser  $a$ , and relate  $\mathrm{PRD}_a$  to  $\mathrm{ALG}_a$ . At this point, a key difficulty is that the amount  $\mathrm{PRD}_a$  that we charged to advertiser  $a$  involves the threshold  $\beta_{a}$ . By definition, the threshold is a convex combination of the values of the impressions in the algorithm's allocation. This gives us that  $\mathrm{PRD}_a$  is a linear combination of only the weights, but this cannot be readily compared to  $\mathrm{ALG}_a$  due to the complicated structure of the coefficients in the former. To bridge this gap, we show a useful structural property (Lemma 4) that gives us the following upper bound on  $\mathrm{PRD}_a$ : If we define  $t_i$  as the  $i$ -th impression allocated to  $a$ , we have
$$
\mathrm {P R D} _ {a} \leq \sum_ {i = I _ {a} - B _ {a} + 1} ^ {I _ {a} - \ell_ {a}} \phi_ {i} w _ {a t _ {i}} + \sum_ {i = I _ {a} - \ell_ {a} + 1} ^ {I _ {a}} \psi_ {i} w _ {a t _ {i}} + w _ {a t _ {I _ {a} - B _ {a}}} \Omega_ {a} \tag {2}
$$
for appropriate coefficients  $\phi_i$ ,  $\psi_i$ , and  $\Omega_a$ . The RHS of this inequality accounts for the value as follows: the first sum is for the impressions that agree with the prediction; the second sum is for the impressions that disagree with the prediction; the final term accounts for the values of all impressions that were disposed. As this is (almost) a linear combination over impression values that all appear in ALG (except  $w_{at_{I_a - B_a}}$ ), we could bound the ratio  $\mathrm{PRD}_a / \mathrm{ALG}_a$  by the maximum coefficient in (2). However, this does not lead to a constant competitive ratio. We therefore need a delicate analysis (Lemma 10) to balance the coefficients as uniformly as possible among all values, where we use properties of the coefficients  $\phi_i$ ,  $\psi_i$ , and  $\Omega_a$  and the structural property we derived in Lemma 4.
In Appendix B, we discuss how to generalize Algorithm 1 and its analysis to GAP, where impressions can take up arbitrary size  $u_{at}$  in the budget constraints. This generalization uses a gain  $w_{at} - u_{at}\beta_{a}$  that considers the size of each impression, and the comparison of the worst-case and predicted choices are updated correspondingly. We also change the update of  $\beta_{a}$  to consider the impression density  $w_{at} / u_{at}$ . We also note that our technique can be used to achieve a slight improvement in the guarantees, but we omit this in the interest of simplicity and conciseness.
We now evaluate the practical applicability of Algorithm 1. We use multiple baseline algorithms on different kinds of predictions, which we describe below. We showcase results on real-world and synthetic data, with further experimental results in Appendix C.
Algorithms: We compare Algorithm 1 to the random-mixture algorithm described in Section 2 (Random Mixture) and the worst-case algorithm without predictions due to Feldman et al. (2009a) (Worst-Case Baseline). Additionally, we consider two modifications of the worst-case algorithm: One allocates to the impression of maximum value (Greedy Baseline) and the other to the impression with maximum gain after disposal (Discounted Greedy Baseline).
Predictors: We consider variations of the following predictors. Recall that each predictor is a fixed allocation of impressions to advertisers that is revealed online.
(1) Optimum Solution (OPT): The optimum solution is obtained by solving the problem optimally offline using an LP solver. To evaluate our algorithm's robustness, we also consider a version of the optimum solution where a random  $p$ -fraction of the allocations has been corrupted. Under a random corruption, we corrupt by reallocating to randomly chosen advertisers. For a biased corruption, we sample a random permutation offline and corrupt by reallocating according to this permutation, generating a more adversarial corruption.
Figure 3: Experimental results on iPinYou (top) and Yahoo datasets (bottom) using different predictions for varying  $\alpha$ . The solid lines show our algorithm and the dashed lines the random-mixture algorithm. We run the algorithms 5 times and report average for both algorithms and the standard deviation only for our algorithm, to avoid clutter. For the robustness, the black line shows the performance of the worst-case algorithm without predictions due to Feldman et al. (2009a). For each predictor, we also include in parentheses the average competitive ratio over 5 runs (e.g. PreviousDay (0.66) indicates that the average competitive ratio for the solution of the Previous Day prediction was 0.66). We run the random-mixture algorithm for each prediction and  $q \coloneqq 1 / \alpha$ .
Figure 4: Performance of our algorithm on the iPinYou (top) and Yahoo (bottom) datasets for  $\alpha = 5$  with predictions of varying quality obtained as follows: We vary the sample fraction  $\epsilon \in [0,1]$  for the dual base algorithm and  $p\in [0,1]$  for random and biased corruptions. The prediction competitiveness is defined as PRD/OPT.
(2) Dual Base: We generate a solution using the algorithm of Devanur and Hayes (2009). Here, we sample the initial  $\epsilon$ -fraction of all impressions and optimally solve a scaled version of the dual LP to obtain the dual variables  $\{\beta_{a}\}_{a}$ . We get a primal allocation for all future impressions  $t$  by allocating to the advertiser  $a$  that maximizes the discounted gain  $w_{at} - \beta_{a}$ , but do not update  $\beta_{a}$ .
(3) Previous Day: We look at all impressions from the previous day and optimally solve the dual LP offline to obtain dual variables  $\{\beta_{a}\}_{a}$ . To get a prediction for today's impressions, we use the same algorithm as above and allocate to the advertiser maximizing the discounted gain.
Real-World Instances: We generate two instances for Display Ads based on the real-word datasets iPinYou (Zhang et al., 2014) and Yahoo (Yahoo, 2011).
Figure 5: Experimental results for varying values of  $\alpha$  on synthetic data with 12 advertisers and 2000 impressions of 10 types, where we report the same quantities as in Figure 3. We use different predictors with  $\sigma = 1.5$ . We conducted experiments with significantly more or less impressions, where we obtain similar results, and we therefore omit these.
(1) iPinYou: The iPinYou dataset contains real-time bidding data from the iPinYou online advertisement exchange. This dataset contains 40372 impressions over 7 days and 301 advertisers. Each advertiser places multiple bids for an impression. We use this bid data to construct the dataset. Specifically, we set the maximum of those bids as the advertiser's valuation. We assume a constant budget for each advertiser of 10 impressions as it makes for an interesting instance.
(2) Yahoo: We replicate the experimental setup of Lavastida et al. (2021) who generated an instance of online capacitated bipartite matching based on a Yahoo dataset (Yahoo, 2011). Capacitated online bipartite matching is a special case of Display Ads where all impression values are 1. Based on this dataset, we create an instance of capacitated online bipartite matching with around 2 million impressions and 16268 advertisers for 123 days. We defer the details to Section C.1.
Synthetic Instances: We obtain random synthetic data for a fixed set of  $T$  impressions and  $k$  advertisers as follows. We first generate a set of impression types, whereas each type is meant to model a group of homogeneous users (e.g. similar demographic or using similar keywords) and advertisers value users from the same group identically. We sample an advertiser's valuation for each impression type from an exponential distribution. To represent a full day of impressions, we assume that display times of impressions from a certain type are distributed according to a Gaussian with some uniformly random mean in [0, 1] and a fixed standard deviation  $\sigma$ . We then sample the same number of impressions from each type along with display times, and order them in increasing display time. Finally, we equip each advertiser with some fixed budget that makes for a difficult instance.
Results: Figure 3 and Figure 5 show results for real-world and synthetic instances, respectively. For each predictor, we show the consistency (left) and robustness (right) for varying  $\alpha$ . Figure 4 shows results for  $\alpha = 5$  with predictions of different quality, as described in the figure caption.
Discussion: We make several observations. On real-world instances, there is only a single prediction for which the performance of our algorithm drops below the worst-case algorithm, even for heavily corrupted predictions. E.g., on the iPinYou dataset, our algorithm is still able to leverage a prediction with a corruption rate as high as  $p = 50\%$ , and improve upon the worst-case algorithm (see the green and black lines in the top right plot of Figure 3). Moreover, for higher performing predictors, the improvement over the worst-case algorithm is significantly higher in both datasets. See for example, the Previous Day predictions on the iPinYou dataset (the purple and black lines in the top right plot of Figure 3) or Dual Base predictions on the Yahoo dataset (the orange and black lines in the bottom right plot of Figure 3). The increase in robustness is surprising as it does not follow the behavior of our theoretical bounds (cf. Figure 2) which hold against an adversarial prediction. This suggests that on real-world data, our algorithm is able to exploit "good suggestions" from the prediction while ignoring "bad suggestions". Second, as we can see in Figure 3, the consistency of our algorithm for predictors except the optimum is always above 1, and is significantly high for artificially corrupted predictions. The robustness of our algorithm remains high in almost all cases, even for the most heavily corrupted predictions (cf. the right side of Figure 4). On synthetic instances, we observe that our algorithm is robust against both random and biased corruption, as the robustness does not drop to the prediction's low competitiveness of  $\approx 0.7$ . Furthermore, our algorithm performs well in combination with the dual base prediction for  $\epsilon = 0.1$  (the orange line in Figure 5), even though the first 200 impressions are not representative of all impressions. On all instances, we clearly outperform the random-mixture algorithm which merely interpolates between the objective values of the worst-case algorithm and the prediction.
We introduce a novel algorithm with predictions for Display Ads and GAP with free disposal. Our algorithm is based on the primal-dual approach and can be efficiently implemented in practice. We show its robustness using the primal-dual method similar to Feldman et al. (2009a) and use a novel combinatorial proof to show its consistency. Finally, our experiments show the applicability of our algorithm, which is able to improve beyond the worst-case performance using readily available predictions. An interesting direction left open by our work is to understand the optimal trade-off between robustness and consistency for Display Ads and GAP. This challenging direction has been explored recently in the works (Jin and Ma, 2022; Wei and Zhang, 2020) for a related problem. Limitations: Our algorithm requires a strong prediction that is a solution to the problem. We leave weaker predictions, such as partial solutions or predictions of the supply, for future work.
FS and AE were supported in part by NSF CAREER grant CCF-1750333, NSF grant III-1908510, and an Alfred P. Sloan Research Fellowship.
Shipra Agrawal, Morteza Zadimoghaddam, and Vahab Mirrokni. Proportional allocation: Simple, distributed, and diverse matching with high entropy. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 99-108. PMLR, 10-15 Jul 2018. URL https://proceedings.mlr.press/v80/agrawal18b.html.
Niv Buchbinder and (Seffi) Joseph Naor. The design of competitive online algorithms via a primal: Dual approach. Found. Trends Theor. Comput. Sci., 3(2-3):93-263, feb 2009. ISSN 1551-305X. doi: 10.1561/0400000024. URL https://doi.org/10.1561/040000024.
Niv Buchbinder, Kamal Jain, and Joseph (Seffi) Naor. Online primal-dual algorithms for maximizing ad-auctions revenue. In Lars Arge, Michael Hoffmann, and Emo Welzl, editors, Algorithms - ESA 2007, pages 253-264, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg. ISBN 978-3-540-75520-3.
Justin Y. Chen and Piotr Indyk. Online bipartite matching with predicted degrees. CoRR, abs/2110.11439, 2021. URL https://arxiv.org/abs/2110.11439.
Nikhil Devanur and Thomas P. Hayes. The adwords problem: Online keyword matching with budgeted bidders under random permutations. In ACM Conference on Electronic Commerce. Association for Computing Machinery, Inc., January 2009.
Nikhil R. Devanur, Balasubramanian Sivan, and Yossi Azar. Asymptotically optimal algorithm for stochastic adwords. In Proceedings of the 13th ACM Conference on Electronic Commerce, EC '12, page 388-404, New York, NY, USA, 2012. Association for Computing Machinery. ISBN 9781450314152. doi: 10.1145/2229012.2229043. URL https://doi.org/10.1145/2229012.2229043.
Jon Feldman, Nitish Korula, Vahab S. Mirrokni, S. Muthukrishnan, and Martin Pál. Online ad assignment with free disposal. In Workshop of Internet Economics (WINE), pages 374-385, 2009a.
Jon Feldman, Aranyak Mehta, Vahab Mirrokni, and S. Muthukrishnan. Online stochastic matching: Beating 1-1/e. In 2009 50th Annual IEEE Symposium on Foundations of Computer Science, pages 117-126, 2009b. doi: 10.1109/FOCS.2009.72.
Jon Feldman, Monika Henzinger, Nitish Korula, Vahab S. Mirrokni, and Cliff Stein. Online stochastic packing applied to display ad allocation. In Mark de Berg and Ulrich Meyer, editors, Algorithms - ESA 2010, pages 182-194, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. ISBN 978-3-642-15775-2.
We will need the following helper Lemma in the proofs of consistency and robustness.
Lemma 2. Recall that  $e_B \coloneqq \left(1 + \frac{1}{B}\right)^B$  and  $\alpha_B \coloneqq B\left(e_B^{\alpha /B} - 1\right)$ . We have
1.  $e_B \leq e_{B_a}$  and
2.  $\alpha_{B} \geq \alpha_{B_{a}}$ .
Proof. It is well known that  $e_B$  converges to  $e$  from below for  $B \to \infty$ . Furthermore, we can show that  $\alpha_B$  is decreasing in  $B$  for all  $\alpha \geq 1$  by taking the derivative
$$
\begin{array}{l} \frac {\partial}{\partial B} \alpha_ {B} = \left(1 + \frac {1}{B}\right) ^ {\alpha} - 1 - \frac {\alpha}{B} \left(1 + \frac {1}{B}\right) ^ {\alpha - 1} = \left(1 + \frac {1}{B}\right) ^ {\alpha - 1} \left(1 + \frac {1}{B} (1 - \alpha)\right) - 1 \\ \leq \left(1 + \frac {1}{B}\right) ^ {\alpha - 1} \left(1 + \frac {1}{B}\right) ^ {1 - \alpha} - 1 = 0 \\ \end{array}
$$
where the bound follows from Bernoulli's inequality, which states that  $1 + rx \leq (1 + x)^r$  for  $x \geq -1$  and  $r \in \mathbb{R} \setminus (0, 1)$ .
A.1 Proof of Theorem 1 (Robustness)
We write  $P$  and  $D$  to denote the objective value of the primal and dual solutions, i.e.  $P = \sum_{a} \sum_{t \in \mathbf{S}_{a}} w_{at}$  and  $D = \sum_{a} B_{a} \beta_{a} + \sum_{t} z_{t}$  where  $z_{t}$  is specified in the following proof to ensure feasibility. We can show that after the allocation of each impression  $t$ ,
$$
\Delta P \geq \frac {e _ {B} ^ {\alpha} - 1}{B e _ {B} ^ {\alpha} \left(e _ {B} ^ {\alpha / B} - 1\right)} \Delta D
$$
where  $\Delta P$  and  $\Delta D$  are the increase in the primal and dual solution values, respectively. Since we create feasible primal and dual solutions, this is sufficient to bound the robustness due to weak duality. There is one main difference to Feldman et al. (2009a): In their algorithm, setting the dual variable  $z_{t}$  to  $w_{a_{(\mathrm{EXP})}t} - \beta_{a}$  ensures dual feasibility as  $a_{(\mathrm{EXP})}$  is the advertiser with maximum discounted gain. However, in order not to violate dual feasibility when following the prediction, we need to increase the dual variables  $z_{t}$  by a factor of  $\alpha_{B}$ . Note that for  $\alpha = 1$ , this recovers the competitiveness obtained by Feldman et al. (2009a).
Proof. Consider an iteration where we assign an impression  $t$  to advertiser  $a$  and let  $w_{1} \leq w_{2} \leq \dots \leq w_{B_{a}}$  be the values of impressions currently allocated to  $a$  in non-decreasing order. Let  $w_{0}$  be the least valuable of the impressions allocated to  $a$  at the end of iteration  $t - 1$ , i.e. the impression that is removed to make space for  $t$ . Assume that after allocating impression  $t$  to  $a$ , it becomes the  $k$ -th least valuable impression allocated to  $a$  with value  $w_{at} = w_{k}$ . Thus, using that  $w_{i} \geq w_{i - 1}$ , we can bound
$$
\begin{array}{l} \beta_ {a} ^ {(t - 1)} = \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(\sum_ {i = 0} ^ {k - 1} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i - 1) / B _ {a}} + \sum_ {i = k + 1} ^ {B _ {a}} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i) / B _ {a}}\right) \\ = \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(\sum_ {i = 0} ^ {B _ {a} - 1} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i - 1) / B _ {a}} + \sum_ {i = k + 1} ^ {B _ {a}} \left(w _ {i} - w _ {i - 1}\right) e _ {B _ {a}} ^ {\alpha (B _ {a} - i) / B _ {a}}\right) \\ \geq \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(\sum_ {i = 0} ^ {B _ {a} - 1} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i - 1) / B _ {a}}\right) =: \hat {\beta} _ {a} ^ {(t - 1)} \\ \end{array}
$$
which is tight when impression  $t$  becomes the most valuable impression assigned to  $a$ . We can now write  $\beta_{a}^{(t)}$  as a function of the bound  $\hat{\beta}_{a}^{(t - 1)}$ :
$$
\beta_ {a} ^ {(t)} = \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \sum_ {i = 1} ^ {B _ {a}} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i) / B _ {a}}
$$
$$
\begin{array}{l} = \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(\sum_ {i = 0} ^ {B _ {a} - 1} w _ {i} e _ {B _ {a}} ^ {\alpha (B _ {a} - i) / B _ {a}} + w _ {B _ {a}} - w _ {0} e _ {B _ {a}} ^ {\alpha}\right) \\ = \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} e _ {B _ {a}} ^ {\alpha / B _ {a}} \sum_ {i = 1} ^ {B _ {a}} w _ {i - 1} e _ {B _ {a}} ^ {\alpha (B _ {a} - i) / B _ {a}} + \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(w _ {B _ {a}} - w _ {0} e _ {B _ {a}} ^ {\alpha}\right) \\ = e _ {B _ {a}} ^ {\alpha / B _ {a}} \hat {\beta} _ {a} ^ {(t - 1)} + \frac {e _ {B _ {a}} ^ {\alpha / B _ {a}} - 1}{e _ {B _ {a}} ^ {\alpha} - 1} \left(w _ {B _ {a}} - w _ {0} e _ {B _ {a}} ^ {\alpha}\right). \\ \end{array}
$$
We set  $z_{t} \coloneqq \alpha_{B}\left(w_{B_{a}} - \beta_{a}^{(t - 1)}\right)$  which is feasible as the discounted value  $w_{at} - \beta_{a}^{(t - 1)}$  of the chosen advertiser  $a$  may only be  $\alpha_{B}$ -times less the maximum discounted value  $w_{a(\mathrm{EXP})t} - \beta_{a(\mathrm{EXP})}^{(t - 1)}$  due to the advantage of the predicted advertiser. This yields a dual increase of