Online Knapsack with Frequency Predictions

Sungjin Im, Ravi Kumar, Mahshid Montazer Qaem, Manish Purohit

Overview

This paper tackles the classic online knapsack problem by augmenting it with "weak" machine-learned predictions—specifically, lower and upper bounds on the frequency of items of each value. The authors introduce the SENTINEL algorithm, which abandons traditional threshold-based approaches to achieve the mathematically optimal competitive ratio for any given prediction range, significantly outperforming classic worst-case algorithms.

The Problem: Uncertainty in Online Knapsack

In the classic online knapsack problem, an algorithm must irrevocably decide whether to accept or reject items arriving one by one, aiming to maximize total value without exceeding a fixed capacity constraint. Because the algorithm cannot see the future, traditional worst-case analysis yields highly pessimistic guarantees (such as those seen in the classic ZCL algorithm).

Recently, "learning-augmented" algorithms have used machine learning predictions to improve these guarantees. However, most prior work assumes the ML model provides highly specific, exact predictions (e.g., exact arrival times). This paper asks: What if our predictions are weak and uncertain?

Instead of exact numbers, the algorithm is only given a reliable range (a lower and upper bound) for the total size of items of each specific value that will arrive. The challenge is to design an algorithm that exploits this loose structural knowledge to perform well, while still maintaining worst-case guarantees if the actual sequence is adversarial within those bounds.

The SENTINEL Algorithm

The authors model the problem as Continuous-Valued Online Knapsack with Frequency Predictions and introduce a novel algorithm called SENTINEL.

Historically, online knapsack algorithms rely on a threshold function: as the knapsack fills up, the algorithm raises the minimum value required to accept an item. The authors prove a major theoretical shift: no pure threshold-based algorithm can achieve the optimal competitive ratio when given frequency predictions.

Instead, SENTINEL uses a budget-based approach:

  1. Pre-computation: Based on the predicted lower and upper bounds, SENTINEL calculates a specific capacity budget $b_v$ for every possible item value $v$.
  2. The Sentinel Invariant: It maintains a cumulative budget $B_v$ (the sum of budgets for all values up to $v$). When an item of value $v$ arrives, SENTINEL accepts it only if the total size of all currently accepted items with value $\le x$ is strictly less than $B_x$ for all $x \ge v$.
  3. Intuition: The cumulative budget acts as a "sentinel." By knowing the lower bounds of high-value items yet to come, the algorithm mathematically reserves exactly enough space for them, preventing low-value items from greedily consuming the knapsack.

The authors also extend their methodology to two related problems: Generalized One-Way Trading and a newly introduced Two-Stage Online Knapsack (where rejected items can be accepted after all items have arrived, but at a discounted value).

Key Insights and Results

  • Weak predictions are highly actionable: You don't need to know exactly what the future holds. Simply knowing "we will see between X and Y amount of value V" is enough to drastically bypass the pessimistic worst-case bounds of classic online algorithms.
  • Provable Optimality: SENTINEL is not a heuristic. The authors provide a rigorous adversarial proof showing that no algorithm (deterministic or randomized) can achieve a better competitive ratio than SENTINEL for a given set of frequency predictions.
  • Theoretical Guarantee: SENTINEL achieves an optimal competitive ratio $\alpha^*$ (minus a negligible additive loss related to the maximum size of a single item).

To empirically validate the theoretical bounds, the paper relies on synthetic datasets where actual item frequencies are sampled within predicted bounds and arrive in a random order. SENTINEL consistently and significantly outperforms the classic worst-case ZCL algorithm.

Competitive ratio vs. prediction looseness
  • Robustness to Looseness: As shown in the figure above, even when the prediction bounds are very loose (e.g., $\delta = 2$, meaning the upper bound is 3x the lower bound), SENTINEL maintains a competitive ratio above 0.8. In contrast, classic algorithms like ZCL hover around 0.2 to 0.3 for similar value ranges.

Limitations and Future Work

  • Fractional/Small Item Assumption: The theoretical optimality relies on a continuous relaxation where items are infinitesimally small (or can be accepted fractionally). In discrete scenarios with larger items, this introduces a small additive loss to the competitive ratio.
  • Synthetic Evaluation: The experiments are purely synthetic and designed to test the bounds of the math. Testing SENTINEL on real-world datasets (like historical ad-auction bids or cloud spot-instance pricing) would be a valuable next step.
  • Future Directions: The authors suggest applying this "weak prediction" framework (using ranges instead of point estimates) to other classic online algorithms, such as caching, scheduling, or matching.

Summary updated

BibTeX
@inproceedings{im2021online,
  author = {Sungjin Im and Ravi Kumar and Mahshid Montazer Qaem and Manish Purohit},
  title = {{Online Knapsack with Frequency Predictions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
}
Figure