Papers
Topics
Authors
Recent
Search
2000 character limit reached

Bernoulli Factory

Updated 14 July 2026
  • Bernoulli factory is a framework that converts random coin tosses with unknown bias into outputs with a target probability via an almost-surely terminating algorithm.
  • It employs constructive methods such as Bernstein polynomials, cascade techniques, and finite-state machines to achieve exact simulation under stringent information constraints.
  • Applications span exact statistical sampling, MCMC, combinatorial optimization, and quantum systems, while challenges remain in extending finite-automata and multivariable constructions.

Searching arXiv for relevant Bernoulli factory papers. A Bernoulli factory is a randomized procedure that transforms Bernoulli randomness with an unknown parameter into Bernoulli randomness with a prescribed transformed parameter, without numerically estimating that parameter. In the standard single-coin formulation, one is given i.i.d. samples from a Bernoulli(p)(p) source with unknown pp, and seeks an almost-surely terminating algorithm that outputs a bit YY satisfying Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p) for a specified function ff (Leme et al., 28 Jun 2026). This framework extends in several directions: to multivariable inputs on the simplex Δs\Delta_s (Leme et al., 28 Jun 2026), to combinatorial outputs associated with vertices of polytopes (Niazadeh et al., 2020), to exact simulation and MCMC for intractable posteriors (Vats et al., 2020), to duality constructions in population genetics and reaction–diffusion models (Koskela et al., 2023), and to quantum settings in which the input is a qubit or “quoin” rather than a classical coin (Patel et al., 2018).

1. Classical definition and existence theory

In the single-coin setting, a Bernoulli factory for f:(0,1)(0,1)f:(0,1)\to(0,1) is a randomized procedure that, given access to an i.i.d. sequence (Xi)i1(X_i)_{i\ge1} with Pr[Xi=1]=p\Pr[X_i=1]=p, outputs a bit YY such that

pp0

The algorithm may toss the input coin adaptively and may use independent randomness, but it is not allowed to learn pp1 numerically; it must work for all pp2 in the domain (Leme et al., 28 Jun 2026).

A standard one-dimensional characterization recalled in later work is that pp3 has a Bernoulli factory iff pp4, pp5, or pp6 is continuous and polynomially bounded, in the sense that there exists pp7 such that

pp8

(Koskela et al., 2023). A closely related formulation states that a function pp9 admits a Bernoulli factory if it is continuous and either constant or satisfies a polynomial lower bound away from YY0 and YY1 (Koskela et al., 2 Oct 2025). This establishes the basic feasibility boundary for classical factories.

Several canonical examples recur across the literature. The function YY2 is constructible only on a restricted domain such as YY3 in the classical model (Patel et al., 2018). By contrast, YY4 is a standard constructible example on YY5 (Patel et al., 2018). More generally, Bernoulli factories are exact simulation primitives rather than estimation procedures: they realize transformed probabilities directly from sample paths, stopping rules, and auxiliary randomness.

2. Constructive methods and complexity

A central constructive strand concerns functions expressible through Bernstein polynomials or power series. Mossel and Peres showed that finite-state implementations correspond to Bernstein-polynomial structure, and, in one variable, to rational functions under suitable regularity conditions (Leme et al., 28 Jun 2026). Independently, practical implementations were developed through envelope and cascade methods for linear, concave, and convex functions, including the elbow function YY6, with substantial reductions in the number of input bits relative to earlier specific constructions (Thomas et al., 2011).

For functions of the form

YY7

Mendo gave a simple general Bernoulli factory with exact expected input cost

YY8

and proved fastness in the sense of an exponential tail for the stopping time (Mendo, 2016). The same paper established an information-theoretic lower bound for any differentiable YY9 admitting a fast factory,

Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)0

and showed asymptotic optimality of the construction for broad classes of functions satisfying Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)1 as Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)2 (Mendo, 2016). In particular, for Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)3, Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)4, the algorithm yields Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)5, including the case Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)6 (Mendo, 2016).

Linear Bernoulli factories form another major line because they are foundational for analytic constructions. For Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)7, Huber developed a new algorithm that, for small values of Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)8, requires roughly only Pr(Y=1p)=f(p)\Pr(Y=1\mid p)=f(p)9 coin flips to generate a ff0 coin, and for larger ff1 improved the best known expected cost bound to about ff2 under ff3 (Huber, 2015). The same work extended the construction to the multivariate linear case ff4 (Huber, 2015).

