arXiv:2610.08134cs.DSOct 2026

Manuscript Offprint

arXiv:2610.08134

Almost Instance Optimal Sum and Moment Estimation Using Weighted Sampling

Anup Bhattacharya, Suryendu Mondal, Pinki Pradhan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We design an almost instance optimal algorithm for the sum estimation problem using weighted sampling. We show that the sample complexity for sum estimation is closely related to the ℓ2\ell_{2} norm of the weighted sampling distribution. We show an almost instance optimal lower bound for this problem as well. We also study the moment estimation problem and design an algorithm that has better instance-wise sample complexity bounds.

1 Introduction

Let A={a1,a2,…,an}A = \{a_1, a_2, \ldots, a_n\} be a set of nn elements, where element aia_i has a non-negative weight w(ai)w(a_i). Let W=∑a∈Aw(a)W = \sum_{a \in A} w(a) be the total weight of elements in AA. In our computational model, one does not get direct access to the weights of the elements in AA. Instead, one gets sample access to the elements of AA using an oracle. We assume access to an oracle that returns an element a∈Aa \in A with probability proportional to its weight w(a)w(a). That is, the oracle samples element ai∈Aa_i \in A with probability pi=w(ai)Wp_i = \frac{w(a_i)}{W}. Throughout, we refer to these samples as weighted samples or proportional samples. Our objective is to design an algorithm that computes a good estimate of WW using a sublinear number of queries to the oracle. Next, we formally define the sum estimation problem.

Definition 1.1. ((ϵ,δ)((\epsilon, \delta)-sum estimation) Given sample access to a set AA with nn weighted elements, and parameters ϵ,δ∈(0,1)\epsilon, \delta \in (0, 1), the objective is to obtain an estimate W^\hat{W} of W=∑a∈Aw(a)W = \sum_{a \in A} w(a) such that Pr⁡[∣W^−W∣>ϵW]≤δ\Pr[|\hat{W} - W| > \epsilon W] \leq \delta.

Our objective in this work is to design an algorithm that compues an (ϵ,δ)(\epsilon, \delta)-estimate of WW using a small number of queries to the oracle. Beretta and Tětek [BT24] showed that, in the worst case, obtaining an (ϵ,1/3)(\epsilon, 1/3)-estimate of WW requires Θ(nϵ)\Theta(\frac{\sqrt{n}}{\epsilon}) proportional samples. Their estimator crucially relies on observing a collision in the sample. Since, in the worst case, Ω(n)\Omega(\sqrt{n}) samples are needed to observe a collision for the uniform distribution, their algorithm has worst-case sample complexity of O(n/ϵ)O(\sqrt{n}/\epsilon). They also showed a matching lower bound of Ω(n/ϵ)\Omega(\sqrt{n}/\epsilon) samples for any

∗^{*}National Institute of Science Education and Research, Bhubaneswar, 752050, India

†^{\dagger}Homi Bhabha National Institute, Training School Complex, Anushakti Nagar, Mumbai, 400094, India

(ϵ,1/3)(\epsilon, 1/3)-estimate of the sum of the weights. While this sample complexity bound is optimal in the worst case, it might not capture the complexity of the problem on all input instances. In this work, we set out to design algorithms which have better sample complexity bounds on an instance to instance basis. Consider, for example, instances which have a small number of very large weights and the remaining weights are small. With high probability, one would observe a collision in the sampled set with much less number of samples for this instance. Hence, if detecting a collision is the key for an algorithm of this problem to work, then it might require considerably less number of samples compared to the worst-case bound of Ω(n/ϵ)\Omega(\sqrt{n}/\epsilon). This leads to our quest for designing an instance optimal algorithm for the sum estimation problem using weighted sampling. Let pp denote the proportional (weighted) sampling distribution for AA. It is known that the probability of observing a collision in the sample is related to the ℓ2\ell_2 norm ∥p∥2\|p\|_2 of the sampling distribution pp [BC17, SGW22, DGPP19]. We ask the following question in this work.