Title: Distribution Markets - Paradigm Description: Paradigm is a research-driven crypto investment firm that funds companies and protocols from their earliest stages. Keywords: No keywords Text content: Distribution Markets - ParadigmAboutTeamPortfolioWritingOpen SourceCareersDistribution Markets12.10.2024|Dave WhiteOverviewThis 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.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.IntuitionTake 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.MechanicsThe underlying mechanism is a constant function AMM over functions, with the invariant (analogous to Uniswap's xy=k) being a constant l2l_2l2​ 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.MotivationPrediction 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?MechanismDiscrete CaseThis 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 TokensConsider some event with NNN outcomes.We create outcome tokens X1,...,XNX_1,...,X_NX1​,...,XN​ such that if the outcome is e.g. outcome iii, token xix_ixi​ will be worth $1\$1$1, and the other tokens will be worth $0 \$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 InvariantWe’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.xy=k.We initialize the AMM with kkk dollars, which we split into kkk each of the outcome tokens, so that the market can then sell up to kkk of any of the outcome tokens in total.We denote the AMM’s vector of holdings hhh ash=k−x=(k−x1,…,k−xn)h = k - x = (k-x_1,\ldots,k-x_n) h=k−x=(k−x1​,…,k−xn​)so that the xxx vector represents how much of each outcome token the AMM has sold.We define our AMM’s constant function to be∣∣x∣∣2=∑i=1Nxi2=k||x||_2 = \sqrt{\sum_{i=1}^N x_i^2}=k∣∣x∣∣2​=i=1∑N​xi2​​=kSince x=k−hx=k-hx=k−h, we could also write∣∣k−h∣∣2=∑i=1N(hi−k)2=k||k-h||_2 = \sqrt{\sum_{i=1}^N (h_i-k)^2}=k∣∣k−h∣∣2​=i=1∑N​(hi​−k)2​=kwhich means the AMM's holdings are a a translated hypersphere with radius kkk around the point (k,…,k)(k,\ldots,k)(k,…,k) in RN\mathbb{R}^NRN.Note that the minimum coordinate of this translated hypersphere along any dimension is 000. From this, we can see that the AMM will always sell at most kkk of any given outcome token, which is fortunate, since it doesn’t have any more than that to sell.Trading BehaviorSay the true probability distribution of XiX_iXi​ is p=(p1,…,pn)p=(p_1,\ldots,p_n)p=(p1​,…,pn​). At the time of resolution, the correct outcome token will be worth111. So the expected value of the AMM’s holdings is the probability-weighted sum of its outcome token holdings, ∑ipihi=p⋅h=p⋅(k−x)=k−p⋅x\sum_i p_ih_i = p\cdot h=p\cdot(k-x)= k - p \cdot x∑i​pi​hi​=p⋅h=p⋅(k−x)=k−p⋅x, where we say p⋅k=kp\cdot k = kp⋅k=k because ppp, 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 xxx, which will minimize the value of the AMM's holdings hhh. In other words, they are solving the optimization problemmin⁡xk−p⋅x     s.t. ∣∣x∣∣2=k \min_x k - p\cdot x \,\,\,\,\text{ s.t. } ||x||_2=k xmin​k−p⋅x s.t. ∣∣x∣∣2​=kSince traders can’t affect kkk, this simplifies tomax⁡xp⋅x     s.t. ∣∣x∣∣2=k\max_x p\cdot x \,\,\,\,\text{ s.t. } ||x||_2=k xmax​p⋅x s.t. ∣∣x∣∣2​=kBy the Cauchy-Schwarz inequality, the vector that maximizes this dot product given the fixed norm must be linearly dependent with ppp. This great 3b1b video on the dot product. This means we must havex=kp∣∣p∣∣2x = k\frac{p}{||p||}_2x=k∣∣p∣∣p​2​In other words, xxx, the vector of positions collectively held by the market, is directly proportional to the true probability distribution ppp, scaled so that its l2l_2l2​ norm is kkk.By our definition above, the AMM’s holdings hhh are determined byh=k−x=k(1−p∣∣p∣∣2)h = k -x = k(1-\frac{p}{||p||_2}) h=k−x=k(1−∣∣p∣∣2​p​)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 CaseThe 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 TokensConsider some event with outcomes over a continuous space, say R\mathbb{R}R.We can imagine creating one outcome token XXX for every point x∈Rx\in\mathbb{R}x∈R such that, if the outcome is xxx, 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:R→R+f:\mathbb{R}\rightarrow\mathbb{R}^+f:R→R+ where $f(x)$ is the number of tokens the owner of fffholds for outcome xxx. In other words, the holder of fff will receive f(x)f(x)f(x)if the outcome is xxx.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 RedeemingConsider the constant function f(x)=bf(x)=bf(x)=b. Regardless of the outcome x0x_0x0​, the holder of this function will receive f(x0)=bf(x_0)=bf(x0​)=b at the time of resolution. So, we at any time allow this function to be minted or redeemed for bbb dollars.AMM InvariantAs in the discrete case, we will initialize our AMM with a fixed amount of dollars, bbb.We denote the AMM’s holding outcome function hhh ash(x)=b−f(x)h(x) = b - f(x)h(x)=b−f(x)The AMM can then sell up to f(x0)=bf(x_0)=bf(x0​)=b at any given point x0x_0x0​, since it will be able to pay out bbb once the outcome is determined. We would then have h(x0)=b−b=0h(x_0)=b-b=0h(x0​)=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 fff to lie in L2L^2L2, the space of square-integrable functions (i.e. functions whose square has a finite integral). This is an inner product space with inner productf⋅g=∫Rf(x)g(x)dxf\cdot g=\int_{\mathbb{R}} f(x) g(x)dxf⋅g=∫R​f(x)g(x)dxJust as in the discrete case, we will choose a constant l2l^2l2 norm as our constant function. In this space, that constant is expressed as∣∣f∣∣2=∫Rf(x)2dx=k||f||_2 = \sqrt{\int_{\mathbb{R}}f(x)^2dx}=k∣∣f∣∣2​=∫R​f(x)2dx​=kNote that we’ve limited the l2l^2l2 norm here to a new constant kkk, not bbb, the amount of money with which we initialized our AMM. In the finite-dimensional case, no element of a vector xxx with l2l_2l2​ norm kkk can have a value of greater than kkk, so our l2l_2l2​ 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, bbb, from the l2l^2l2 norm constraint, kkk, and we add an additional constraint to the AMM, namelymax⁡f≤b\max{f}\leq bmaxf≤bTrading BehaviorAt its simplest, the AMM starts by holding some function h(x)=b−f(x)h(x)=b-f(x)h(x)=b−f(x). A trader who wants to move the market to g(x)g(x)g(x), so that the AMM now holds b−g(x)b-g(x)b−g(x), will end up holding g(x)−f(x)g(x)-f(x)g(x)−f(x), the difference of the two functions.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)p(x) so that the expected value of the AMM’s holdings is E(b−f(x))=b−E(f(x))=b−∫Rf(x)p(x)dx=b−f⋅p\mathbb{E}(b-f(x))=b-\mathbb{E}(f(x)) = b - \int_\mathbb{R}f(x)p(x)dx=b-f\cdot pE(b−f(x))=b−E(f(x))=b−∫R​f(x)p(x)dx=b−f⋅pwhere 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 problemmin⁡fb−f⋅p     s.t. ∣∣f∣∣2=k and max⁡f≤b\min_f b - f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=k \text{ and } \max{f}\leq bfmin​b−f⋅p s.t. ∣∣f∣∣2​=k and maxf≤bSince the trader can’t affect bbb, this simplifies tomax⁡ff⋅p     s.t. ∣∣f∣∣2=k and max⁡f≤b\max_f f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=k\text{ and } \max{f}\leq bfmax​f⋅p s.t. ∣∣f∣∣2​=k and maxf≤bFor a moment, assume the AMM has effectively infinite backing, so that the second constraint doesn’t matter and we simply havemax⁡ff⋅p     s.t. ∣∣f∣∣2=k\max_f f\cdot p \,\,\,\,\text{ s.t. } ||f||_2=kfmax​f⋅p s.t. ∣∣f∣∣2​=kThen, 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 ppp — in other words, we know we must havef=kp∣∣p∣∣2f = k\frac{p}{||p||}_2f=k∣∣p∣∣p​2​In other words, fff, the outcome function collectively held by traders, is directly proportional to the true probability distribution!This means that the AMM’s holdings hhh are determined byh=b−f=k(1−p∣∣p∣∣2)h = b -f = k(1-\frac{p}{||p||_2})h=b−f=k(1−∣∣p∣∣2​p​)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 imageHandling the Backing ConstraintWe assumed above for convenience that the AMM’s backing bbb 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)f(x)to situations where we have ∣∣f∣∣2=k||f||_2=k∣∣f∣∣2​=k but max⁡f>b\max{f}>bmaxf>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 bf(x)≤b. Let’s say a trader believes the true probability distribution is p(x)p(x)p(x). We leave it as an exercise to the reader to show that the trader’s optimal position will bef(x)=min⁡(λp(x),b)f(x)=\min(\lambda p(x),b)f(x)=min(λp(x),b)for whatever λ\lambdaλ makes it such that ∣∣min⁡(λp(x),b)∣∣2=k||\min(\lambda p(x),b)||_2=k∣∣min(λp(x),b)∣∣2​=k. We can find λ\lambdaλ numerically offchain and then easily verify this property onchain for many distributions.Liquidity ProvisionThe 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=b−fh=b-fh=b−f. So an LP wanting to add some proportion yyy of current liquidity needs to contribute a position yh=yb−yfyh=yb-yfyh=yb−yf. In return they will receive ylylyl LP shares, where lll is the current number of LP shares outstanding.In order to create the position yhyhyh, we will require the LP to mint it using ybybyb collateral. This means they will be left with a position yb−yh=yb−(yb−yf)=yfyb-yh=yb-(yb-yf)=yfyb−yh=yb−(yb−yf)=yf that they can keep. This represents the market's position at the time they minted their LP shares.CollateralizationThe initial source of collateral to the AMM is the the first LP. If they initialize the pool with backing bbb, they need to submit bbb collateral. They will also specify some initial fff for the pool, so that the pool's position is h=b−fh=b-fh=b−f and the initial LP keeps the position fff. The AMM's position and the position of all traders then sums to bbb, and there is bbb collateral, so the system is fully collateralized.Similarly, when a new LP adds liquidity, they are adding yb−yfyb-yfyb−yf to the pool and keeping yfyfyf for themselves. They are then adding ybybyb to total outstanding holdings, so as long as they provide ybybyb 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 bbb. The market currently holds h=b−fh=b-fh=b−f and a trader moves the market to h2=b−gh_2=b-gh2​=b−g, so that this trader should now hold g−fg-fg−f. If this were the case, then because we know all other traders hold fff in aggregate, then all traders together would hold f+(g−f)=gf+(g-f)=gf+(g−f)=g in aggregate, which means that all traders and the market together hold b−g+g=bb-g+g=bb−g+g=b in aggregate, and the market would still be fully collateralized.However, in order to say the trader holds g−fg-fg−f, they must actually lose money if the outcome is x0x_0x0​ and we have g(x0)−f(x0)<0g(x_0)-f(x_0)<0g(x0​)−f(x0​)<0. So the trader must collateralize this position with−min⁡xg(x)−f(x) -\min_x{g(x)-f(x)}−minx​g(x)−f(x) in collateral. We discuss how to verify this for the Normal case in that section below.The Normal CaseOverviewThe 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_2l2​ NormThe Normal distribution with mean μ\muμ and standard deviation σ\sigmaσ has probability distribution functionp(x)=12πσ2e−(x−μ)22σ2p(x)=\frac{1}{\sqrt{2\pi \sigma^2}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}p(x)=2πσ2​1​e−2σ2(x−μ)2​with l2l^2l2 norm∫R12πσ2e−(x−μ)2σ2 dx=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}}}∫R​2πσ21​e−σ2(x−μ)2​dx​=2σπ​1​​where the latter equality comes from the closed form solution to the Gaussian Integral.AMM BehaviorWe can see that the l2l^2l2 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^2l2 norms. This means that if the market’s estimated normal distribution has standard deviation σ\sigmaσ, we havek=∣∣f∣∣2=∣∣λp∣∣2=λ∣∣p∣∣2=λ12σπk=||f||_2=||\lambda p||_2=\lambda||p||_2=\lambda\sqrt{\frac{1}{2\sigma\sqrt{\pi}}}k=∣∣f∣∣2​=∣∣λp∣∣2​=λ∣∣p∣∣2​=λ2σπ​1​​and thereforeλ=k2σπ\lambda=k\sqrt{2\sigma\sqrt{\pi}}λ=k2σπ​​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 ConstraintsRemember we have f=λpf=\lambda pf=λp, with ppp being a Normal PDF. At its peak, ppp has value 12πσ2\frac{1}{\sqrt{2\pi\sigma^2}}2πσ2​1​. As a multiple of ppp, f has maximum valuemax⁡f=λ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}}}maxf=2πσ2​λ​=k2σπ​​2πσ2​1​=kσπ​1​​Since we can never have f(x)>bf(x)>bf(x)>b, this means we must havemax⁡f=k1σπ≤b\max f = k\sqrt{\frac{1}{\sigma\sqrt{\pi}}}\leq bmaxf=kσπ​1​​≤bso thatσ≥k2b2π\sigma \geq \frac{k^2}{b^2\sqrt{\pi}}σ≥b2π​k2​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))f(x)=min(b,λϕ(x)) for whatever λ\lambdaλ satisfied the l2l_2l2​ 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.CollateralizationAs discussed above in the collateralization section for the general continuous case, traders need to collateralize their trades with −min⁡xg(x)−f(x)-\min_x{g(x)-f(x)}−minx​g(x)−f(x) when moving the AMM from h=b−fh=b-fh=b−f to h2=b−gh_2=b-gh2​=b−g.Unfortunately, there is no apparent closed-form solution to min⁡xap−bq\min_x ap-bqminx​ap−bq, where pppand qqq 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 qqq's mean from ppp'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)}}m=2σq​π​λ′​−2π(σp2​+σq2​)​λ​e−2(σq2​+σp2​)(μp​−μq​)2​Multiple DistributionsNote that we could have a single distribution AMM capable of trading multiple distributions -- as long as the l2l_2l2​ 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.ConclusionWe 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.AcknowledgementsDan Robinson, Yang You, Achal Srinivasan, Bhargav Annem, 5/9, Sofiane Larbi, Ciamac Moallemi, Tom Dean, andnasnd, 0xTomoyo, Pia Park, Qiaochu Yuan, Connor Lurring, Grant Stenger, Santiago LisaWritten byDave WhiteResearch PartnerLinkedInTwitterWarpcastBiographyDave 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.AboutTeamPortfolioWritingOpen SourceCareersLP LoginTwitterLinkedInWarpcastContactTermsDisclosuresPrivacyCA PrivacyCopyright © 2024 Paradigm Operations LP All rights reserved. “Paradigm” is a trademark, and the triangular mobius symbol is a registered trademark of Paradigm Operations LP