Algorithm Search⌘K

Algorithmcore

All-pay auction

Also called all-pay contest.

Each bidder submits one sealed bid, the highest bid wins, and every bidder pays its bid, win or lose. It models contests, lobbying and races in which effort is spent before the winner is known.

Time
O(n) worst
Space
O(n) extra
Where
n = the number of bidders
Properties
comparison baseddeterministiciterative
Origin
Arye L. Hillman, John G. Riley, Michael R. Baye, Dan Kovenock, Casper G. de Vries, 1989

In an all-pay auction every bidder submits one sealed bid, the highest bid wins the item, and every bidder pays its own bid, also the losers. It models situations in which effort or money is spent before the winner is known: lobbying for a license, a race for a patent, a sports tournament or a crowdsourcing contest. With independent private values the revenue equivalence theorem applies, so the all-pay auction earns the same expected revenue as the first-price auction and the Vickrey auction, and its equilibrium bid can be read off from the Vickrey payments. With known values it has no pure equilibrium, and the bidders mix.

In plain words

Everyone writes a price in an envelope. The highest price wins the item, but everyone pays what they wrote, also those who lose. So a bid is a cost you pay for sure, in return for a chance to win. A bidder with a low value bids very little, because it will almost always lose and pay for nothing. A bidder with a high value bids more, because it will often win. When the values are private and the bidders are alike, the seller gets on average the same amount as in the usual auctions. When everyone knows the values, there is no safe bid: any fixed bid invites a rival to bid just above it, so the bidders choose their bids at random.

The problem

One prize is given to one of nn bidders. Bidder ii has a value viv_i for the prize and quasilinear utility: vi−biv_i - b_i if it wins and −bi-b_i if it loses, where bi≥0b_i \ge 0 is its bid. The auction receives the bids and must name the winner and the payments, with the rule that the highest bid wins and all bids are paid. The strategic question is how to bid: at a Bayes-Nash equilibrium when the values are private, and at a Nash equilibrium in mixed strategies when the values are known.

The algorithm

  1. ALL-PAY(b_1, ..., b_n)
  2. 1w ← 1
  3. 2for i ← 2 to n:
  4. 3if b_i > b_w: w ← i ▷ ties go to the smallest index
  5. 4for i ← 1 to n: p_i ← b_i ▷ every bidder pays its bid
  6. 5return w, (p_1, ..., p_n)

The rule is the first-price rule with one change in line L4: the losers pay too. The implementation also gives the symmetric equilibrium bid β(v)=n−1nvn\beta(v) = \frac{n-1}{n} v^n for values uniform on [0,1][0, 1], and the exact expected utility of a bidder who bids as another type, which the tests use to check the equilibrium.

Example

Private uniform values. With n=2n = 2 the equilibrium bid is β(v)=v2/2\beta(v) = v^2/2.

value vv 0.2 0.5 0.8 1
all-pay bid v2/2v^2/2 0.02 0.125 0.32 0.5
first-price bid v/2v/2 0.1 0.25 0.4 0.5

A bidder of value 0.80.8 who bids 0.320.32 wins with probability 0.80.8 and has expected utility 0.8⋅0.8−0.32=0.320.8 \cdot 0.8 - 0.32 = 0.32. In the first-price auction the same bidder bids 0.40.4, wins with probability 0.80.8 and has expected utility 0.4⋅0.8=0.320.4 \cdot 0.8 = 0.32: the same, as revenue equivalence says. A low type bids much less in the all-pay auction, because it pays for sure. The expected revenue is 2⋅E[v2/2]=1/32 \cdot \mathbb{E}[v^2/2] = 1/3, and with nn bidders it is (n−1)/(n+1)(n-1)/(n+1), as in the first-price and Vickrey auctions.

Known values. Two bidders have values v1=10v_1 = 10 and v2=6v_2 = 6, and both know them. In the unique equilibrium, bidder 1 bids uniformly on [0,6][0, 6]. Bidder 2 bids 0 with probability 0.40.4 and otherwise uniformly on [0,6][0, 6]. Bidder 1 gets 10−6=410 - 6 = 4 for every bid in [0,6][0, 6], and bidder 2 gets 0. The expected payments are 3 for bidder 1 and 0.6⋅3=1.80.6 \cdot 3 = 1.8 for bidder 2, so the seller gets 4.84.8. Bidder 1 wins with probability 0.4+0.6⋅0.5=0.70.4 + 0.6 \cdot 0.5 = 0.7, so the expected welfare is 0.7⋅10+0.3⋅6=8.80.7 \cdot 10 + 0.3 \cdot 6 = 8.8, which is the payoffs 4+04 + 0 plus the revenue 4.84.8. If both values are 10, both bid uniformly on [0,10][0, 10], both get 0 and the seller gets 10: the whole value of the prize is spent on bids.