A more recent development introduced a debiased Bernoulli factory based on random truncation of a telescoping series of consistent estimators. For ff5 with ff6, the construction yields an estimator ff7 almost surely, with ff8, where the random sample size ff9 is independent of the outcomes of the BernoulliΔs\Delta_s0 inputs (Koskela et al., 2 Oct 2025). This can be viewed both as a Bernoulli factory with outcome-independent sample size and as a constructive Δs\Delta_s1-factory (Koskela et al., 2 Oct 2025).

3. Finite-automata factories and multivariable structure

A finite-automata Bernoulli factory is implemented by a finite-state machine that reads input coin tosses one by one, possibly uses finite internal randomness, and eventually halts and outputs Δs\Delta_s2 or Δs\Delta_s3 (Leme et al., 28 Jun 2026). In the Mossel–Peres framework, such factories correspond to representing Δs\Delta_s4 as

Δs\Delta_s5

with Δs\Delta_s6 and Δs\Delta_s7 Bernstein polynomials on the simplex (Leme et al., 28 Jun 2026). In the single-variable setting, this yields the equivalence between finite-automata Bernoulli factories and rational functions of Δs\Delta_s8, under the regularity conditions used there (Leme et al., 28 Jun 2026).

The multivariable situation is subtler. A multivariable Bernoulli factory has access to independent coins with unknown biases Δs\Delta_s9 in the simplex

f:(0,1)(0,1)f:(0,1)\to(0,1)0

and must output a Bernoullif:(0,1)(0,1)f:(0,1)\to(0,1)1 bit (Leme et al., 28 Jun 2026). Mossel and Peres claimed that any rational function f:(0,1)(0,1)f:(0,1)\to(0,1)2 can be simulated via blocks, but a 2026 note shows that the multivariable extension of this characterization is false (Leme et al., 28 Jun 2026).

The obstruction is boundary behavior. Pólya’s theorem applies when a homogeneous polynomial is strictly positive on the closed simplex f:(0,1)(0,1)f:(0,1)\to(0,1)3, but in several variables a coprime denominator can vanish on f:(0,1)(0,1)f:(0,1)\to(0,1)4 without sharing a removable common factor with the numerator (Leme et al., 28 Jun 2026). Paes Leme and Schneider give an explicit counterexample on f:(0,1)(0,1)f:(0,1)\to(0,1)5: f:(0,1)(0,1)f:(0,1)\to(0,1)6 which is polynomially bounded away from f:(0,1)(0,1)f:(0,1)\to(0,1)7 and f:(0,1)(0,1)f:(0,1)\to(0,1)8, hence admits a general Bernoulli factory by Morina’s characterization, but cannot be implemented by a finite-automata Bernoulli factory (Leme et al., 28 Jun 2026). This establishes a strict separation between general and finite-state simulation already for three variables.

The resulting picture is asymmetric. In one variable, rationality and finite-automata simulability coincide under the standard hypotheses (Leme et al., 28 Jun 2026). In higher dimensions, general Bernoulli factories are characterized analytically by continuity plus polynomial lower bounds near the boundary, whereas finite-automata factories form a narrower algebraically constrained subclass, at least containing those functions with a Bernstein rational representation (Leme et al., 28 Jun 2026).

4. Combinatorial and polyhedral Bernoulli factories

A combinatorial Bernoulli factory replaces scalar output by a random vertex of a polytope. Given Bernoulli access to a vector f:(0,1)(0,1)f:(0,1)\to(0,1)9, the task is to output a randomized vertex (Xi)i1(X_i)_{i\ge1}0 such that (Xi)i1(X_i)_{i\ge1}1 (Niazadeh et al., 2020). For example, in the perfect matching polytope, one is given Bernoulli access to the entries of a doubly stochastic matrix (Xi)i1(X_i)_{i\ge1}2 and asked to sample a perfect matching such that the probability of each edge (Xi)i1(X_i)_{i\ge1}3 is exactly (Xi)i1(X_i)_{i\ge1}4 (Niazadeh et al., 2020).

