---
title: Best-of-Both-Worlds Algorithm
url: https://www.emergentmind.com/topics/best-of-both-worlds-bobw-algorithm
type: topic
---

# Best-of-Both-Worlds Algorithm

Searching arXiv for the primary and related Best-of-Both-Worlds papers.
Best-of-Both-Worlds (BoBW) algorithms are procedures designed to secure two guarantees simultaneously that are usually in tension. In fair division, the aim is to obtain a randomized allocation that is ex-ante fair while every realized allocation is also ex-post fair; in online learning and bandits, the aim is to achieve near-optimal performance in both stochastic and adversarial environments without prior knowledge of the regime. The term is therefore a cross-domain methodological label rather than a single universal procedure. One prominent instantiation is the fair-share allocation algorithm for indivisible goods with additive valuations, which computes in deterministic polynomial time a distribution over at most \(n\) allocations that is ex-ante proportional and ex-post gives every agent at least half of her truncated proportional share (TPS), hence at least half of her maximin share (MMS), while also satisfying proportionality up to one item (Prop1) [2102.04909]. Subsequent work has both extended and critiqued the BoBW paradigm in neighboring fair-division models and in sequential decision-making problems such as delayed bandits, heavy-tailed bandits, contextual bandits, and multi-dueling bandits [2209.03908], [2601.16579], [2505.24193], [2410.03284], [2603.18972].

## 1. Conceptual scope of the BoBW paradigm

In fair allocation of indivisible goods, BoBW refers to a distribution over deterministic allocations that is ex-ante fair and is supported only on allocations that satisfy an ex-post fairness relaxation or approximation. In the equal-entitlement additive setting, the basic ex-ante benchmark is proportional share,
\[
PS_i = v_i(M)/n,
\]
while ex-post benchmarks include envy-based relaxations such as EF1 or value-based guarantees such as a constant fraction of MMS [2102.04909]. The motivation is explicit: ex-ante proportionality can be achieved trivially by randomization, but such a distribution may be very unfair ex-post; BoBW mechanisms seek both guarantees at once [2601.16579].

The fair-share formulation of BoBW in [2102.04909] is built around four share notions. For agent \(i\) with additive valuation \(v_i\), the proportional share is \(PS_i=v_i(M)/n\), the maximin share is
\[
MMS_i = \max_{partitions\ M=P_1\cup\cdots\cup P_n}\min_k v_i(P_k),
\]
and the truncated proportional share \(TPS_i\) is the unique \(t\ge 0\) solving
\[
(1/n)\cdot\sum_{j\in M}\min\{v_i(j),t\}=t.
\]
The paper states that \(MMS_i \le TPS_i \le PS_i\) [2102.04909].

Across online learning, the same label denotes algorithms that are simultaneously strong in stochastic and adversarial regimes. Examples include delayed bandits with regret \(\widetilde O(\sqrt{KT}+\sqrt D)\) adversarially and instance-dependent stochastic regret matching known lower bounds up to logarithmic factors [2505.24193], parameter-free heavy-tailed multi-armed bandits [2410.03284], linear contextual bandits with \(O(\log T)\) stochastic and \(O(\sqrt T)\) adversarial guarantees [2403.03219], and multi-dueling bandits under Condorcet and Borda objectives [2603.18972]. This suggests that “BoBW algorithm” denotes a structural objective—simultaneous adaptation to two fairness or difficulty regimes—rather than a single canonical algorithm.

## 2. The fair-share BoBW algorithm for indivisible goods

The central fair-division result considers \(n\) agents with equal entitlements, additive valuations, and no transfers. The main theorem states that there exists a randomized allocation, that is, a distribution \(D\) over integral allocations, such that: for every agent \(i\), \(\mathbb E_{A\sim D}[v_i(A_i)] \ge PS_i\); for every realization \(A\) in the support and every \(i\), \(v_i(A_i)\ge \tfrac12\cdot MMS_i\) and \(v_i(A_i)\ge \tfrac12\cdot TPS_i\); and every \(A\) in the support also satisfies Prop1 [2102.04909]. The same paper emphasizes that prior BoBW mechanisms based on the “up to one item” paradigm may give agents only a \(\frac1n\) fraction of their MMS, and that the present algorithm is intended to guarantee a high ex-post value rather than merely an envy-based relaxation [2102.04909].