Correctness

The proof is in proofs/correctness.md. It shows three facts.

  • The outcome. The loop keeps the first highest bid, and line L4 charges every bid.
  • The equilibrium with uniform private values. If the others bid β(t)=n−1ntn\beta(t) = \frac{n-1}{n} t^n, a bidder of value vv who bids β(t)\beta(t) gets u(v,t)=vtn−1−β(t)u(v, t) = v t^{n-1} - \beta(t). Its derivative in tt is (n−1)tn−2(v−t)(n-1) t^{n-2} (v - t), so t=vt = v is best. The expected revenue is n⋅n−1nE[vn]=n−1n+1n \cdot \frac{n-1}{n} \mathbb{E}[v^n] = \frac{n-1}{n+1}.
  • The equilibrium with known values. Each bidder makes the other indifferent over the support [0,v2][0, v_2], and bids above v2v_2 are worse (indifference principle).

The formula for β\beta comes from revenue equivalence. In equilibrium the highest value wins, as in the Vickrey auction, and the lowest type pays 0. So a type vv must pay in expectation what it pays in the Vickrey auction, E[Y11{Y1<v}]=n−1nvn\mathbb{E}[Y_1 \mathbb{1}\{Y_1 < v\}] = \frac{n-1}{n} v^n, where Y1Y_1 is the highest of the other values. In the all-pay auction this payment is the bid itself.

Proof: The all-pay auction picks the highest bid and charges every bid, and its equilibria with uniform and with known valuesfull

We use the pseudocode of the page, with bids b1,…,bnb_1, \ldots, b_n and n≥1n \ge 1.

Claim 1 (the outcome). ALL-PAY returns the smallest index ww with bw=max⁡ibib_w = \max_i b_i and the payments pi=bip_i = b_i for all ii.

Proof. Invariant of the loop of line L2: before the iteration for ii, ww is the smallest index among 1,…,i−11, \ldots, i-1 with the largest bid. Line L1 makes it true for i=2i = 2. Line L3 changes ww only on a strictly larger bid, so it keeps the smallest index among equal largest bids. At the end the invariant covers all bids. Line L4 sets each payment to the bid. □\square

Claim 2 (symmetric equilibrium with uniform values). Let the n≥2n \ge 2 values be independent and uniform on [0,1][0, 1]. Then β(v)=n−1nvn\beta(v) = \frac{n-1}{n} v^n for every bidder is a Bayes-Nash equilibrium, and the expected revenue is n−1n+1\frac{n-1}{n+1}.

Proof. Fix bidder ii with value vv, and let the others use β\beta, which is strictly increasing and continuous, with range [0,β(1)][0, \beta(1)], and has no atoms. A bid b>β(1)b > \beta(1) wins for sure and costs more than β(1)\beta(1), which also wins for sure, so it is worse. A bid b∈[0,β(1)]b \in [0, \beta(1)] is β(t)\beta(t) for one t∈[0,1]t \in [0, 1], wins when all other values are below tt (ties have probability 0), and is paid in every case. So

u(v,t)=v tn−1−n−1ntn,∂u∂t=(n−1)tn−2(v−t).u(v, t) = v\, t^{n-1} - \tfrac{n-1}{n} t^n, \qquad \frac{\partial u}{\partial t} = (n-1) t^{n-2} (v - t).

The derivative is positive for t<vt < v and negative for t>vt > v, so t=vt = v is the best choice, with u(v,v)=vn/n≥0u(v, v) = v^n / n \ge 0. Hence β\beta is a best response to itself.

Each bidder pays β(vi)\beta(v_i), and E[vin]=1n+1\mathbb{E}[v_i^n] = \frac{1}{n+1}. By linearity of expectation, the expected revenue is n⋅n−1n⋅1n+1=n−1n+1n \cdot \frac{n-1}{n} \cdot \frac{1}{n+1} = \frac{n-1}{n+1}. □\square