The main characterization is exact: a polytope (Xi)i1(X_i)_{i\ge1}5 admits a Bernoulli factory iff it is the intersection of (Xi)i1(X_i)_{i\ge1}6 with an affine subspace (Niazadeh et al., 2020). The construction is algebraic. One identifies a family of Bernstein polynomials (Xi)i1(X_i)_{i\ge1}7 satisfying

(Xi)i1(X_i)_{i\ge1}8

and then uses a Bernoulli race to output (Xi)i1(X_i)_{i\ge1}9 with probability proportional to Pr[Xi=1]=p\Pr[X_i=1]=p0 (Niazadeh et al., 2020). The main technical tool behind the general construction is a connection between these polynomials and the geometry of zonotope tilings (Niazadeh et al., 2020).

These ideas lead to explicit factories for important combinatorial polytopes. For the perfect matching polytope, the resulting factory is deeply connected to the combinatorial enumeration of arborescences (Niazadeh et al., 2020). For flow-based polytopes, later work constructed explicit Bernoulli factories for integral Pr[Xi=1]=p\Pr[X_i=1]=p1-polytopes defined by network flow constraints, including paths, circulations, and Pr[Xi=1]=p\Pr[X_i=1]=p2-flows (Niazadeh et al., 2022). In that setting, the output is a vertex Pr[Xi=1]=p\Pr[X_i=1]=p3 such that each edge Pr[Xi=1]=p\Pr[X_i=1]=p4 is included with probability Pr[Xi=1]=p\Pr[X_i=1]=p5, equivalently Pr[Xi=1]=p\Pr[X_i=1]=p6 (Niazadeh et al., 2022).

The flow-based construction uses directed trees, arborescences, and matrix-tree-theorem identities. The resulting explicit factory generalizes earlier constructions for bipartite perfect matchings and again exhibits a tight link between Bernoulli factory design and algebraic combinatorics (Niazadeh et al., 2022). This suggests a broader principle: exact randomness transformation from coordinate-wise Bernoulli access is naturally compatible with affine slices of the hypercube, and explicit factories for such slices often mirror the combinatorial structure of their vertex sets.

5. Statistical, probabilistic, and algorithmic applications

Bernoulli factories are widely used as exact simulation primitives. In exact sampling for intractable probability distributions, a Bernoulli factory for a linear function Pr[Xi=1]=p\Pr[X_i=1]=p7 is used inside a rejection sampler for the mixture index in a regenerative representation of the stationary law of a geometrically ergodic Markov chain (Flegal et al., 2010). There, the unknown Pr[Xi=1]=p\Pr[X_i=1]=p8 is a tail probability Pr[Xi=1]=p\Pr[X_i=1]=p9 of a regeneration time, and the Bernoulli factory converts simulation access to YY0 into an exact acceptance decision (Flegal et al., 2010). This enabled proof-of-concept exact sampling for a univariate Metropolis–Hastings sampler, a bivariate Gibbs sampler, and a Bayesian one-way random effects model (Flegal et al., 2010).

Bernoulli factories also enter exact MCMC for intractable posteriors through acceptance rules that are not explicit functions of target-density ratios. A family of “portkey Barker’s algorithms” introduces acceptance probabilities of the form

YY1

with symmetric YY2, and uses stable Bernoulli factories based on upper or lower local bounds on YY3 (Vats et al., 2020). These methods are exact and computationally more efficient than the current state-of-the-art in applications to Bayesian inference for diffusions and MCMC on constrained spaces (Vats et al., 2020).

A distinct theoretical application appears in population genetics and reaction–diffusion theory. The Keane–O’Brien Bernoulli factory, in a form where the random number of input coins is independent of their outcomes, is used as a structural device to derive duality relations for Wright–Fisher diffusions with general frequency-dependent selection and for Allen–Cahn equations with general nonlinear forcing terms (Koskela et al., 2023). In the Wright–Fisher setting, the drift

YY4

is linked to a branching-coalescing ancestral process whose branching law is dictated by the Bernoulli factory representation of YY5 (Koskela et al., 2023). In the Allen–Cahn setting, the same factory induces a branching/voting mechanism in a branching Brownian motion dual (Koskela et al., 2023). This is the first connection drawn between Bernoulli factories and duality in models of population genetics (Koskela et al., 2023).

These applications illustrate two complementary roles. In computational statistics, Bernoulli factories supply exact accept/reject subroutines when only probabilistic access to model quantities is available (Flegal et al., 2010). In stochastic-process theory, they can encode nonlinear drift or forcing through branching mechanisms whose law is determined by the factory itself (Koskela et al., 2023).

