Gibbs states and the set of solutions of random constraint satisfaction problems
 ^{a}Laboratoire de PhysicoChimie Théorique, Ecole Supérieure de Physique et de Chimie Industrielles, 75005 Paris, France,
 ^{b}Departments of Electrical Engineering and Statistics, Stanford University, CA 94305;
 ^{c}Laboratoire de Physique Théorique, Ecole Normale Supérieure, Université Pierre et Marie Curie, 75005 Paris, France;
 ^{e}Dipartimento di Fisica and Consiglio Nazionale delle Ricerche–Istituto Nazionale per la Fisica della Materia, Università di Roma “La Sapienza,” I00185 Rome, Italy; and
 ^{f}Laboratoire de Physique Théorique et Modèles Statistiques, Université de ParisSud, 91405 Orsay, France
See allHide authors and affiliations

Communicated by Giorgio Parisi, University of Rome, Rome, Italy, April 25, 2007 (received for review November 29, 2006)
Abstract
An instance of a random constraint satisfaction problem defines a random subset 𝒮 (the set of solutions) of a large product space X ^{N} (the set of assignments). We consider two prototypical problem ensembles (random ksatisfiability and qcoloring of random regular graphs) and study the uniform measure with support on S. As the number of constraints per variable increases, this measure first decomposes into an exponential number of pure states (“clusters”) and subsequently condensates over the largest such states. Above the condensation point, the mass carried by the n largest states follows a PoissonDirichlet process. For typical large instances, the two transitions are sharp. We determine their precise location. Further, we provide a formal definition of each phase transition in terms of different notions of correlation between distinct variables in the problem. The degree of correlation naturally affects the performances of many search/sampling algorithms. Empirical evidence suggests that local Monte Carlo Markov chain strategies are effective up to the clustering phase transition and belief propagation up to the condensation point. Finally, refined message passing techniques (such as survey propagation) may also beat this threshold.
Constraint satisfaction problems (CSPs) arise in a large spectrum of scientific disciplines. An instance of a CSP is said to be satisfiable if there exists an assignment of N variables (x _{1}, x _{2}, …, x _{N} ) x , x _{i} ∈ 𝒳 (𝒳 being a finite alphabet), which satisfies all of the constraints within a given collection. The problem is in finding such an assignment or showing that the constraints are unsatisfiable. More precisely, one is given a set of functions ψ _{a} : 𝒳 ^{k} → {0, 1}, with a ∈ {1, …, M} [M] and of ktuples of indices {i _{a} (1), …, i _{a} (k)} ⊆ [N], and has to establish whether there exists x ∈ 𝒳^{N} such that ψ _{a} (x _{i} _{a} _{(1)}, …, x _{i} _{a} _{(k)}) = 1 for all as. In this article we shall consider two well known families of CSPs [both known to be NPcomplete (1)]:

(i) ksatisfiability (kSAT) with k ≥ 3. In this case 𝒳 = {0, 1}. The constraints are defined by fixing a ktuple [z _{a} (1), …, z _{a} (k)] for each a, and setting ψ _{a} (x _{ia} _{(1)} , …, x _{ia} _{(k)} ) = 0 if (x _{ia} _{(1)}, …, x _{ia} _{(k)} = (z _{a} (1), …, z _{a} (k)) and = 1 otherwise.

(ii) qcoloring (qCOL) with q ≥ 3. Given a graph G with N vertices and M edges, one is asked to assign colors x _{i} ∈ 𝒳 {1, …, q} to the vertices in such a way that no edge has the same color at both ends.
The optimization (maximize the number of satisfied constraints) and counting (count the number of satisfying assignments) versions of this problems are defined straightforwardly. It is also convenient to represent CSP instances as factor graphs (2), i.e., bipartite graphs with vertex sets [N], [M] including an edge between node i ∈ [N] and a ∈ [M] if, and only if, the ith variable is involved in the ath constraint (compare Fig. 1). This representation allows one to define naturally a distance d(i, j) between variable nodes.
Ensembles of random CSPs (rCSPs) were introduced (see e.g., ref. 3) with the hope of discovering generic mathematical phenomena that could be exploited in the design of efficient algorithms. Indeed several search heuristics, such as WalkSAT (4) and “myopic” algorithms (5) have been successfully analyzed and optimized over rCSP ensembles. The most spectacular advance in this direction has probably been the introduction of a new and powerful message passing algorithm (survey propagation, SP) (6). The original justification for SP was based on the (nonrigorous) cavity method from spin glass theory. Subsequent work proved that standard message passing algorithms (such as belief propagation, BP) can indeed be useful for some CSPs (7–9). Nevertheless, the fundamental reason for the (empirical) superiority of SP in this context remains to be understood and is a major open problem in the field. Building on a refined picture of the solution set of rCSP, this article provides a possible (and testable) explanation. We consider two ensembles that have attracted the majority of work in the field: (i) random kSAT: each kSAT instance with N variables and M = Nα clauses is considered with the same probability; (ii) qCOL on random graphs: the graph G is uniformly random among the ones over N vertices, with uniform degree l (the number of constraints is therefore M = Nl/2).
Phase Transitions in rCSP
It is well known that rCSPs may undergo phase transitions as the number of constraints per variable α is varied. ^{g} The best known of such phase transitions is the SATUNSAT one: as α crosses a critical value α_{s}(k) (that can, in principle, depend on N), the instances pass from being satisfiable to unsatisfiable with high probability ^{h} (10). For kSAT, it is known that α_{s}(2) = 1. A conjecture based on the cavity method was put forward in ref. 6 for all k ≥ 3 that implied in particular the values presented in Table 1 and α_{s}(k) = 2 ^{k} log 2 − (1 + log 2)/2 + O (2^{−} ^{k} ) for large k (11). Subsequently, it was proved that α_{s}(k) = 2 ^{k} log 2 − O(k), confirming this asymptotic behavior (12). An analogous conjecture for qCOL was proposed in ref. 13 yielding, for regular random graphs (14), the values reported in Table 1 and l _{s} (q) = 2q log q − log q − 1 + o(1) for large q [according to our convention, random graphs are with high probability uncolorable if l ≥ l _{s} (q)]. It was proved in refs. 12 and 15 that l _{s} (q) = 2q log q − O(log q).
Even more interesting and challenging are phase transitions in the structure of the set 𝒮 ⊆ 𝒳^{N} of solutions of rCSP's (“structural” phase transitions). Assuming the existence of solutions, a convenient way of describing 𝒮 is to introduce the uniform measure over solutions μ( x ): where Z ≥ 1 is the number of solutions. Let us stress that, since 𝒮 depends on the rCSP instance, μ is itself random.
We shall now introduce a few possible “global” characterizations of the measure μ. Each one of these properties has its counterpart in the theory of Gibbs measures, and we shall partially adopt that terminology here (17).
To define the first of such characterizations, we let i ∈ [N] be a uniformly random variable index, denote as x _{ℓ} the vector of variables whose distance from i is at least ℓ, and by μ(x _{i}  x _{ℓ}) the marginal distribution of x _{i} given x _{ℓ}. Then we say that the measure (Eq. 1 ) satisfies the uniqueness condition if for any given i ∈ [N], as ℓ → ∞ (here and below the limit N → ∞ is understood to be taken before ℓ → ∞). This expresses a “worst case” correlation decay condition. Roughly speaking: the variable x _{i} is (almost) independent of the far apart variables x _{ℓ} irrespective of the instance realization and the variables distribution outside the horizon of radius ℓ. The threshold for uniqueness (above which uniqueness ceases to hold) was estimated in ref. 9 for random kSAT, yielding α _{u} (k) = (2 log k)/k [1 + o(1)] (which is asymptotically close to the threshold for the pure literal heuristics) and in ref. 18 for coloring implying l _{u} (q) = q for q large enough (a “numerical” proof of the same statement exists for small q). Below such thresholds BP can be proved to return good estimates of the local marginals of the distribution (Eq. 1 ).
Notice that the uniqueness threshold is far below the SATUNSAT threshold. Furthermore, several empirical studies (19, 20) pointed out that BP [as well as many other heuristics (4, 5)] is effective up to much larger values of the clause density. In a remarkable series of papers (6, 21), statistical physicists argued that a second structural phase transition is more relevant than the uniqueness one. Following this literature, we shall refer to this as the “dynamic phase transition” and denote the corresponding threshold as α_{d}(k) [or l _{d}(q)]. To precise this notion, we provide here two alternative formulations corresponding to two distinct intuitions. According to the first one, above α_{d}(k) the variables (x _{1} , …, x _{N} ) become globally correlated under μ. The criterion in 2 is replaced by one in which far apart variables x _{ℓ} are themselves sampled from μ (“extremality” condition): as ℓ → ∞. The infimum value of α (respectively l) such that this condition is no longer fulfilled is the threshold α_{d}(k) (l _{d}(k)). Of course this criterion is weaker than the uniqueness one [hence α_{d}(k) ≥ α _{u} (k)].
According to the second intuition, above α_{d}(k), the measure (Eq. 1 ) decomposes into a large number of disconnected “clusters.” This means that there exists a partition {A _{n} } _{n=1 … 𝒩} of 𝒳 ^{N} (depending on the instance) such that: (i) one cannot find n such that μ(A _{n} ) → 1; (ii) denoting by ∂ _{ϵ} A the set of configurations x ∈ 𝒳 ^{N} \A whose Hamming distance from A is at most Nϵ, we have μ(∂ _{ϵ} A _{n} )/μ(A _{n} )(1 − μ(A _{n} )) → 0 exponentially fast in N for all n and ϵ small enough. Notice that the measure μ can be decomposed as: where w _{n} μ(A _{n} ) and μ _{n} μ( ·  A _{n} ). We shall always refer to {A _{n} } as the “finer” partition with these properties.
The above ideas are obviously related to the performance of algorithms. For instance, the correlation decay condition in Eq. 3 is likely to be sufficient for approximate correctness of BP on random formulae. Also, the existence of partitions as above implies exponential slowing down in a large class of Monte Carlo Markov chain sampling algorithms. ^{i}
Recently, some important rigorous results were obtained supporting this picture (22, 23). However, even at the heuristic level, several crucial questions remain open. The most important concern the distribution of the weights {w _{n} }: are they tightly concentrated (on an appropriate scale) or not? A (somewhat surprisingly) related question is: can the absence of decorrelation above α_{d}(k) be detected by probing a subset of variables bounded in N?
SP (6) can be thought as an inference algorithm for a modified graphical model that gives unit weight to each cluster (20, 24), thus tilting the original measure toward small clusters. The resulting performances will strongly depend on the distribution of the cluster sizes w _{n} . Further, under the tilted measure, α_{d}(k) is underestimated because small clusters have a larger impact. The correct value was never determined (but see ref. 16 for coloring). Mézard et al. (25) undertook the technically challenging task of determining the cluster size distribution without, however, clarifying several of its properties.
In this article we address these issues and unveil at least two unexpected phenomena. Our results are described in Results and Discussion and summarized in Fig. 2. Finally, we discuss the connection with the performances of SP. Some technical details of the calculation are collected in Cavity Formalism, Tree Reconstruction, and SP.
Results and Discussion
The formulation in terms of extremality condition (see Eq. 3 ) allows for an heuristic calculation of the dynamic threshold α_{d}(k). Previous attempts were based instead on the cavity method, which is an heuristic implementation of the definition in terms of pure state decomposition (see Eq. 4 ). Generalizing the results of ref. 16, it is possible to show that the two calculations provide identical results. However, the first one is technically simpler and under much better control. As mentioned above we obtain, for all k ≥ 4 a value of α_{d}(k) larger than the one quoted in refs. 6 and 11.
Further we determined the distribution of cluster sizes w _{n} , thus unveiling a third “condensation” phase transition at α _{c} (k) ≥ α_{d}(k) (strict inequality holds for k ≥ 4 in SAT and q ≥ 4 in coloring, see below). For α < α _{c} (k) the weights w _{n} concentrate on a logarithmic scale [namely, −log w _{n} is θ(N) with θ(N ^{1/2} ) fluctuations]. Roughly speaking, the measure is evenly split among an exponential number of clusters.
For α > α_{c}(k) [and < α _{s} (k)] the measure is carried by a subexponential number of clusters. More precisely, the ordered sequence {w _{n} } converges to a well known PoissonDirichlet process {w∗_{n}}, first recognized in the spin glass context by Ruelle (26). This is defined by w∗_{n} = x _{n} /Σx _{n} , where x _{n} > 0 are the points of a Poisson process with rate x ^{−1−m} ^{(α)} and m(α) ∈ (0, 1). This picture is known in spin glass theory as onestep replica symmetry breaking (1RSB) and has been proven in ref. 27 for some special models. The Parisi 1RSB parameter m(α) is monotonically decreasing from 1 to 0 when α increases from α _{c} (k) to α _{s} (k) (see Fig. 3).
Remarkably, the condensation phase transition is also linked to an appropriate notion of correlation decay. If i(1), …, i(n) ∈ [N] are uniformly random variable indices, then, for α < α _{c} (k) and any fixed n: as N → ∞. Conversely, the quantity on the left side of Eq. 5 remains positive for α > α _{c} (k). It is easy to understand that this condition is even weaker than the extremality one (compare Eq. 3 ) in that we probe correlations of finite subsets of the variables. In the next two sections we discuss the calculation of α_{d} and α_{c}.
Dynamic Phase Transition and Gibbs Measure Extremality.
A rigorous calculation of α_{d}(k) along any of the two definitions provided above (compare Eqs. 3 and 4 ) remains an open problem. Each of the two approaches has, however, an heuristic implementation that we shall now describe. It can be proved that the two calculations yield equal results as further discussed in the last section.
The approach based on the extremality condition in Eq. 3 relies on an easytostate assumption and typically provides a more precise estimate. We begin by observing that, because of the Markov structure of μ, it is sufficient for Eq. 3 to hold that the same condition is verified by the correlation between x _{i} and the set of variables at distance exactly ℓ from i, that we shall keep denoting as x _{ℓ} . The idea is then to consider a large yet finite neighborhood of i. Given ℓ̄ ≥ ℓ, the factor graph neighborhood of radius ℓ̄ around i converges in distribution to the radiusℓ̄ neighborhood of the root in a well defined random tree factor graph T.
For coloring of random regular graphs, the correct limiting tree model T is coloring on the infinite lregular tree. For random kSAT, T is defined by the following construction. Start from the root variable node and connect it to l new function nodes (clauses), l being a Poisson random variable of mean kα. Connect each of these function nodes with k − 1 new variables and repeat. The resulting tree is infinite with nonvanishing probability if α > 1/k(k− 1). Associate a formula to this graph in the usual way, with each variable occurrence being negated independently with probability 1/2.
The basic assumption within the first approach is that the extremality condition in Eq. 3 can be checked on the correlation between the root and generationℓ variables in the tree model. On the tree, μ is defined to be a translation invariant Gibbs measure (17) associated to the infinite factor graph ^{j} T (which provides a specification). The correlation between the root and generationℓ variables can be computed through a recursive procedure (defining a sequence of distributions P̄_{ℓ} , see Eq. 15 below). The recursion can be efficiently implemented numerically yielding the values presented in Table 1 for k (resp. q) = 4, 5, 6. For large k (resp. q) one can formally expand the equations on P _{ℓ} and obtain: with γ_{d} = 1 (under a technical assumption of the structure of P _{ℓ}).
The second approach to the determination of α_{d}(k) is based on the “cavity method” (6, 25). It begins by assuming a decomposition in pure states of the form 4 with two crucial properties: (i) if we denote by W _{n} the size of the nth cluster (and hence w _{n} = W _{n} /Σ W _{n} ), then the number of clusters of size W _{n} = e^{Ns} grows approximately as e^{N} ^{Σ} ^{(s)} ; (ii) for each singlecluster measure μ _{n} , a correlation decay condition of the form 3 holds.
The approach aims at determining the rate function Σ(s), complexity: the result is expressed in terms of the solution of a distributional fixed point equation. For the sake of simplicity we describe here the simplest possible scenario ^{k} resulting from such a calculation (compare Fig. 4). For α < α_{d,−∞}(k) the cavity fixed point equation does not admit any solution: no clusters are present. At α_{d,−∞}(k) a solution appears, eventually yielding, for α > α_{d,+} a nonnegative complexity Σ(s) for some values of s ∈ ℝ_{+}. The maximum and minimum such values will be denoted by s _{max} and s _{min}. At a strictly larger value α_{d,0}(k), Σ(s) develops a stationary point (local maximum). It turns out that α_{d,0}(k) coincides with the threshold computed in refs. 6, 11, and 14. In particular, α_{d,0}(4) ≈ 8.297, α_{d,0}(5) ≈ 16.12, α_{d,0}(6) ≈ 30.50 and l _{d,0}(4) = 9, l _{d,0}(5) = 13, l _{d,0}(6) = 17. For large k (resp. q), α_{d,0}(k) admits the same expansion as in Eqs. 6 and 7 with γ_{d,0} = 1 − log 2. However, up to the larger value α_{d}(k), the appearance of clusters is irrelevant from the point of view of μ. In fact, within the cavity method it can be shown that e^{N[s+Σ(s)]} remains exponentially smaller than the total number of solutions Z: most of the solutions are in a single cluster. The value α_{d}(k) is determined by the appearance of a point s _{∗} with Σ′(s _{∗}) = −1 on the complexity curve. Correspondingly, one has Z ≈ e ^{N[Σ}(s_{∗})+s_{∗}]: most of the solutions are comprised in clusters of size about e^{Ns} ^{∗}. The entropy per variable φ = lim _{N→∞} N ^{−1} log Z remains analytic at α_{d}(k).
Condensation Phase Transition.
As α increases above α_{d}, Σ(s _{∗}) decreases: clusters of highly correlated solutions may no longer satisfy the newly added constraints. In Fig. 5 Inset, we show the α dependency of Σ(s _{∗}) for 4SAT. In the large k limit, with α = ρ2 ^{k} we get Σ(s _{∗}) = log 2 − ρ − log 2 e ^{−k} ^{ρ} + O(2 ^{−k} ), and s _{∗} = log 2e ^{−k} ^{ρ} + O(2 ^{−k} ).
The condensation point α_{c}(k) is the value of α such that Σ(s _{∗}) vanishes: above α_{c}(k), most of the measure is contained in a subexponential number of large clusters ^{l} . Our estimates for α_{c}(k) are presented in Table 1 [see also Fig. 4 for Σ(s) in the sixcoloring] while in the largek limit we obtain α_{c}(k) = 2 ^{k} log 2 − 3/2 log 2 + O(2^{−} ^{k} ) [recall that the SATUNSAT transition is at α_{s}(k) = 2 ^{k} log 2 − (1 + log 2)/2 + O(2 ^{−k} )] and l _{c}(q) = 2q log q − log q − 2 log 2 + o(1) [with the COLUNCOL transition at l _{s}(q) = 2q log q − log q − 1 + o(1)]. Technically, the size of dominating clusters is found by maximizing Σ(s) + s over the s interval on which Σ(s) ≥ 0. For α ∈ [α_{c}(k), α_{s}(k)], the maximum is reached at s _{max}, with Σ(s _{max}) = 0 yielding φ = s _{max}. It turns out that the solutions are comprised within a finite number of clusters, with entropy e^{Nsmax+Δ} , where Δ = θ(1). The shifts Δ are asymptotically distributed according to a Poisson point process of rate e ^{−m} ^{(α)} ^{Δ} with m(α) = −Σ′(s _{max}). This leads to the Poisson Dirichlet distribution of weights discussed above. Finally, the entropy per variable φ is nonanalytic at α_{c}(k).
Let us conclude by stressing two points. First, we avoided the 3SAT and threecoloring cases. These cases [as well as the threecoloring on ErdösRényi graphs (25)] are particular in that the dynamic transition point α_{d} is determined by a local instability [a KestenStigum (28, 29) condition, see also ref. 21], yielding α_{d}(3) ≈ 3.86 and l _{d}(3) = 6 (the case l = 5, q = 3 being marginal). Related to this is the fact that α _{c} = α_{d}: throughout the clustered phase, the measure is dominated by a few large clusters [technically, Σ(s _{∗}) < 0 for all α > α_{d}]. Second, we did not check the local stability of the 1RSB calculation. By analogy with ref. 30, we expect that an instability can modify the curve Σ(s) but not the values of α_{d} and α_{c}.
Algorithmic Implications.
Two message passing algorithms were studied extensively on random kSAT: BP and SP (mixed strategies were also considered in refs. 19 and 20). A BP message ν_{u→v}(x) between nodes u and v on the factor graph is usually interpreted as the marginal distribution of x _{u} (or x _{v} ) in a modified graphical model. An SP message is instead a distribution over such marginals P_{u→v}(ν). The empirical superiority of SP is usually attributed to the existence of clusters (6): the distribution P_{u→v}(ν) is a survey of the marginal distribution of x _{u} over the clusters. As a consequence, according to the standard wisdom, SP should outperform BP for α > α_{d}(k).
This picture, however, has several problems. Let us list two of them. First, it seems that essentially local algorithms (such as message passing ones) should be sensitive only to correlations among finite subsets of the variables ^{m} , and these remain bounded up to the condensation transition. Recall in fact that the extremality condition in Eq. 3 involves a number of variables unbounded in N, while the weaker in Eq. 5 is satisfied up to α_{c}(k).
Second, it would be meaningful to weight uniformly the solutions when computing the surveys P_{u→v}(ν). In the cavity method jargon, this corresponds to using a 1RSB Parisi parameter r = 1 instead of r = 0 as is done in ref. 6. It is a simple algebraic fact of the cavity formalism that for r = 1 the means of the SP surveys satisfy the BP equations. Since the means are the most important statistics used by SP to find a solution, BP should perform roughly as SP. Both arguments suggest that BP should perform well up to the condensation point α_{c}(k). We tested this conclusion on 4SAT at α = 9.5 ∈ [α_{d}(4), α_{c}(4)], through the following numerical experiment (compare Fig. 6). (i) Run BP for t _{max} iterations. (ii) Compute the BP estimates ν _{i} (x) for the singlebit marginals and choose the one with largest bias. (iii) Fix x _{i} = 0 or 1 with probabilities ν _{i} (0), ν _{i} (1). (iv) Reduce the formula accordingly (i.e., eliminate the constraints satisfied by the assignment of x _{i} and reduce the ones violated). This cycle is repeated until a solution is found or a contradiction is encountered. If the marginals ν _{i} were correct, this procedure would provide a satisfying assignment sampled uniformly from μ. In fact, we found a solution with finite probability (≈0.4), despite the fact that α > α_{d}(4). The experiment was repeated at α = 9 with a similar fraction of successes.
Above the condensation transition, correlations become too strong and the BP fixed point no longer describes the measure μ. Indeed the same algorithm proved unsuccessful at α = 9.7 ∈ [α_{c}(4), α _{s} (4)]. As mentioned above, SP can be regarded as an inference algorithm in a modified graphical model that weights preferentially small clusters. More precisely, it selects clusters of size e^{Ns̄} with s̄ maximizing the complexity Σ(s). With respect to the new measure, the weak correlation condition in Eq. 5 still holds and allows one to perform inference by message passing.
Within the cavity formalism, the optimal choice would be to take r ≈ m(α) ∈ [0, 1). Any parameter corresponding to a nonnegative complexity r ∈ [0, m(α)] should, however, give good results. SP corresponds to the choice r = 0 that has some definite computational advantages, since messages have a compact representation in this case (they are real numbers).
Cavity Formalism, Tree Reconstruction, and SP
This section provides some technical elements of our computation. The reader not familiar with this topic should consult refs. 6, 11, 25, and 32 for a more extensive introduction. The expert reader will find a new derivation and some hints of how we overcame technical difficulties.
On a tree factor graph, the marginals of μ, Eq. 1 can be computed recursively. The edge of the factor graph from variable node i to constraint node a (respectively from a to i) carries “message” η̄_{i→a} (ν̄ _{a→i} ), a probability measure on 𝒳 defined as the marginal of x _{i} in the modified graphical model obtained by deleting constraint node a (resp. all constraint nodes around i apart from a). The messages are determined by the equations: where ∂u is the set of nodes adjacent to u, \ denotes the set subtraction operation, and x _{A} = {x _{j} : j ∈ A}. These are just the BP equations for the model (1). The constants z _{i→a} , ẑ _{a→i} are uniquely determined from the normalization conditions Σ _{x} _{i} η̄ _{i→a} (x _{i} ) = Σ _{x} _{i} v̄_{a→i} (x _{i} ) = 1. In the following we refer to these equations by introducing functions f _{i→a} , f _{a→i} such that: The marginals of μ are then computed from the solution of these equations. For instance μ(x _{i} ) is a function of the messages ν̄_{a→i} from neighboring function nodes.
The log number of solutions, log Z, can be expressed as a sum of contributions that are local functions of the messages that solve Eqs. 8 and 9 : where the last sum is over undirected edges in the factor graph and Each term z gives the change in the number of solutions when merging different subtrees (for instance, log z _{i} is the change in entropy when the subtrees around i are glued together). This expression coincides with the Bethe freeenergy (31) as expressed in terms of messages.
To move from trees to loopy graphs, we first consider an intermediate step in which the factor graph is still a tree but a subset of the variables, x _{B} = {x _{j} : j ∈ B} is fixed. We are therefore replacing the measure μ (compare Eq. 1 ), with the conditional one μ( ·  x _{B} ). In physics terms, the variables in x _{B} specify a boundary condition.
Notice that the measure μ( ·  x _{B} ) still factorizes according to (a subgraph of) the original factor graph. As a consequence, the conditional marginals μ(x _{i}  x _{B} ) can be computed along the same lines as above. The messages η_{i→a} ^{xB} and ν_{a→i} ^{xB} obey Eq. 10 , with an appropriate boundary condition for messages from B. Also, the number of solutions that take values x _{B} on j ∈ B [call it Z( x _{B} )] can be computed by using Eq. 11.
Next, we want to consider the boundary variables themselves as random variables. More precisely, given r ∈ ℝ, we let the boundary to be x _{B} with probability where 𝒵(r) enforces the normalization Σ_{ x B} μ̃( x _{B} ) = 1. Define P _{i→a} (η) as the probability density of η_{i→a} ^{xB} when x _{B} is drawn from μ̃, and similarly Q _{a→i} (ν). One can show that Eq. 8 implies the following relation between messages distributions: where f_{i→a} is the function defined in Eq. 10 , z_{i→a} is determined by Eq. 8 , and 𝒵 _{i→a} is a normalization. A similar equation holds for Q_{a→i} (ν). These coincide with the 1RSB equations with Parisi parameter r. SP corresponds to a particular parameterization of Eq. 13 (and the analogous one expressing Q_{a→i} in terms of the Ps) valid for r = 0.
The logpartition function Φ(r) = log 𝒵(r) admits an expression that is analogous to Eq. 11 , where the shifts 𝒵(⋯) are defined through moments of order r of the zs, and sums run over vertices not in B. For instance 𝒵 _{ai} is the expectation of z _{ai} (η, ν) ^{r} when η, ν are independent random variables with distribution (respectively) P _{i} _{→a} and Q _{a→i} . The (Shannon) entropy of the distribution μ̃ is given by Σ(r) = Φ(r) − rΦ′(r).
As mentioned, the above derivation holds for tree factor graphs. Nevertheless, the local recursion equations 10 and 13 can be used as an heuristics on loopy factor graphs as well. Further, although we justified Eq. 13 through the introduction of a random boundary condition x _{B} , we can take B = ∅ and still look for nondegenerate solutions of such equations.
Starting from an arbitrary initialization of the messages, the recursions are iterated until an approximate fixed point is reached. After convergence, the distributions P _{i→a} , Q _{a→i} can be used to evaluate the potential Φ(r) (compare Eq. 14 ). From this we compute the complexity function Σ(r) Φ(r) − rΦ′(r) that gives access to the decomposition of μ in pure states. More precisely, Σ(r) is the exponential growth rate of the number of states with internal entropy s = Φ′(r). This is how curves such as in Fig. 4 are traced.
In practice, it can be convenient to consider the distributions of messages P _{i→a} , Q _{a→i} with respect to the graph realization. This approach is sometimes referred to as density evolution in coding theory. If one considers a uniformly random directed edge i → a (or a → i) in a rCSP instance, the corresponding message will be a random variable. After t parallel updates according to Eq. 13 , the message distribution converges (in the N → ∞ limit) to a well defined law 𝒫 _{t} (for variable to constraint messages) or 𝒬 _{t} (for constraint to variable). As t → ∞, these converge to a fixed point 𝒫, 𝒬 that satisfies the distributional equivalent of Eq. 13.
To be definite, let us consider the case of graph coloring. Since the compatibility functions are pairwise in this case (i.e., k = 2 in Eq. 1 ), the constrainttovariable messages can be eliminated and Eq. 13 takes the form: where f is defined by η(x) = z ^{−1} Π _{l} (1 − η _{l} (x)) and z by normalization. The distribution of P_{i→j} is then assumed to satisfy a distributional version of the last equation. In the special case of random regular graphs, a solution is obtained by assuming that P _{i→j} is indeed independent of the graph realization and i, j. One has therefore simply to set P _{i→j} = P in the above and solve it for P.
In general, finding messages distributions 𝒫, 𝒬 that satisfy the distributional version of Eq. 13 is an extremely challenging task, even numerically. We adopted the population dynamics method (32), which represents the distributions by samples (this is closely related to particle filters in statistics). For instance, one represents 𝒫 by a sample of Ps, each encoded as a list of ηs. Since computer memory drastically limits the samples size, and thus the precision of the results, we worked in two directions: (i) we analytically solved the distributional equations for large k (in the case of kSAT) or q (qCol); and (ii) we identified and exploited simplifications arising for special values of r.
Let us briefly discuss the second point. Simplifications emerge for r = 0 and r = 1. The first case corresponds to SP. Refs. 6 and 11 showed how to compute efficiently Σ(r = 0) through population dynamics. Building on this, we could show that the clusters internal entropy s(r = 0) can be computed at a small supplementary cost.
The value r = 1 corresponds instead to the tree reconstruction problem (33): In this case μ̃( x _{B} ) (compare Eq. 12 ), coincides with the marginal of μ. Averaging Eq. 13 (and the analogous one for Q _{a→i} ) one obtains the BP equations (8 and 9 ), e.g., ʃ dP _{i→a} (η) η = η̄ _{i→a} . These remarks can be used to show that the constrained averages: and Q̄(ν, ν̄) (defined analogously) satisfy closed equations that are much easier to solve numerically.
Acknowledgments
We thank J. Kurchan and M. Mézard for stimulating discussions. This work has been partially supported by the European Commission under Contracts EVERGROW and STIPCO.
Footnotes
 ^{d}To whom correspondence should be addressed. Email: montanari{at}stanford.edu

Author contributions: F.K., A.M., F.R.T., G.S., and L.Z. designed research, performed research, contributed new reagents/analytic tools, analyzed data, and wrote the paper.

The authors declare no conflict of interest.

↵ g For coloring lregular graphs, we can use l = 2α as a parameter. When considering a phase transition defined through some property 𝒫 increasing in l, we adopt the convention of denoting its location through the smallest integer such that 𝒫 holds.

↵ h The term “with high probability” means with probability approaching one as N → ∞.

↵ i One possible approach to the definition of a Monte Carlo Markov chain algorithm is to relax the constraints by setting ψ _{a} (⋯) = ϵ instead of 0 whenever the ath constraint is violated. Glauber dynamics can then be used to sample from the relaxed measure μ_{ϵ} .

↵ j More precisely μ is obtained as a limit of free boundary measures.

↵ k The precise picture depends on the value of k (resp. q) and can be somewhat more complicated.

↵ l Notice that for qCOL, since l is an integer, the “condensated” regime [l _{c}(q), l _{s} (q)] may be empty. This is the case for q = 4. On the contrary, q = 5 is always condensated for l _{d} < l < l _{s}.

↵ m This paradox was noticed independently by Dimitris Achlioptas (personal communication).
 Abbreviations:
 CSP,
 constraint satisfaction problem;
 rCSP,
 random CSP;
 kSAT,
 ksatisfiability;
 qCOL,
 qcoloring;
 SP,
 survey propagation;
 BP,
 belief propagation;
 1RSB,
 onestep replica symmetry breaking.
 © 2007 by The National Academy of Sciences of the USA
References

↵
 Garey MR ,
 Johnson DS
 ↵
 ↵

↵
 Selman B ,
 Kautz HA ,
 Cohen B ,

↵
 Achlioptas D ,
 Sorkin GB ,

↵
 Mézard M ,
 Parisi G ,
 Zecchina R

↵
 Bayati M ,
 Shah D ,
 Sharma M ,

↵
 Gamarnik D ,
 Bandyopadhyay A ,

↵
 Montanari A ,
 Shah D
 ↵
 ↵
 ↵
 ↵
 ↵
 ↵
 ↵

↵
 Georgii HO
 ↵

↵
 Aurell E ,
 Gordon U ,
 Kirkpatrick S ,

↵
 Maneva EN ,
 Mossel E ,
 Wainwright MJ ,
 ↵
 ↵

↵
 Achlioptas D ,
 RicciTersenghi F ,

↵
 Braunstein A ,
 Zecchina R ,
 ↵
 ↵

↵
 Talagrand M

↵
 Kesten H ,
 Stigum BP

↵
 Kesten H ,
 Stigum BP
 ↵
 ↵
 ↵
 ↵