The same bid follows from revenue equivalence: in the Vickrey auction a bidder of value vv pays the highest other value when it is below vv, which has expectation ∫0vt d(tn−1)=n−1nvn\int_0^v t \, d(t^{n-1}) = \frac{n-1}{n} v^n. In the all-pay auction a bidder pays its bid for sure, so the bid must equal this expected payment.

Claim 3 (two bidders with known values). Let two bidders have values v1≥v2>0v_1 \ge v_2 > 0 known to both. Let bidder 1 bid uniformly on [0,v2][0, v_2], and let bidder 2 bid 0 with probability 1−v2/v11 - v_2/v_1 and otherwise uniformly on [0,v2][0, v_2], so that its bid has the CDF G2(b)=1−v2/v1+b/v1G_2(b) = 1 - v_2/v_1 + b/v_1 on [0,v2][0, v_2]. This is a mixed Nash equilibrium, with expected payoffs v1−v2v_1 - v_2 and 00.

Proof. Bidder 1's bid has no atom, so ties have probability 0 except when both bid 0, which has probability 0 because bidder 1 bids 0 with probability 0. Against bidder 2, a bid b∈[0,v2]b \in [0, v_2] of bidder 1 wins with probability G2(b)G_2(b) and gives v1G2(b)−b=v1−v2v_1 G_2(b) - b = v_1 - v_2, the same for each bb. A bid b>v2b > v_2 wins for sure and gives v1−b<v1−v2v_1 - b < v_1 - v_2. So every bid in the support is a best response. Against bidder 1, a bid b∈[0,v2]b \in [0, v_2] of bidder 2 wins with probability b/v2b / v_2 and gives v2⋅b/v2−b=0v_2 \cdot b/v_2 - b = 0, and a bid above v2v_2 gives v2−b<0v_2 - b < 0. So every bid in the support of bidder 2 is a best response as well. □\square

Cost. The loop runs n−1n - 1 times with one comparison each, and line L4 copies nn bids. The time is Θ(n)\Theta(n) and the extra space is O(n)O(n) for the payments.

Complexity

One pass over the bids and one copy of them: Θ(n)\Theta(n) time and O(n)O(n) extra space for the list of payments. The general symmetric equilibrium is β(v)=∫0vt dG(t)\beta(v) = \int_0^v t \, dG(t) with G=Fn−1G = F^{n-1}, which needs one integral per value. For asymmetric private values and for many prizes the equilibrium has no closed form in general.

Properties

  • Revenue equivalence. With symmetric, independent, risk-neutral bidders, the all-pay auction earns the same expected revenue as the first-price, Dutch, English and Vickrey auctions, and each type has the same expected utility.
  • Efficient with symmetric private values. The equilibrium bid is strictly increasing, so the highest value wins.
  • Not efficient with known, unequal values. In the example above, the weaker bidder wins with probability 0.30.3.
  • Rent dissipation. With known values, the expected total payment is v22(1+v2v1)\frac{v_2}{2}(1 + \frac{v_2}{v_1}), which equals the whole prize v1v_1 when v1=v2v_1 = v_2. With n≥2n \ge 2 bidders of equal known value, the rent is fully dissipated (Hillman and Riley 1989).
  • Losers pay. The auction is not ex post individually rational: a loser has a negative utility. It is interim individually rational in the private values equilibrium, since u(v,v)=vn/n≥0u(v, v) = v^n/n \ge 0.

Variants and improvements

  • War of attrition. The highest bid wins, the winner pays the second-highest bid, and the losers pay their own bids, as in a contest of endurance. With two bidders and uniform values the symmetric equilibrium is β(v)=−v−ln⁡(1−v)\beta(v) = -v - \ln(1 - v), and the expected revenue is again 1/31/3 (Krishna, Section 3.2).
  • Many prizes. Contests with several prizes of decreasing size, such as tournaments with a first and a second prize. The designer's choice of prizes changes the total effort (Moldovanu and Sela 2001 study this question).
  • Lottery contests. In a Tullock contest a bidder wins with probability proportional to its bid, so a higher bid only raises the chance of winning. It has a pure equilibrium with known values.
  • General contests. Siegel (2009) found the equilibrium payoffs of a wide class of all-pay contests with complete information, with different costs of effort and head starts.

When to use it

