SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Algorithm 1 Online Optimization with RCL
Require:  $\lambda >0,\lambda_0\in (0,\lambda)$  , initial actions  $x_{1 - p:0}$  , expert algorithm  $\pi$  , and ML model  $h_W$  1: for  $t = 1,\dots ,T$    
2:Receive a set of contexts  $\{y_{\tau}|\tau \in \mathcal{D}_t^q\}$    
3:Get the expert's action  $x_{t}^{\pi}$  given its own history   
4:Get  $\tilde{x}_t = h_W$  ( $\tilde{x}_{t - p:t - 1},\{y_\tau |\tau \in \mathcal{D}_t^q\}$ )   
5: Choose  $x_{t} = \arg \min_{x\in \mathcal{X}_{t}}\frac{1}{2}\| x - \tilde{x}_{t}\|^{2}$  subject to the constraint (1) //Robustification
where  $\beta_{h}$  is the smoothness constant of the hitting cost in Assumption 1,  $L_{k}$  is the Lipschitz constant of  $\delta(x_{t - p:t - 1})$  in Assumption (2), and  $\lambda_0 \in (0,\lambda)$  with the optimum being  $\lambda_0 = \sqrt{1 + \lambda} - 1$  (Theorem 4.1). The computational complexity for projection into (1) is tolerable due to convexity.
The interpretation of  $H(x_{\tau}, x_{\tau}^{\pi})$  and  $G(x, x_{t - q:t - 1}, x_{t - q:t}^{\pi})$  is as follows. If RCL's action  $x_{\tau}$  deviates from the expert's action  $x_{\tau}^{\pi}$  at time  $\tau$  and the hitting cost is not known yet due to delayed  $y_{\tau}$ , then it is possible that RCL actually experiences a high but unknown hitting cost. In this case, to guarantee the worst-case robustness, we include an upper bound of the cost difference as the reservation cost such that  $f(x_{\tau}, y_{\tau}) - (1 + \lambda)f(x_{\tau}^{\pi}, y_{\tau}) \leq H(x_{\tau}, x_{\tau}^{\pi})$  regardless of the delayed  $y_{\tau} \in \mathcal{V}$ . If  $y_{\tau}$  has been revealed at time  $t$  (i.e.,  $\tau \in \mathcal{A}_t$ ), then we use the actual costs instead of the reservation cost. Likewise, by considering the expert's future actions as a feasible backup plan in the worst case, the reservation cost  $G(x, x_{t - p:t - 1}, x_{t - p:t}^{\pi})$  upper bounds the maximum possible difference in the future switching costs (up to future  $p$  steps) due to deviating from the expert's action at time  $t$ .
With  $H(x_{\tau},x_{\tau}^{\pi})$  and  $G(x,x_{t - q:t - 1},x_{t - q:t}^{\pi})$  as reservation costs in (1), RCL achieves robustness by ensuring that following the expert's actions in the future is always feasible, regardless of the delayed  $y_{t}$ . The online algorithm is described in Algorithm 1, where both the expert and ML model have the same online information  $\{y_{\tau}|\tau \in \mathcal{D}_t^q\}$  at time  $t$  and produce their own actions as advice to RCL.
We now present our main results on the cost bound of RCL, showing that RCL can indeed maintain the desired  $(1 + \lambda)$ -competitiveness against the expert  $\pi$  while exploiting the potential of ML predictions.
Theorem 4.1 (Cost bound). Consider a memory length  $p \geq 1$  and the maximum feedback delay of  $q \geq 0$ . Given a context sequence  $y = (y_{1},\dots ,y_{T})$ , let  $\mathrm{cost}(\tilde{x}_{1:T})$  and  $\mathrm{cost}(x_{1:T}^{\pi})$  be the costs of pure ML predictions  $\tilde{x}_{1:T}$  and expert actions  $x_{1:T}^{\pi}$ , respectively. For any  $\lambda > 0$ , by optimally setting  $\lambda_0 = \sqrt{1 + \lambda} - 1$ , the cost of RCL is upper bounded by
$$
\operatorname {c o s t} \left(x _ {1: T}\right) \leq \min  \left((1 + \lambda) \operatorname {c o s t} \left(x _ {1: T} ^ {\pi}\right), \left(\sqrt {\operatorname {c o s t} \left(\tilde {x} _ {1 : T}\right)} + \sqrt {\frac {\beta_ {h} + \alpha^ {2}}{2} \Delta (\lambda)}\right) ^ {2}\right), \tag {4}
$$
where  $\Delta (\lambda) = \sum_{i = 1}^{T}\left[\| \tilde{x}_t - x_t^\pi \| ^2 -\frac{2(\sqrt{1 + \lambda} - 1)^2}{(\beta_h + \alpha^2)}\cos t_t^\pi \right]^+$  in which  $cost_{t}^{\pi} = \left(\sum_{\tau \in \mathcal{D}_{t}^{q}}f(x_{\tau}^{\pi},y_{\tau})\right) + d(x_{t}^{\pi},x_{t - p:t - 1}^{\pi})$  is the total of revealed hitting costs and switching cost for the expert at time  $t$ ,  $\beta_{h}$  is the smoothness constant of the hitting cost (Assumption 1), and  $\alpha = 1 + \sum_{i = 1}^{p}L_{i}$  with  $L_{1}\ldots L_{p}$  being the Lipschitz constants in the switching cost (Assumption 2).
Theorem 4.1 is the first worst-case cost analysis for ML-augmented algorithms in a general SOCO setting with delayed hitting costs and multi-step switching costs. Its proof is available in the appendix and outlined here. We prove the competitiveness against the expert  $\pi$  based on our novel reservation cost  $H(x_{\tau},x_{\tau}^{\pi})$  and  $G(x_{t},x_{t - q:t - 1},x_{t - q:t}^{\pi})$  by induction. It is more challenging to prove the competitiveness against the ML prediction, because  $x_{t}$  implicitly depends on all the previous actions of ML predictions and expert actions up to time  $t$ . To address this challenge, we utilize a novel technique by first removing the dependency of  $x_{t}$  on the history. Then, we construct a new sufficient robustness constraint that allows an explicit expression of another robustified action, whose distance to the ML prediction  $\tilde{x}_t$  is an upper bound by the distance between  $x_{t}$  and  $\tilde{x}_t$  due to the projection of  $\tilde{x}_t$  into (1). Finally, due to the smoothness of the hitting cost function and the switching cost, the distance bound translates into the competitiveness of RCL against ML predictions.
The two terms inside the min operator in Theorem 4.1 show the tradeoff between achieving better competitiveness and more closely following ML predictions. To interpret this, we note that the first
term inside min operator shows  $(1 + \lambda)$ -competitiveness of RCL against the expert  $\pi$ , while the second term inside min operator shows RCL can also exploit the potential of good ML predictions. A smaller  $\lambda > 0$  means that we want to be closer to the expert for better competitiveness, while a larger  $\lambda > 0$  decreases the term  $\Delta(\lambda) = \sum_{i=1}^{T}\left[\|\tilde{x}_t - x_t^\pi\|^2 - \frac{2(\sqrt{1 + \lambda} - 1)^2}{(\beta_h + \alpha^2)}\mathrm{cost}_t^\pi\right]^+$  and hence makes RCL follow the ML predictions more closely.
The term  $\Delta (\lambda)$  in (4) essentially bounds the total squared distance between the actual online action and ML predictions. Intuitively, RCL should follow the ML predictions more aggressively when the expert does not perform well. This insight is also reflected in  $\Delta (\lambda)$  in Theorem 4.1. Concretely, when the expert  $\pi$  's total revealed  $cost_{t}^{\pi}$  is higher,  $\Delta (\lambda)$  also becomes smaller, pushing RCL closer to ML. On the other hand, when the expert's cost is lower, RCL stays closer to the better-performing expert for guaranteed competitiveness.
When  $\| \tilde{x}_t - x_t^\pi \| ^2$  is larger (i.e., greater discrepancy between the expert's action and ML prediction), it is naturally more difficult to follow both the expert and ML prediction simultaneously. Thus, given a robustness requirement of  $\lambda > 0$ , we see from  $\Delta(\lambda)$  that a larger  $\| \tilde{x}_t - x_t^\pi \| ^2$  also increases the second term in the min operator in Theorem 4.1, making it more difficult for RCL to exploit the potential of ML predictions. Moreover, deviating from the expert's action at one step can have impacts on the switching costs in future  $p$  steps. Thus, the memory length  $p$  creates some additional friction for RCL to achieve a low cost bound with respect to ML predictions: the greater  $p$ , the greater  $\alpha = 1 + \sum_{i=1}^{p} L_i$ , and hence the greater the second term in (4).
Robustness and consistency. It remains to show the worst-case competitiveness against the offline optimal algorithm  $OPT$ , which is typically performed for two extreme cases — when ML predictions are extremely bad and perfect — which are respectively referred to as robustness and consistency in the literature [1, 20, 22] and formally defined below.
Definition 4 (Robustness and consistency). The robustness of  $RCL$  is  $CR(\infty)$  if  $RCL$  is  $CR(\infty)$ -competitive against  $OPT$  when the ML's competitiveness against  $OPT$  is arbitrarily large (denoted as  $\tilde{CR} \rightarrow \infty$ ); and the consistency of  $RCL$  is  $CR(1)$  if  $RCL$  is  $CR(1)$ -competitive against  $OPT$  when the ML's competitiveness against  $OPT$  is  $\tilde{CR} = 1$ .
Robustness indicates the worst-case performance of RCL for any possible ML predictions, whereas consistency measures the capability of RCL to retain the performance of perfect ML predictions. In general, the tradeoff between robustness and consistency is unavoidable for online algorithms [20, 14, 46]. The state-of-the-art expert algorithm iROBD recently proposed in [26] has the best-known competitive ratio under the assumption of identical delays for each context (i.e.,  $\mathcal{D}_t^q = \{t - q\}$  — each context is delayed by  $q$  steps). The identical-delay model essentially ignores any other contexts  $y_{\tau}$  for  $\tau \in \{\tau \in \mathbb{N} | t - q + 1 \leq \tau \leq t\}$ . Thus, it is the worst case of a general  $q$ -step delay setting, whose competitive ratio is upper bounded by that of iROBD. Consequently, due to  $(1 + \lambda)$ -competitiveness against any expert  $\pi$  in Theorem 4.1, we immediately obtain a finite robustness bound for RCL by considering iROBD as the expert.
Nonetheless, even for the simplest SOCO setting with no feedback delay and a switching cost of  $d(x_{t},x_{t - 1}) = \frac{1}{2}\| x_{t} - x_{t - 1}\|^{2}$ , a recent study [14] has shown that it is impossible to simultaneously achieve 1-consistency and finite robustness. Consequently, in general SOCO settings, the finite robustness of RCL given any  $\lambda >0$  means the impossibility of achieving 1-consistency by following perfect ML predictions without further assumptions.
Despite this pessimistic result due to the fundamental challenge of SOCO, we find a sufficient condition that can overcome the impossibility, which is formalized as follows.
Corollary 4.1.1 (1-consistency and finite robustness). Consider  $iROBD$  as the exert  $\pi$ , whose competitive ratio against OPT is denoted as  $CR_{iROBD}$  [26]. If the expert's switching cost always satisfies  $d(x_t^\pi, x_{t-p:t-1}^\pi) \geq \epsilon > 0$  for any time  $t = 1, \dots, T$ , then by setting  $\lambda \geq \frac{|\mathcal{X}|^2(\alpha^2 + \beta_h)}{2\epsilon} + \sqrt{\frac{2|\mathcal{X}|^2(\alpha^2 + \beta_h)}{\epsilon}} \sim \mathcal{O}\left(\frac{1}{\epsilon}\right)$  and optimally using  $\lambda_0 = \sqrt{1 + \lambda} - 1$ , RCL achieves  $(1 + \lambda) \cdot CR_{iROBD}$ -robustness and 1-consistency simultaneously.
Corollary 4.1.1 complements the impossibility result for SOCO [14] by providing the first condition under which finite robustness and 1-consistency are simultaneously achievable. The intuition is that if the expert has a strictly positive switching cost no less than  $\epsilon >0$  at each time, then its per-step
cost is also no less than  $\epsilon$ , which provides RCL with the flexibility to choose a different action than the expert's action  $x_{t}^{\pi}$  due to the  $(1 + \lambda)$  cost slackness in the competitiveness requirement. Therefore, by choosing a sufficiently large but still finite  $\lambda \sim \mathcal{O}\left(\frac{1}{\epsilon}\right)$ , we can show that  $\Delta (\lambda) = 0$  in (4) in Theorem 4.1, which means RCL can completely follow the ML predictions. Without this condition, it is possible that the expert's cost is zero in the first few steps, and hence RCL must follow the expert's actions at the beginning to guarantee  $(1 + \lambda)$ -competitiveness in case the expert continues to have a zero cost in the future — even though ML predictions are perfect and offline optimal, RCL cannot follow them at the beginning because of the online process and  $(1 + \lambda)$ -competitiveness requirement.
Importantly, our sufficient condition is not unrealistic in practice. For example, in moving object-tracking applications, the condition  $d(x_{\tau}^{\pi}, x_{\tau - p; \tau - 1}^{\pi}) \geq \epsilon > 0$  is satisfied if the expert's action  $\tilde{x}_t$  keeps changing to follow the moving object over time or alternatively, we ignore the dummy time steps with no movement.
4.3 ML Model Training in RCL
We present the training details and highlight the advantage of training the ML model in a robustification-aware manner to reduce the average cost.
4.3.1 Architecture, loss, and dataset
Because of the recursive nature of SOCO and the strong representation power of neural networks, we use a recurrent neural network with each base model parameterized by  $W \in \mathcal{W}$  (illustrated in Fig. 1 in the appendix). Such architectures are also common in ML-based optimizers for other online problems [17, 31]. With historical data available, we can construct a training dataset  $S$  that contains a finite number of problem instances. The dataset can also be enlarged using data augmentation techniques (e.g., adding adversarial samples) [16, 17].
Robustification-oblivious. The existing literature on ML-augmented algorithms [22, 1, 45, 7] has commonly assumed that the ML model  $h_W$  is separately trained in a robustification-oblivious manner without being aware of the downstream algorithm used online. Concretely, the parameter  $W$  of a robustification-oblivious ML model is optimized for the following loss
$$
W ^ {*} = \arg \min  _ {W \in \mathcal {W}} \frac {1}{| \mathcal {S} |} \sum_ {\mathcal {S}} \operatorname {c o s t} \left(\tilde {x} _ {1: T}\right), \tag {5}
$$
where  $\tilde{x}_t = h_W$  ( $\tilde{x}_{t - p:t - 1},\{y_{\tau}|\tau \in \mathcal{D}_t^q\}$ ) is the ML prediction at time  $t$ .
Robustification-aware. There is a mismatch between the actual objective  $\mathrm{cost}(x_{1:T})$  and the training objective  $\mathrm{cost}(\tilde{x}_{1:T})$  of a robustification-oblivious ML model. To reconcile this, we propose to train the ML model in a robustification-aware manner by explicitly considering the robustification step in Algorithm 1. For notational convenience, we denote the actual action as  $x_{t} = \mathsf{Rob}_{\lambda}(h_{W}) = \mathsf{Rob}_{\lambda}(\tilde{x}_{t})$ , which emphasizes the projection of  $\tilde{x}_t$  into the robust action set (2). Thus, the parameter  $W$  of a robustification-aware ML model is optimized to minimize the following loss
$$
\hat {W} ^ {*} = \arg \min  _ {W \in \mathcal {W}} \frac {1}{| \mathcal {S} |} \sum_ {\mathcal {S}} \operatorname {c o s t} \left(\operatorname {R o b} _ {\lambda} \left(\tilde {x} _ {1: T}\right)\right), \tag {6}
$$
which is different from (5) that only minimizes the cost of pre-robustification ML predictions.
4.3.2 Average cost
We bound the average cost of RCL given an ML model  $h_W$ .
Theorem 4.2 (Average cost). Assume that the ML model is trained over a dataset  $S$  drawn from the training distribution  $\mathbb{P}_y^\prime$ . With probability at least  $1 - \delta, \delta \in (0,1)$ , the average cost  $\mathbb{E}_y$  [cost  $(x_{1:T})]$  of RCL over the testing distribution  $y \sim \mathbb{P}_y$  is upper bounded by
$$
\overline {{c o s t}} (R C L) \leq \min  \left\{(1 + \lambda) \overline {{c o s t}} (\pi), \overline {{c o s t}} _ {\mathcal {S}} (\operatorname {R o b} _ {\lambda} (h _ {W})) + \mathcal {O} \left(\operatorname {R a d} _ {\mathcal {S}} (\operatorname {R o b} _ {\lambda} (\mathcal {W})) + \sqrt {\frac {\log \left(\frac {2}{\delta}\right)}{| \mathcal {S} |}}\right) \right\},
$$
where  $\overline{\text{cost}}_{\mathcal{S}}(\mathsf{Rob}_{\lambda}(h_W)) = \frac{1}{|S|}\sum_{\mathcal{S}}\text{cost}(x_{1:T})$  is the empirical average cost of robustified ML predictions in  $\mathcal{S}$ ,  $\operatorname{Rad}_{\mathcal{S}}(\mathsf{Rob}_{\lambda}(\mathcal{W}))$  defined in Definition 5 in the appendix is the Rademacher
complexity with respect to the ML model space parameterized by  $\mathcal{W}$  with robustification on the training dataset  $\mathcal{S}$ , the scaling coefficient inside  $\mathcal{O}$  for  $\mathrm{Rad}_S(\mathrm{Rob}_\lambda (\mathcal{W}))$  is  $\Gamma_x = \sqrt{T} |\mathcal{X}| \left[ \beta_h + \frac{1}{2} (1 + \sum_{i=1}^p L_i)(1 + \sum_{i=1}^p L_i) \right]$  with  $|\mathcal{X}|$  being the size of the action space  $\mathcal{X}$  and  $\beta_h, L_i$ , and  $p$  as the smoothness constant, Lipschitz constant of the nonlinear term in the switching cost, and the memory length as defined in Assumptions 1 and 2, and the coefficient for  $\sqrt{\frac{\log\left(\frac{2}{\delta}\right)}{|S|}}$  is  $3\bar{c}$  with  $\bar{c}$  being the upper bound of the total cost for an episode.
Theorem 4.2 bounds the average cost of RCL by the minimum of two bounds. The first bound  $(1 + \lambda)\overline{cost}(\pi)$  further highlights the guaranteed  $(1 + \lambda)$ -competitiveness of RCL with respect to the expert's average cost  $AVG(\pi)$ . The second bound includes a term  $\overline{cost}_S(\mathsf{Rob}_{\lambda}(h_W)) = \frac{1}{|\mathcal{S}|}\sum_{\mathcal{S}}\text{cost}(x_{1:T})$ , which is the empirical average cost of RCL given an ML model  $h_W$  and decreases when  $\lambda > 0$  increases. The reason is that with a larger  $\lambda > 0$ , the robust action set (1) is enlarged and RCL has more freedom to follow ML predictions due to the less stringent competitiveness constraint. Given an ML model  $h_W$ , Theorem 4.1 shows how the upper bound on  $\overline{cost}_S(\mathsf{Rob}_{\lambda}(h_W))$  varies with  $\lambda$ . Note that  $h_{W^*}$  in (5) and  $h_{\hat{W}^*}$  in (6) minimize  $\overline{cost}_S(h_{W^*})$  and  $\overline{cost}_S(\mathsf{Rob}_{\lambda}(h_{\hat{W}^*}))$ , respectively, while the post-robustication cost (i.e.,  $\overline{cost}_S(\mathsf{Rob}_{\lambda}(h_{\hat{W}^*}))$ ) is the actual cost of RCL. Thus, we can further reduce the average cost by using the optimal robustification-aware ML model  $h_{\hat{W}^*}$ , compared to a robustification-oblivious model  $h_{W^*}$ .
The other terms inside the second bound in (7) are related to the training dataset: the larger dataset, the smaller Rademacher complexity  $\mathrm{Rad}_S(\mathrm{Rob}(\mathcal{W}))$  and  $\sqrt{\frac{\log(1 / \delta)}{|S|}}$ . Note that the Rademacher complexity  $\mathrm{Rad}_S(\mathrm{Rob}(\mathcal{W}))$  of RCL is no greater than that of using the ML model alone (i.e.  $\mathrm{Rad}_S(\mathrm{Rob}(\mathcal{W})) \leq \mathrm{Rad}_S(\mathcal{W})$ , shown in the appendix). The intuition is that RCL limits the action space for robustness. Thus, Theorem 4.1 provides the insight that, given  $\lambda > 0$ , robustification in RCL is more valuable in terms of bounding the average cost when the ML model  $h_W$  is not well trained (e.g., due to inadequate training data). In practice, the hyperparameter  $\lambda > 0$  can be set to improve the empirical average performance subject to the robustness constraint based on a held-out validation dataset along with the tuning of other hyperparameters (e.g., learning rates).
4.3.3 Robustification-aware training and experimental verification
Despite the advantage in terms of the average cost, it is non-trivial to train a robustification-aware ML model using standard back-propagation. This is because the operator of projecting ML predictions into a robust set (1) is a recursive implicit layer that cannot be easily differentiated as typical neural network layers. Due to space limitations, we defer to the appendix the the differentiation of the loss function with respect to ML model weights  $W$ .
We validate the theoretical analysis by exploring the empirical performance of RCL using a case study of battery management in electric vehicle (EV) charging stations [47]. Our results are presented in the appendix. The results highlight the advantage of RCL in terms of robustness compared to pure ML models, as well as the benefit of using a robustification-aware ML model in terms of the average cost.
We now explore the performance of RCL using a case study focused on battery management in electric vehicle (EV) charging stations [48]. We first formulate the problem as an instance of SOCO. More details can be found at Appendix B.1. Then, we test RCL on a public dataset provided by ElaadNL, compared with several baseline algorithms including ROBD [26], EC-L2O [12], and HitMin (details in Appendix B.2). Our results highlight the advantage of RCL in terms of robustness guarantees compared to pure ML models, as well as the benefit of training a robustification-aware ML model in terms of the average cost.
We now present some results for the case in which the hitting cost function (parameterized by  $y_{t}$ ) is immediately known without feedback delay. The results for the case with feedback delay are presented in Appendix B.4. Throughout the discussion, the reported values are normalized with
RCL	RCL-O	ML	EC-L2O	ROBD	HitMin
λ=0.6	λ=1	λ=3	λ=5	λ=0.6	λ=1	λ=3	λ=5
AVG	1.4704	1.1144	1.0531	1.0441	1.4780	1.2432	1.0855	1.0738	1.0668	1.1727	1.6048	1.2003
CR	1.7672	1.2905	1.4405	1.3014	2.2103	2.4209	2.4200	3.0322	3.2566	2.0614	1.7291	2.0865
Table 1: Competitive ratio and average cost comparison of different algorithms.
respect to those of the respective OPT. The average cost (AVG) and competitive ratio (CR) are all empirical results reported on the testing dataset.
By Theorem 4.1, there is a trade-off (governed by  $\lambda >0$ ) between exploiting ML predictions for good average performance and following the expert for robustness. Here, we focus on the default setting of  $\lambda = 1$  and discuss the impact of different choices of  $\lambda$  on both RCL and RCL-0 in Appendix B.3.2. As shown in Table 1, with  $\lambda = 1$ , both RCL and RCL-0 have a good average cost, but RCL has a lower average cost than RCL-0 and is outperformed only by ML in terms of the average cost. RCL and RCL-0 have the same competitive ratio (i.e.,  $(1 + \lambda)$  times the competitive ratio of ROBD). Empirically, RCL has the lowest competitive ratio among all the other algorithms, demonstrating the practical power of RCL for robustifying, potentially untrusted, ML predictions. In this experiment, RCL outperforms ROBD in terms of the empirical competitive ratio because it exploits the good ML predictions for those problem instances that are adversarial to ROBD. This result complements Theorem 4.1, where we show theoretically that RCL can outperform ROBD in terms of the average cost by properly setting  $\lambda$ . By comparison, ML performs well on average by exploiting the historical data, but has the highest competitive ratio due to its expected lack of robustness. The two alternative baselines, EC-L2O and HitMin, are empirically good on average and also in the worst case, but they do not have guaranteed robustness. On the other hand, ROBD is very robust, but its average cost is also the worst among all the algorithms under consideration.
More results, including using HitMin as the expert and large distributional shifts, are available in Appendix B.3.
We have considered a general SOCO setting (including multi-step switching costs and delayed hitting costs) and proposed RCL, which ensures a worst-case performance bound by utilizing an expert algorithm to robustify untrusted ML predictions. We prove that RCL is able to guarantee  $(1 + \lambda)$ -competitive against any given expert for any  $\lambda > 0$ . Additionally, we provide a sufficient condition that achieves finite robustness and 1-consistency simultaneously. To improve the average performance, we explicitly train the ML model in a robustification-aware manner by differentiating the robustification step, and provide an explicit average cost bound. Finally, we evaluate RCL using a case study of battery management for EV stations, which highlights the improvement in both robustness and average performance compared to existing algorithms.