The theorem is constructive. It can be achieved in deterministic polynomial time by a distribution over at most \(n\) allocations \(X=(X^1,\dots,X^n)\) [2102.04909]. The distribution is computed via a polynomial-time procedure over fractional allocations, faithful rounding, and support reduction.

The guarantees are nearly best possible in two senses stated explicitly in the paper. First, one cannot guarantee agents more than their proportional share ex-ante. Second, one cannot guarantee agents more than a \(\frac{n}{2n-1}\) fraction of their TPS ex-post, so the \(\tfrac12\) constant is asymptotically tight [2102.04909].

## 3. Structure of the algorithm

The algorithm operates in four phases on a fractional allocation matrix \(X\in[0,1]^{n\times m}\) with row-sums \(\le 1\) and column-sums \(\le 1\), extending each \(v_i\) linearly [2102.04909].

| Phase | Main operation | Stated role |
|---|---|---|
| 1 | LP\(_1\) + faithful rounding | Handle “over-proportional” items |
| 2 | Maximum-weight perfect matching | Complete a matching for \(G_2\) on remaining real items |
| 3 | LP\(_3\) + faithful rounding | Allocate leftover items fractionally |
| 4 | LP\(_4\) | Support reduction to at most \(n\) allocations |

In Phase 1, the algorithm computes each agent’s \(TPS_i\) in poly-time by sorting \(v_i(j)\) and solving a one-variable equation. It then constructs an extended market \(M' = M \cup \{aux_i\}_i\) with unit-demand utilities
\[
u_i(j)=v_i(j)\ \text{if}\ v_i(j)\ge TPS_i,\ \text{else}\ 0;\qquad u_i(aux_i)=TPS_i,
\]
and \(u_i(aux_k\ne i)=0\). It solves LP\(_1\) to find a fractional perfect matching of these “demand clones,” maximizing \(\sum_i u_i\cdot X_i^*\) subject to \(u_i\cdot X_i^*\ge PS_i\), then faithfully implements \(X^*\) by decomposing into \(O(n)\) perfect matchings. Each agent either gets one “truly over-proportional” item \(j\) with \(u_i(j)\ge TPS_i\) or the fictitious item \(aux_i\). Agents who receive a real item form group \(G_1\); the others form \(G_2\) and temporarily hold nothing [2102.04909].

In Phase 2, with \(M_2=M\setminus\{\text{items assigned to }G_1\}\), the algorithm computes a maximum-weight perfect matching \(B^*\) in the bipartite graph \(G_2\times M_2\) with edge-weights
\[
w_i(j)=v_i(j)/(v_i(M_2)-\sum_{top\ |G_2|}v_i),
\]
so that every \(i\in G_2\) is matched to some \(j\) with \(v_i(j)<TPS_i\) but “as fair as possible.” After this step, each \(i\in G_2\) holds one item \(e_i\) [2102.04909]. The accompanying proposition states that in every partial allocation so far, each \(G_1\)-agent holds some \(j\) with \(v_i(j)\ge TPS_i\), and each \(G_2\)-agent holds \(e_i\) with \(v_i(e_i)\ge \max_{k\in M\setminus G_1} v_i(k)\) [2102.04909].

In Phase 3, the leftover items \(M_3=M\setminus\{\text{all currently held items}\}\) are allocated fractionally via LP\(_3\) so that every \(i\in G_2\) gets at least
\[
f_i\cdot v_i(M_3),\qquad
f_i = \frac{v_i(M_2)/|G_2| - v_i(e_i)}{v_i(M_2) - \text{sum of top-}|G_2|\text{ values}}.
\]
This fractional solution is then faithfully rounded in \(O(m)\) allocations. By design, each \(G_2\)-agent’s total ex-ante value from \(e_i\) plus the fractional share is at least \(TPS_i\), and ex-post she loses at most the value of one item, so either \(v_i \ge TPS_i-\max_j v_i(j)\ge TPS_i/2\) or she already has \(e_i\ge TPS_i/2\) [2102.04909].

In Phase 4, the resulting distribution of size \(\le 4n\cdot(m+1)\) is reweighted by solving LP\(_4\), preserving each agent’s ex-ante proportional value while using only \(n\) allocations in the support [2102.04909].

## 4. Guarantees, proof sketch, and tightness

The proof sketch in [2102.04909] isolates three guarantees. Ex-ante proportionality follows because LP\(_1\) ensures every agent’s \(u_i\)-value is at least \(PS_i\), and any agent sent to \(G_2\) is brought by Phases 2 and 3 up to at least \(TPS_i\ge PS_i\). Ex-post \(\tfrac12\cdot TPS\) holds because a \(G_1\)-agent receives \(j\) with \(v_i(j)\ge TPS_i\), whereas a \(G_2\)-agent either loses at most \(TPS_i/2\) in the rounding of LP\(_3\) or already has \(e_i\ge TPS_i/2\). Ex-post Prop1 follows because every realized allocation is a faithful implementation of a fractional LP solution that was PS-respecting, so up to one item each agent’s value is at least \(PS_i-\max_j v_i(j)\) [2102.04909].

The complexity statement is explicit. Each phase uses only polynomial-time subroutines: computing \(TPS_i\) by sorting and one-variable root-finding; solving LP\(_1\) and LP\(_3\) via any poly-time LP solver; maximum-weight bipartite matching in Phase 2; faithful implementation via Birkhoff–von Neumann decompositions in \(O(n+m)\) matches; and a small LP\(_4\) of size \(O(n)\). Overall running time is polynomial in \(n,m\) [2102.04909].

The impossibility statements are part of the characterization of the algorithm. If all valuations coincide, proportional share is best possible ex-ante, so no randomized mechanism can guarantee strictly more than \(PS_i\) ex-ante. Ex-post, one cannot do better than \(\frac{n}{2n-1}\cdot TPS_i\) even ignoring ex-ante proportionality, by considering \(2n-1\) identical goods. The paper also states an efficiency clash: no mechanism that is ex-ante fractionally Pareto-optimal can give each agent a constant fraction of MMS ex-post, so the result cannot be strengthened to require ex-ante fPO as well [2102.04909].

A later result for three additive agents pushes the ex-post fairness frontier much further in the few-agent case: there exists an ex-ante proportional distribution whose every allocation is Epistemic EFX (EEFX) and guarantees each agent at least \(\tfrac{9}{10}\) of her MMS, with support size at most six [2602.14668]. This does not supersede [2102.04909] in general \(n\), but it shows that much stronger BoBW fairness is possible for small numbers of agents.

## 5. Variants with entitlements and few-agent refinements

The equal-entitlement assumption in [2102.04909] is relaxed in “Best of Both Worlds: Agents with Entitlements” [2209.03908]. There, each agent \(i\) has a weight \(w_i>0\), normalized so \(\sum_i w_i=1\). The main theorem states that for additive valuations one can compute in strongly-polynomial time a lottery \(L=\sum_{h=1}^k \lambda_h\cdot Y^h\) over \(k=\mathrm{poly}(n,m)\) integral allocations such that the induced fractional allocation is ex-ante weighted stochastic-dominance envy-free (hence ex-ante weighted envy-free), and every support allocation satisfies weighted proportionality up to one good (WPROP1) and weighted transfer envy-free up to one good, denoted WEF(1,1) [2209.03908]. The construction uses Different-Speeds Eating (DSE) followed by the bihierarchy decomposition of Budish–Che–Kojima–Milgrom [2209.03908].

The same paper proves a tightness statement: no stronger ex-post WEF\((x,y)\)-guarantee with \(x+y<2\) is compatible with any ex-ante WEF lottery [2209.03908]. This is the weighted analogue of the impossibility phenomena seen in the equal-entitlement setting.

For two and three agents, [2602.14668] gives approximation schemes with stronger envy-based guarantees. For two agents and any \(\varepsilon>0\), there is an FPTAS that outputs a distribution which is ex-ante envy-free and ex-post EFX, while guaranteeing each agent at least a \((1-\varepsilon)\)-fraction of her MMS. For three agents, the paper presents an FPTAS preserving exact ex-ante proportionality when EEFX is dropped, and a separate FPTAS preserving EEFX while losing at most \(\varepsilon\) in the value-based guarantees [2602.14668]. A plausible implication is that the coarse \(\tfrac12\)-TPS barrier of the general construction is driven partly by the all-\(n\) setting rather than by a universal obstruction.

## 6. Critiques, alternative objectives, and the broader BoBW literature

A notable criticism of one natural BoBW heuristic appears in “On Best-of-Both-Worlds Fairness via Sum-of-Variances Minimization” [2601.16579]. That paper studies the optimization problem of minimizing \(\sum_i Var_i(D)\) subject to ex-ante proportionality. When valuations are identical, every SoV-minimizer is supported only on allocations whose value vector attains the minimum Euclidean distance to \((PS,\dots,PS)\), and all allocations in the support are EFX; consequently they guarantee \(2/3\)-MMS when \(n=3\) and \(4/7\)-MMS for \(n\ge 4\) [2601.16579]. However, when valuations are not identical, even with two agents and two goods, SoV-minimization can put positive mass on giving both goods to one agent, so the support allocation might not even be EF1 and might not give an agent any constant fraction of her MMS [2601.16579]. The same pathology extends to minimizing the maximum variance, the variance of \((Var_1,\dots,Var_n)\), the standard-deviation of \((\sigma_1,\dots,\sigma_n)\), and the sum of standard deviations [2601.16579].

Outside fair division, the BoBW label has become standard in online learning. In delayed bandits, Delayed-SAPO combines Basic Stochastic Checks, a successive-elimination style active set, and an Eliminated-Arms Processing subroutine to obtain adversarial regret \(\widetilde O(\sqrt{KT}+\sqrt D)\) and stochastic regret
\[
O\!\left(\sum_{i:\Delta_i>0}\frac{\ln T}{\Delta_i}+\frac1K\sum_{i=1}^K \Delta_i\,\sigma_{\max}\right),
\]
matching known lower bounds up to logarithmic factors [2505.24193]. In heavy-tailed multi-armed bandits, uniINF is described as the first parameter-free algorithm to achieve the BoBW property for the heavy-tailed MAB problem, with adversarial regret \(O(\sigma\cdot K^{1-1/\alpha}\cdot T^{1/\alpha})\) and stochastic guarantees that match lower bounds up to logarithmic factors [2410.03284]. In multi-dueling bandits, MetaDueling converts multi-way winner feedback into an unbiased pairwise signal, and when instantiated with Versatile-DB it achieves \(O(\sqrt{KT})\) pseudo-regret against adversarial preferences and \(O(\sum_{i\ne a^\star}\log T/\Delta_i)\) under stochastic preferences in the Condorcet setting [2603.18972].

These results do not define a single common algorithm. Rather, they instantiate a common design pattern: explicit mechanism design or online-learning structure is required to secure two guarantees at once. The negative results on variance minimization in fair division [2601.16579] and the positive constructive results in allocation [2102.04909], entitlements [2209.03908], delayed feedback [2505.24193], and heavy-tailed settings [2410.03284] jointly indicate that BoBW performance is typically not obtained by a black-box scalar objective; it is achieved by problem-specific combinatorial or FTRL-style constructions.

## 7. Significance and open directions

The fair-share BoBW algorithm of [2102.04909] established that ex-ante proportionality can be combined, in deterministic polynomial time, with ex-post Prop1 and a value guarantee of at least half of TPS and MMS. Within fair division, that result shifted BoBW analysis away from purely envy-based “up to one item” guarantees toward share-based ex-post guarantees. The introduction of TPS was especially consequential because the algorithm’s strongest ex-post guarantee is phrased with respect to TPS rather than merely MMS, and the paper states that \(MMS_i\le TPS_i\le PS_i\) [2102.04909].

Subsequent work shows two divergent directions. One direction strengthens the fairness side under more structured conditions: weighted entitlements via DSE and bihierarchy decomposition [2209.03908], and near-optimal guarantees for few agents using EEFX and FPTAS constructions [2602.14668]. The other direction identifies hard limits for simplistic formulations, as in the failure of sum-of-variances minimization under heterogeneous valuations [2601.16579]. This suggests that the enduring content of the BoBW idea is not a particular primitive but a program of simultaneous guarantees under incompatible desiderata.

A plausible implication is that future BoBW work in fair division will continue to separate by structural regime: equal versus unequal entitlements, few versus many agents, and envy-based versus share-based ex-post notions. The current literature already records impossibility frontiers—such as the \(\frac{n}{2n-1}\cdot TPS_i\) barrier ex-post in the equal-entitlement additive model [2102.04909] and the incompatibility between ex-ante WEF and stronger ex-post weighted envy relaxations when \(x+y<2\) [2209.03908]—alongside constructive frontiers such as \(\tfrac{9}{10}\)-MMS and EEFX for three agents [2602.14668]. Together, these results define the Best-of-Both-Worlds algorithm not as a monolithic object, but as a family of rigorously designed mechanisms whose common purpose is to reconcile ex-ante and ex-post guarantees, or stochastic and adversarial performance, within a single formally analyzable procedure.

Source: https://www.emergentmind.com/topics/best-of-both-worlds-bobw-algorithm