Use the all-pay auction as a model, not as a sale: it describes lobbying, research races, sports, election campaigns and crowdsourcing contests, where the effort is sunk before the winner is chosen. As a selling method it is rare, because losers are unhappy to pay. It is the right model when the main question is how much total effort a prize attracts.

Pitfalls

  • No pure equilibrium with known values. With known values v1≥v2>0v_1 \ge v_2 > 0, any pure profile has a profitable deviation: the loser can bid 0, or the winner can lower its bid. Search for mixed strategies instead.
  • Bids are not the first-price bids. The all-pay bid n−1nvn\frac{n-1}{n} v^n is much lower than the first-price bid n−1nv\frac{n-1}{n} v for low values. Using the first-price formula makes low types lose money.
  • Overbidding in experiments. In the laboratory, the total bids often exceed the equilibrium prediction and sometimes the value of the prize (Dechenaux, Kovenock and Sheremeta 2015).
  • Ties at zero. With known values, bidder 2 bids 0 with positive probability. The tie rule matters only if bidder 1 also bids 0, which has probability 0 in equilibrium, but a discrete test must handle the tie.
  • Budgets and risk aversion. Revenue equivalence needs risk-neutral bidders without budgets. A bidder who cannot pay a high bid, or who fears a sure loss, bids differently.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

all_pay_auction.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/all-pay-auction/. The authors are listed in prov/HC5JY0.jsonl.

from fractions import Fraction
from typing import Sequence, Union

Number = Union[int, Fraction, float]


def all_pay_auction(bids: Sequence[Number]) -> tuple[int | None, list[Number]]:
    """Run a sealed-bid all-pay auction.

    The highest bid wins, a tie goes to the smallest index, and every bidder
    pays its own bid, win or lose. Return the 0-based winner (None if there
    are no bids) and the list of payments.
    """
    if not bids:
        return None, []
    winner = 0  # @line L1
    for i in range(1, len(bids)):  # @line L2
        if bids[i] > bids[winner]:  # @line L3
            winner = i  # @line L3
    payments = [bids[i] for i in range(len(bids))]  # @line L4
    return winner, payments  # @line L5


def equilibrium_bid(value: Fraction, n: int) -> Fraction:
    """Symmetric equilibrium bid (n - 1) v^n / n for n bidders with values uniform on [0, 1]."""
    return Fraction(n - 1, n) * value**n


def interim_utility(value: Fraction, target: Fraction, n: int) -> Fraction:
    """Expected utility of a bidder of the given value who bids as type target in [0, 1].

    The others bid equilibrium_bid, which is increasing, so the bid wins with
    probability target^(n - 1), and the bid is paid in every case.
    """
    return value * target ** (n - 1) - equilibrium_bid(target, n)
test_all_pay_auction.py 98 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/all-pay-auction/. The authors are listed in prov/HC5JY0.jsonl.

import random
from fractions import Fraction

from all_pay_auction import all_pay_auction, equilibrium_bid, interim_utility


def test_example() -> None:
    assert all_pay_auction([10, 7, 3]) == (0, [10, 7, 3])
    assert all_pay_auction([3, 7, 10]) == (2, [3, 7, 10])


def test_edges() -> None:
    assert all_pay_auction([]) == (None, [])
    assert all_pay_auction([5]) == (0, [5])
    assert all_pay_auction([7, 7, 3]) == (0, [7, 7, 3])
    assert all_pay_auction([3, 7, 7]) == (1, [3, 7, 7])
    assert all_pay_auction([0, 0]) == (0, [0, 0])


def test_against_reference() -> None:
    rng = random.Random(1)
    for _ in range(2000):
        bids = [rng.randrange(0, 6) for _ in range(rng.randrange(1, 7))]
        top = max(bids)
        assert all_pay_auction(bids) == (bids.index(top), bids)


def test_equilibrium_values() -> None:
    assert equilibrium_bid(Fraction(1, 2), 2) == Fraction(1, 8)
    assert equilibrium_bid(Fraction(1), 3) == Fraction(2, 3)
    # Two bidders: the bid v^2/2 is the expected Vickrey payment of type v.
    for k in range(11):
        v = Fraction(k, 10)
        assert equilibrium_bid(v, 2) == v * v / 2