6. Quantum Bernoulli factories

Quantum Bernoulli factories replace the classical coin by a qubit whose measurement reproduces the unknown bias. A standard quoin encoding is

YY6

so that measurement in the computational basis yields a BernoulliYY7 outcome (Patel et al., 2018). A quantum Bernoulli factory takes an i.i.d. supply of such states and uses quantum operations and measurements to realize a target function YY8 in the output distribution (Patel et al., 2018).

Experimentally, quantum resources can outperform classical ones. A photonic implementation demonstrated two quantum Bernoulli factories: a single-qubit coherence-only protocol and a two-qubit protocol using entangling measurements (Patel et al., 2018). For the target function YY9 or a capped variant, the former consumed three orders of magnitude fewer resources than the best known classical method, while the latter offered a further five-fold reduction (Patel et al., 2018). More recently, an experiment on IBM superconducting hardware used Bell-basis measurements of two identical input quoins to realize an exact fair coin pp00, the classically inconstructible function pp01, and the classically inconstructible Bernoulli doubling primitive pp02 in symmetrized form (Roy, 5 Feb 2026).

A further development concerns quantum-to-quantum Bernoulli factories, in which both input and output are quantum states. Using the stereographic parameterization

pp03

the task is to transform pp04 into pp05 for a prescribed function pp06 (Hoch et al., 2024). A modular integrated photonic implementation showed that inversion, product, and sum operations on the parameter pp07 can be realized by fixed interferometric modules, and because rational functions are generated by these field operations, the scheme is universal for the class of quantum-to-quantum Bernoulli factory functions realizable in this framework (Hoch et al., 2024).

Subsequent work formalized complexity and multi-functional variants of the quantum-to-quantum model. For multivariate rational functions pp08, the required number of input coin states in each variable equals the degree in that variable, and an explicit optimal success probability was derived (Hoch et al., 11 Dec 2025). The same work also analyzed multi-functional factories, in which a single unitary can implement several Bernoulli-factory transformations depending on a control input (Hoch et al., 11 Dec 2025). This line of research positions Bernoulli factories as coherent randomness-processing primitives for quantum algorithms, Bayesian inference, Monte Carlo methods, and blind quantum computation (Hoch et al., 11 Dec 2025).

7. Conceptual synthesis and open structure

Across its classical, combinatorial, and quantum forms, the Bernoulli factory problem is a theory of exact randomness transformation under information constraints. The input parameter is unknown, but sample access to Bernoulli or quoin realizations is available. The central question is not approximation but implementability: which transformations can be realized exactly, with what resources, and under what structural constraints.

The classical theory now has several sharp dividing lines. In one variable, continuity plus polynomial lower bounds characterize general feasibility (Koskela et al., 2023). For important subclasses, constructive methods with explicit complexity bounds are available (Mendo, 2016). For finite-state implementations, the single-variable picture is algebraic and clean, but the multivariable rational characterization fails (Leme et al., 28 Jun 2026). In combinatorial settings, the exact polyhedral criterion is affine: Bernoulli factories exist precisely for affine slices of the hypercube (Niazadeh et al., 2020). In quantum settings, the reachable function classes and achievable efficiencies differ substantially from the classical ones, and experimentally demonstrated advantages already exist (Patel et al., 2018).

Several open directions are explicitly identified in the recent literature. For finite-automata multivariable factories, a full characterization beyond Bernstein-rational representability remains unknown (Leme et al., 28 Jun 2026). For exact statistical simulation, practical efficiency still depends strongly on problem-specific bounds and model structure (Flegal et al., 2010). For debiased and outcome-independent-sample-size factories, relaxing smoothness assumptions while preserving pp09-valued unbiasedness is an open question (Koskela et al., 2 Oct 2025). In the quantum-to-quantum regime, rational-function simulability is understood, but broader approximation and fault-tolerant implementations remain natural next steps (Hoch et al., 11 Dec 2025).

Bernoulli factories therefore occupy a distinctive position at the interface of probability, exact simulation, combinatorics, and quantum information. They are simultaneously a foundational model of randomness processing and a practical subroutine for algorithms that require exact transformed sampling from unknown parameters.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Bernoulli Factory.