Distribution Markets

12.10.2024|Dave White

Overview

This paper introduces distribution markets, a new kind of prediction market for events whose outcomes aren't just "yes" or "no" but could be any number.

Instead of betting on a particular outcome or range, traders can express how likely they think each different possibility is across the whole infinite range of outcomes.

Distribution Markets landing page

The gray curve represents the AMM's initial belief, the blue curve represents a new trader's belief, and the green and red curve represents the trader's potential profit and loss if they were to move the market to their belief. Each curve is denominated in dollars, and the blue and gray curves are scalar multiples of their underlying probability distributions.

Intuition

Take the question "When will GPT-5 be released?" In a traditional prediction market, traders might have to choose between preset options like "Q2 2025" or "2026."

Prediction competitions like Metaculus instead let traders express their predictions as a curves showing exactly how likely they think each possible date is. However, Metaculus is a competition, not a market, and has no way for participants to trade on their beliefs and put skin in the game by trading on their beliefs.

Like Metaculus, Distribution Markets allow participants to come to consensus on the full probability distribution over all outcomes, but like traditional prediction markets they allow traders to profit by moving the shared view in the right direction.

Mechanics

The underlying mechanism is a constant function AMM over functions, with the invariant (analogous to Uniswap's xy=k) being a constant

l2l_2
norm. When restricted to specific distributions (such as the Normal, lognormal, and so on), the math is surprisingly simple, and the resulting AMMs can be implemented efficiently onchain.

Motivation

Prediction markets have entered popular consciousness in the wake of the 2024 US Presidential elections, but the technology is likely still in its infancy. Further development could be of benefit both to developers and to the public at large.

More specifically, today's prediction markets generally allow participants to express probability distributions over discrete outcomes, but many questions of relevance to the real world involve continuous outcomes.

It's true that a perp market could elicit the expected value of a continuous variable from the market, but sometimes we would like to know more -- for example, do we know for sure a given project will take 10 years exactly, or could it perhaps be anywhere between 2 and 20?

Mechanism

Discrete Case

This section is provided as an aid to understanding the continuous case, which is the main contribution of this paper.

We already have many options for prediction market AMMs in the discrete case, where the outcome is one of a finite set of options. So, the discrete case distribution market mechanism presented in this section isn't particularly useful.

However, the math in the discrete case mirrors the continuous case exactly, so this section may be helpful as an aid to intuition.

Outcome Tokens

Consider some event with

NN
outcomes.

We create outcome tokens
X1,...,XNX_1,...,X_N
such that if the outcome is e.g. outcome
ii
, token
xix_i
will be worth
$1\$1
, and the other tokens will be worth
$0 \$0
. (Note: we're using dollars as the payout currency for accessibility to a broader audience, but this could be any asset.)

We can at any time mint or redeem a full set of these tokens for $1, because at expiry exactly one token will be worth $1 and the rest worth $0.

AMM Invariant

We’re going to create our AMM as a standard Constant Function Market Maker (CFMM), of which the most famous example is probably Uniswap, which has constant function

xy=k.xy=k.


We initialize the AMM with
kk
dollars, which we split into
kk
each of the outcome tokens, so that the market can then sell up to
kk
of any of the outcome tokens in total.

We denote the AMM’s vector of holdings
hh
as

h=kx=(kx1,,kxn)h = k - x = (k-x_1,\ldots,k-x_n)

so that the

xx
vector represents how much of each outcome token the AMM has sold.

We define our AMM’s constant function to be

x2=i=1Nxi2=k||x||_2 = \sqrt{\sum_{i=1}^N x_i^2}=k

Since

x=khx=k-h
, we could also write

kh2=i=1N(hik)2=k||k-h||_2 = \sqrt{\sum_{i=1}^N (h_i-k)^2}=k

which means the AMM's holdings are a a translated hypersphere with radius

kk
around the point
(k,,k)(k,\ldots,k)
in
RN\mathbb{R}^N
.

Note that the minimum coordinate of this translated hypersphere along any dimension is
00
. From this, we can see that the AMM will always sell at most
kk
of any given outcome token, which is fortunate, since it doesn’t have any more than that to sell.

Trading Behavior

Say the true probability distribution of

XiX_i
is
p=(p1,,pn)p=(p_1,\ldots,p_n)
. At the time of resolution, the correct outcome token will be worth
11
. So the expected value of the AMM’s holdings is the probability-weighted sum of its outcome token holdings,
ipihi=ph=p(kx)=kpx\sum_i p_ih_i = p\cdot h=p\cdot(k-x)= k - p \cdot x
, where we say
pk=kp\cdot k = k
because
pp
, as a probability distribution, sums to 1.

If we assume the market is efficient, arbitrageurs will act to maximize the expected value of their own holdings

xx
, which will minimize the value of the AMM's holdings
hh
. In other words, they are solving the optimization problem

minxkpx s.t. x2=k \min_x k - p\cdot x \,\,\,\,\text{ s.t. } ||x||_2=k

Since traders can’t affect

kk
, this simplifies to

maxxpx s.t. x2=k\max_x p\cdot x \,\,\,\,\text{ s.t. } ||x||_2=k

By the Cauchy-Schwarz inequality, the vector that maximizes this dot product given the fixed norm must be linearly dependent with

pp
. This great 3b1b video on the dot product.

This means we must have

x=kpp2x = k\frac{p}{||p||}_2

In other words,

xx
, the vector of positions collectively held by the market, is directly proportional to the true probability distribution
pp
, scaled so that its
l2l_2
norm is
kk
.

By our definition above, the AMM’s holdings

hh
are determined by

h=kx=k(1pp2)h = k -x = k(1-\frac{p}{||p||_2})

which has the nice side effect that we can read the market’s estimated distribution directly from the AMM’s reserves.


In this way, the distribution market is an example of a market scoring rule.

Continuous Case

The continuous case is the main contribution of this paper, because it unlocks a new behavior: prediction-market-like trading over continuous probability distributions.

The mechanism follows nearly identical logic to the discrete case, but with some additional constraints to ensure the market stays solvent.

This is a general construction, but by specializing the types of distribution allowed — to, say, uniform or Gaussian distributions — the resulting AMM can be made computationally efficient to run on, for example, Ethereum mainnet. We discuss this in more detail below.

Outcome Function Tokens

Consider some event with outcomes over a continuous space, say

R\mathbb{R}
.

We can imagine creating one outcome token
XX
for every point
xRx\in\mathbb{R}
such that, if the outcome is
xx
, that outcome token will be exchangeable for $1, and the others will be worth $0.

The simplest way to express holdings of these tokens is as functions
f:RR+f:\mathbb{R}\rightarrow\mathbb{R}^+
where
(x)(x)
is the number of tokens the owner of
ff
holds for outcome
xx
. In other words, the holder of
ff
will receive
f(x)f(x)
if the outcome is
xx
.

Formally, all positions in the context of continuous prediction markets are functions. Depending on context, it may be most helpful to think of these functions either as infinite collections of outcome tokens, as curves, or just as abstract members of function-space.

Minting and Redeeming

Consider the constant function

f(x)=bf(x)=b
. Regardless of the outcome
x0x_0
, the holder of this function will receive
f(x0)=bf(x_0)=b
at the time of resolution. So, we at any time allow this function to be minted or redeemed for
bb
dollars.

AMM Invariant

As in the discrete case, we will initialize our AMM with a fixed amount of dollars,

bb
.

We denote the AMM’s holding outcome function

hh
as

h(x)=bf(x)h(x) = b - f(x)

The AMM can then sell up to

f(x0)=bf(x_0)=b
at any given point
x0x_0
, since it will be able to pay out
bb
once the outcome is determined. We would then have
h(x0)=bb=0h(x_0)=b-b=0
at that point, indicating the AMM cannot sell any more of that outcome.

If traders have, in aggregate, bought outcome function f(x) from the AMM…

...the AMM’s holdings h(x) are b-f(x).

We restrict

ff
to lie in
L2L^2
, the space of square-integrable functions (i.e. functions whose square has a finite integral). This is an inner product space with inner product

fg=Rf(x)g(x)dxf\cdot g=\int_{\mathbb{R}} f(x) g(x)dx

Just as in the discrete case, we will choose a constant

l2l^2
norm as our constant function. In this space, that constant is expressed as

f2=Rf(x)2dx=k||f||_2 = \sqrt{\int_{\mathbb{R}}f(x)^2dx}=k

Note that we’ve limited the

l2l^2
norm here to a new constant
kk
, not
bb
, the amount of money with which we initialized our AMM. In the finite-dimensional case, no element of a vector
xx
with
l2l_2
norm
kk
can have a value of greater than
kk
, so our
l2l_2
norm constraint was enough to ensure the AMM's solvency. In the infinite-dimensional case, this is no longer true. So we separate out the backing amount,
bb
, from the
l2l^2
norm constraint,
kk
, and we add an additional constraint to the AMM, namely

maxfb\max{f}\leq b

Trading Behavior

At its simplest, the AMM starts by holding some function

h(x)=bf(x)h(x)=b-f(x)
. A trader who wants to move the market to
g(x)g(x)
, so that the AMM now holds
bg(x)b-g(x)
, will end up holding
g(x)f(x)g(x)-f(x)
, the difference of the two functions.

Distribution Markets landing page

The gray curve is the starting f(x), the position initially held in aggregate by all traders and a scalar multiple of the market's starting estimate of the true distribution. The blue curve is g(x), the scakar multiple of the distribution the trader is moving the market to that leads to the appropriate l_2 norm. The green and red curve is g(x)-f(x), representing the trader's position after the trade. They will make money if the outcome is in the green region and lose money in the red region. We can see they have shifted the mean down slightly and increased the variance, so that they in general make money if the outcome is outside the peaked area of the original f(x).

More formally, say the true probability distribution of the outcome in question is described by a probability density function

p(x)p(x)
so that the expected value of the AMM’s holdings is

E(bf(x))=bE(f(x))=bRf(x)p(x)dx=bfp\mathbb{E}(b-f(x))=b-\mathbb{E}(f(x)) = b - \int_\mathbb{R}f(x)p(x)dx=b-f\cdot p

where the last equality comes from our definition of inner product on this space.

If the market is efficient, arbitrageurs will act to minimize the AMM’s expected value. In other words, they are solving the optimization problem


minfbfp s.t. f2=k and maxfb\min_f b - f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=k \text{ and } \max{f}\leq b

Since the trader can’t affect

bb
, this simplifies to

maxffp s.t. f2=k and maxfb\max_f f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=k\text{ and } \max{f}\leq b

For a moment, assume the AMM has effectively infinite backing, so that the second constraint doesn’t matter and we simply have

maxffp s.t. f2=k\max_f f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=k

Then, just as in the discrete case, the Cauchy-Schwarz inequality tells us that the vector that maximizes this dot product given a fixed norm must be linearly dependent with

pp
— in other words, we know we must have

f=kpp2f = k\frac{p}{||p||}_2

In other words,

ff
, the outcome function collectively held by traders, is directly proportional to the true probability distribution!

This means that the AMM’s holdings
hh
are determined by

h=bf=k(1pp2)h = b -f = k(1-\frac{p}{||p||_2})

and we can again read traders' aggregate estimated distribution directly from the AMM’s reserves.

If the true distribution p(x) looks like this…

In an efficient market, traders’ holdings f(x) will, in aggregate, be shaped proportionally…

…and the AMM’s holdings h(x) will be the mirror image

Handling the Backing Constraint

We assumed above for convenience that the AMM’s backing

bb
would be essentially infinite, but, of course, this will often not be the case.

When there are backing constraints, we have two options:

The first, and simplest, is to simply not permit traders to move

f(x)f(x)
to situations where we have
f2=k||f||_2=k
but
maxf>b\max{f}>b
. In the normal case, as we will discuss below, this simply means forbidding traders to estimate standard deviations which are too narrow, which may be appropriate to help the market avoid getting wiped out by traders with inside information.

Alternately, we can simply enforce the constraint that

f(x)bf(x)\leq b
. Let’s say a trader believes the true probability distribution is
p(x)p(x)
. We leave it as an exercise to the reader to show that the trader’s optimal position will be

f(x)=min(λp(x),b)f(x)=\min(\lambda p(x),b)

for whatever

λ\lambda
makes it such that
min(λp(x),b)2=k||\min(\lambda p(x),b)||_2=k
. We can find
λ\lambda
numerically offchain and then easily verify this property onchain for many distributions.

Liquidity Provision

The AMM allows permissionless adding of liquidity, with liquidity providers (LPs) receiving fungible LP shares, just like in Uniswap V2.

Imagine for a moment we had a uniswap V2 pool containing 10,000 USDC and 1 ETH, with 10,000 LP shares outstanding. If a market participant wanted to add liquidity to this pool, they would have to add tokens that are a scalar multiple of the AMM's position, and would get a proportional share of the pool in return. So, for example, if a new liquidity provider were to double the liquidity in the pool, they could add 10,000 USDC and 1 ETH, and would receive 10,000 LP shares.

Liquidity provision works just the same for the distribution AMM. A prospective liquidity provider needs to add assets proportional to the AMM's current position, and receives LP shares in return.

The AMM's position is

h=bfh=b-f
. So an LP wanting to add some proportion
yy
of current liquidity needs to contribute a position
yh=ybyfyh=yb-yf
. In return they will receive
ylyl
LP shares, where
ll
is the current number of LP shares outstanding.

In order to create the position
yhyh
, we will require the LP to mint it using
ybyb
collateral. This means they will be left with a position
ybyh=yb(ybyf)=yfyb-yh=yb-(yb-yf)=yf
that they can keep. This represents the market's position at the time they minted their LP shares.

Collateralization

The initial source of collateral to the AMM is the the first LP. If they initialize the pool with backing

bb
, they need to submit
bb
collateral. They will also specify some initial
ff
for the pool, so that the pool's position is
h=bfh=b-f
and the initial LP keeps the position
ff
. The AMM's position and the position of all traders then sums to
bb
, and there is
bb
collateral, so the system is fully collateralized.

Similarly, when a new LP adds liquidity, they are adding
ybyfyb-yf
to the pool and keeping
yfyf
for themselves. They are then adding
ybyb
to total outstanding holdings, so as long as they provide
ybyb
collateral, the system will remain fully collateralized. Furthermore, if the AMM's position and all traders' positions summed to the backing amount before they added liquidity, that equality will still hold afterwards.

Finally, let's assume the system is fully collateralized when a trade takes place, and that the AMM's position and the position of all traders sums to
bb
. The market currently holds
h=bfh=b-f
and a trader moves the market to
h2=bgh_2=b-g
, so that this trader should now hold
gfg-f
. If this were the case, then because we know all other traders hold
ff
in aggregate, then all traders together would hold
f+(gf)=gf+(g-f)=g
in aggregate, which means that all traders and the market together hold
bg+g=bb-g+g=b
in aggregate, and the market would still be fully collateralized.

However, in order to say the trader holds
gfg-f
, they must actually lose money if the outcome is
x0x_0
and we have
g(x0)f(x0)<0g(x_0)-f(x_0)<0
. So the trader must collateralize this position with
minxg(x)f(x) -\min_x{g(x)-f(x)}
in collateral. We discuss how to verify this for the Normal case in that section below.

The Normal Case

Overview

The normal distribution is in some ways the canonical example of a continuous probability distribution.

In this section, we discuss how we can use distribution markets to create a prediction market over normal outcomes in an efficient manner onchain.

l2l_2
Norm

The Normal distribution with mean

μ\mu
and standard deviation
σ\sigma
has probability distribution function

p(x)=12πσ2e(xμ)22σ2p(x)=\frac{1}{\sqrt{2\pi \sigma^2}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}

with

l2l^2
norm

R12πσ2e(xμ)2σ2dx=12σπ\sqrt{\int_\mathbb{R}\frac{1}{2\pi \sigma^2}e^{-\frac{(x-\mu)^2}{\sigma^2}}\,dx} = \sqrt{\frac{1}{2\sigma\sqrt{\pi}}}

where the latter equality comes from the closed form solution to the Gaussian Integral.

AMM Behavior

We can see that the

l2l^2
norm is agnostic to the mean of the distribution, so our AMM is indifferent between distributions with the same standard deviation but different mean -- traders can move the market to any mean they like while keeping the same standard deviation, and will only have to provide the appropriate collateral. In later work we may explore the ability to give our AMM a prior which might prefer some means over others.

However, distributions with lower variance have higher
l2l^2
norms. This means that if the market’s estimated normal distribution has standard deviation
σ\sigma
, we have

k=f2=λp2=λp2=λ12σπk=||f||_2=||\lambda p||_2=\lambda||p||_2=\lambda\sqrt{\frac{1}{2\sigma\sqrt{\pi}}}

and therefore

λ=k2σπ\lambda=k\sqrt{2\sigma\sqrt{\pi}}

In other words, the more peaked a trader's proposed distribution is, the less total probability mass the market will be willing to sell to them. Again, this might help the market avoid getting wiped out by traders with inside information about a specific outcome.

Backing Constraints

Remember we have

f=λpf=\lambda p
, with
pp
being a Normal PDF. At its peak,
pp
has value
12πσ2\frac{1}{\sqrt{2\pi\sigma^2}}
. As a multiple of
pp
, f has maximum value

maxf=λ2πσ2=k2σπ12πσ2=k1σπ\max f=\frac{\lambda}{\sqrt{2\pi\sigma^2}} = k\sqrt{2\sigma\sqrt{\pi}}\frac{1}{\sqrt{2\pi\sigma^2}} =k\sqrt{\frac{1}{\sigma\sqrt{\pi}}}

Since we can never have

f(x)>bf(x)>b
, this means we must have

maxf=k1σπb\max f = k\sqrt{\frac{1}{\sigma\sqrt{\pi}}}\leq b

so that

σk2b2π\sigma \geq \frac{k^2}{b^2\sqrt{\pi}}

As discussed in the general continuous case section above, we can simply restrict traders in the AMM from choosing standard deviations less than this.

Alternately, we could allow traders to trade a capped Gaussian with any standard deviation they like, so that we would have

f(x)=min(b,λϕ(x))f(x)=\min(b,\lambda\phi(x))
for whatever
λ\lambda
satisfied the
l2l_2
norm constraint.

We can cap the trader's payout to b...

...so that the AMM's payout is 0 at minimum.

For the remainder of this paper, however, we'll just assume we're enforcing the lower bound on

σ\sigma
for simplicity.

Collateralization

As discussed above in the collateralization section for the general continuous case, traders need to collateralize their trades with

minxg(x)f(x)-\min_x{g(x)-f(x)}
when moving the AMM from
h=bfh=b-f
to
h2=bgh_2=b-g
.

Unfortunately, there is no apparent closed-form solution to
minxapbq\min_x ap-bq
, where
pp
and
qq
are Normal PDFs. However, we can compute this minimum numerically. Although there may be several local minima, it turns out that the only local minimum on the opposite side of
qq
's mean from
pp
's mean will be the global minimum (the proof that there can be only one such point is a very interesting exercise). We can then verify that the trader has provided this point onchain by checking first and second derivatives (and also ensure that the total max loss is at least some "dust" amount to avoid numerical attacks) and require they provide the corresponding collateral amount.

m=λ2σqπλ2π(σp2+σq2)e(μpμq)22(σq2+σp2)m=\frac{\lambda'}{2\sigma_q\sqrt{\pi}}-\frac{\lambda}{\sqrt{2\pi(\sigma_p^2+\sigma_q^2)}}e^{-\frac{(\mu_p-\mu_q)^2}{2(\sigma_q^2+\sigma_p^2)}}

Multiple Distributions

Note that we could have a single distribution AMM capable of trading multiple distributions -- as long as the

l2l_2
norm constraints and max loss constraints are obeyed, there is no reason not to let a trader switch from, say, a normal distribution to a uniform distribution in a single trade. The main point of practical difficulty would be in computing trade collateralization.

This is relatively straightforward in the case of Normal -> Uniform and Uniform -> Normal distributions. We leave the calculations as an exercise to the reader.

Conclusion

We hope Distribution Markets help to spark ideas for builders and researchers on the cutting edge of information finance.

If that's you, we'd love to hear from you.

Written by

Biography

Dave White is a Research Partner at Paradigm. Previously, Dave was a quantitative trader and researcher at firms including Headlands, Two Sigma, and Cutler Group. He is three credits shy of an A.B. in Mathematics from Harvard University.

Disclaimer: This post is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This post reflects the current opinions of the authors and is not made on behalf of Paradigm or its affiliates and does not necessarily reflect the opinions of Paradigm, its affiliates or individuals associated with Paradigm. The opinions reflected herein are subject to change without being updated.

Copyright © 2024 Paradigm Operations LP All rights reserved. “Paradigm” is a trademark, and the triangular mobius symbol is a registered trademark of Paradigm Operations LP