def test_equilibrium_is_best_response() -> None:
    # Bids above equilibrium_bid(1) win for sure and cost more than equilibrium_bid(1),
    # so every relevant bid is equilibrium_bid(t) for some t in [0, 1].
    grid = [Fraction(k, 60) for k in range(61)]
    for n in (2, 3, 4):
        for v in [Fraction(k, 12) for k in range(13)]:
            best = interim_utility(v, v, n)
            assert best >= 0
            for t in grid:
                if t != v:
                    assert interim_utility(v, t, n) < best


def test_expected_utility_by_simulation() -> None:
    rng = random.Random(2)
    n, v, t = 3, Fraction(3, 4), Fraction(9, 10)
    trials, total = 20000, 0.0
    b0 = float(equilibrium_bid(t, n))
    for _ in range(trials):
        bids = [b0] + [float(equilibrium_bid(Fraction(rng.random()), n)) for _ in range(n - 1)]
        w, pay = all_pay_auction(bids)
        total += (float(v) if w == 0 else 0.0) - pay[0]
    # Utilities lie in [-1, 1]; Hoeffding gives deviation above 0.03 with probability below 1e-3.
    assert abs(total / trials - float(interim_utility(v, t, n))) < 0.03


def test_revenue_uniform() -> None:
    rng = random.Random(3)
    for n in (2, 3):
        trials, total = 20000, 0.0
        for _ in range(trials):
            bids = [(n - 1) * rng.random() ** n / n for _ in range(n)]
            _, pay = all_pay_auction(bids)
            total += sum(pay)
        # Revenue is in [0, n - 1]; with n <= 3 Hoeffding gives deviation above 0.03 with
        # probability at most 2 exp(-2 * 20000 * 0.03^2 / 4) < 1e-3.
        assert abs(total / trials - (n - 1) / (n + 1)) < 0.03


def test_complete_information_equilibrium() -> None:
    # Values v1 >= v2 known to both. Bidder 1 bids uniform on [0, v2]; bidder 2 bids 0
    # with probability 1 - v2/v1 and otherwise uniform on [0, v2].
    for v1, v2 in [(Fraction(10), Fraction(6)), (Fraction(5), Fraction(5)), (Fraction(3), Fraction(1, 2))]:
        def cdf1(b):
            return min(b / v2, Fraction(1))

        def cdf2(b):
            return min(1 - v2 / v1 + b / v1, Fraction(1))

        grid = [v2 * Fraction(k, 20) for k in range(1, 31)]
        for b in grid:
            u1 = v1 * cdf2(b) - b
            u2 = v2 * cdf1(b) - b
            if b <= v2:
                assert u1 == v1 - v2
                assert u2 == 0
            else:
                assert u1 < v1 - v2
                assert u2 < 0

History

Tullock (1980) started the study of rent seeking, in which firms spend resources to win a monopoly from the state. Hillman and Riley (1989) modelled it as an all-pay auction with known values, found the mixed equilibrium and showed how much of the rent is dissipated. Baye, Kovenock and de Vries (1996) characterized all Nash equilibria with complete information: the equilibrium is unique with two bidders, and with three or more bidders it is unique when the second-highest value is strictly larger than the third, while ties among the lower values give a continuum of equilibria. The private values case follows from revenue equivalence (Myerson 1981; Riley and Samuelson 1981). Siegel (2009) extended the analysis to general contests.

References

  1. Arye L. Hillman and John G. Riley, Politically contestable rents and transfers, Economics and Politics 1(1) (1989), 17-39, the all-pay auction as a model of rent seeking, its mixed equilibrium with known values and the dissipation of the rent
  2. Michael R. Baye, Dan Kovenock and Casper G. de Vries, The all-pay auction with complete information, Economic Theory 8(2) (1996), 291-305, the full set of Nash equilibria of the all-pay auction with known values, unique when the second-highest value is strictly larger than the third
  3. Vijay Krishna, Auction Theory, 2nd edition, Academic Press, 2010, Chapter 3, Section 3.2 (applications of revenue equivalence to unusual auctions, among them the all-pay auction and the war of attrition)
  4. Ron Siegel, All-pay contests, Econometrica 77(1) (2009), 71-92, the equilibrium payoffs of a general class of all-pay contests with complete information
  5. Emmanuel Dechenaux, Dan Kovenock and Roman M. Sheremeta, A survey of experimental research on contests, all-pay auctions and tournaments, Experimental Economics 18(4) (2015), 609-669, laboratory evidence that subjects in all-pay auctions bid more in total than the equilibrium predicts

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example