---
title: Stochastic Block Model
url: https://www.emergentmind.com/topics/stochastic-block-model
type: topic
---

# Stochastic Block Model

The **stochastic block model (SBM)** is a probabilistic model for networks in which vertices possess unobserved block or community labels, and edges are conditionally independent given those labels. Vertices in the same block have statistically similar connection probabilities to every block, including their own. The model encompasses assortative communities, disassortative or multipartite structures, core–periphery organization, and more general role-based connectivity patterns. Its principal inferential tasks are latent-label classification, estimation of block proportions and connectivity parameters, selection of the number of blocks, goodness-of-fit assessment, and analysis of extensions incorporating degree heterogeneity, attributes, signs, multiple networks, or evolving community structure.

## 1. Probabilistic formulation

Let \(n\) vertices have latent labels \(Z_i\in[Q]=\{1,\ldots,Q\}\), independently distributed according to

\[
\Pr(Z_i=q)=\alpha_q,\qquad \sum_{q=1}^Q\alpha_q=1.
\]

For an undirected binary network with adjacency matrix \(X\), conditional on the labels,

\[
X_{ij}\mid (Z_i=q,Z_j=r)\sim \operatorname{Bernoulli}(\pi_{qr}),
\]

where \(\pi=(\pi_{qr})\) is a symmetric connectivity matrix. The diagonal is typically zero and \(X_{ij}=X_{ji}\). Conditional independence gives

\[
\Pr(X\mid Z,\pi)
=
\prod_{1\le i<j\le n}
\pi_{Z_iZ_j}^{X_{ij}}
(1-\pi_{Z_iZ_j})^{1-X_{ij}}.
\]

The joint likelihood is

\[
\Pr(X,Z\mid \alpha,\pi)
=
\left(\prod_{i=1}^n\alpha_{Z_i}\right)
\prod_{1\le i<j\le n}
\pi_{Z_iZ_j}^{X_{ij}}
(1-\pi_{Z_iZ_j})^{1-X_{ij}}.
\]

The labels and block parameters are not separately identifiable under simultaneous permutations of the block labels and the rows and columns of \(\pi\). Inference therefore concerns partitions up to label permutation, or the induced edge-probability matrix. Bayesian analyses can avoid imposing a labeling convention by placing priors on the induced probability matrix [1505.06794].

For directed networks, \(Q\) need not be symmetric and \(\pi_{qr}\) describes the probability of an edge from block \(q\) to block \(r\). For count-valued networks, a Poisson formulation replaces Bernoulli probabilities with block-specific interaction intensities,

\[
A_{ij}\sim\operatorname{Poisson}(\eta_{Z_iZ_j}).
\]

The Poisson SBM is particularly useful for weighted or multigraph networks and forms the basis of degree-corrected and Bayesian nonparametric variants [1311.2520].

The term “community” is broader than a densely connected group. If \(\pi_{qq}>\pi_{qr}\), the model is assortative. If \(\pi_{qq}<\pi_{qr}\), it can represent disassortative or multipartite structure. Core–periphery patterns arise when one block has high within-block connectivity while another connects primarily to the core. Consequently, SBM blocks are often interpreted as groups of statistically equivalent roles rather than necessarily as conventional communities [1806.02485].

## 2. Identifiability and information in degree statistics

For node \(i\), define its degree and normalized degree by

\[
D_i^n=\sum_{j\ne i}X_{ij},
\qquad
T_i^n=\frac{D_i^n}{n-1}.
\]

The expected connection probability from a node in block \(q\) to a uniformly selected other vertex is

\[
\overline{\pi}_q=\sum_{r=1}^Q\alpha_r\pi_{qr}.
\]

Conditionally on \(Z_i=q\),

\[
D_i^n\sim \operatorname{Binomial}(n-1,\overline{\pi}_q),
\qquad
\mathbb E[T_i^n\mid Z_i=q]=\overline{\pi}_q.
\]

Thus the empirical degree distribution is a mixture of binomial distributions with component parameters \(\overline{\pi}_q\) and mixing proportions \(\alpha_q\). A sufficient degree-separation condition is

\[
q\ne r\Longrightarrow \overline{\pi}_q\ne\overline{\pi}_r.
\tag{A}
\]

Under this condition, normalized degrees concentrate around distinct class-specific means. Hoeffding’s inequality gives

\[
\Pr\!\left(
|T_i^n-\overline{\pi}_q|>t\mid Z_i=q
\right)
\le 2e^{-2nt^2},
\]

and, after a union bound over vertices,

\[
\Pr(d_n>t)\le 2n e^{-2nt^2},
\]

where \(d_n\) is the maximum within-class deviation from the corresponding mean.

The **Largest Gaps (LG) algorithm** exploits this concentration:

1. compute all normalized degrees;
2. sort them;
3. calculate consecutive gaps;
4. select the \(Q-1\) largest gaps;
5. cut the ordered sequence at those positions.

When \(Q\) is known, the between-class gaps exceed within-class gaps with high probability if the minimal mean separation

\[
\delta=\min_{q\ne r}
|\overline{\pi}_q-\overline{\pi}_r|
\]

is sufficiently large. The algorithm requires \(O(n^2)\) operations when degrees are computed from a dense adjacency matrix and \(O(m)\) degree computation for a sparse graph, followed by \(O(n\log n)\) sorting [1110.6517].

The probability of at least one classification error satisfies

\[
\Pr(E_n)
\le
2n\exp\!\left(-\frac18n\delta^2\right)
+
Q(1-\alpha_0)^{n+1},
\]

where \(\alpha_0=\min_q\alpha_q\). The first term controls degree fluctuations and the second controls the possibility that a block is empty. For fixed \(Q\), positive \(\alpha_0\), and fixed \(\delta>0\), this establishes strong consistency.

Degree information is not universally sufficient. If two blocks satisfy

\[
\overline{\pi}_q=\overline{\pi}_r,
\]

their ordinary degrees have the same conditional distribution. They may nevertheless have different connection profiles. Common-neighbor counts can provide additional information: for two nodes in block \(q\), the approximate expected number of common neighbors is

\[
(n-2)\sum_{\ell=1}^Q\alpha_\ell\pi_{q\ell}^2,
\]

whereas for nodes in distinct blocks \(q,r\) it is approximately

\[
(n-2)\sum_{\ell=1}^Q\alpha_\ell\pi_{q\ell}\pi_{r\ell}.
\]

Thus, degree equivalence is weaker than structural equivalence.

## 3. Recovery thresholds in sparse block models

In the sparse two-block SBM, equal-sized communities have within- and between-community probabilities

\[
p=\frac an,\qquad q=\frac bn,
\qquad a>b.
\]

The expected degree is

\[
d=\frac{a+b}{2}.
\]

For two communities, the sharp nontrivial-recovery threshold is

\[
(a-b)^2=2(a+b).
\]

Below the threshold, even the entire graph does not provide nontrivial correlation with the planted labels; above it, recovery is possible. Exact recovery of every vertex is impossible at constant average degree because sparse graphs contain isolated and locally ambiguous vertices [1404.6325].

The local structure of a sparse SBM is coupled to a Poisson Galton–Watson tree. For \(k\) balanced communities with within-community parameter \(a/n\) and between-community parameter \(b/n\), the branching mean and second eigenvalue of the broadcast transition matrix are

\[
d=\frac{a+(k-1)b}{k},
\qquad
\lambda=\frac{a-b}{a+(k-1)b}.
\]

The robust-reconstruction condition is

\[
d\lambda^2>1
\quad\Longleftrightarrow\quad
(a-b)^2>k(a+(k-1)b).
\]

For \(k=2\), this reduces to the sharp threshold above. For \(k\ge 3\), the Kesten–Stigum condition is a robust-reconstruction criterion and is not always the exact information-theoretic threshold.

A vanishing fraction of revealed labels does not lower the two-community threshold. If the revealed-label fraction \(p\) tends to zero and

\[
(a-b)^2<2(a+b),
\]

the posterior of a typical label remains asymptotically unbiased. Revealed labels can resolve the permutation of cluster names, but this is distinct from creating detectability below the information-theoretic threshold.

The effect changes when the number of communities grows. If \(k=k(p)\to\infty\) as the revealed fraction \(p\to0\), local recovery can be possible under

\[
a-b>(1+\delta)k,
\]

or approximately \((a-b)/k>1\), even in regimes below the usual robust-reconstruction condition. The mechanism is a collision effect: for many communities, independently mutated branches are unlikely to reveal the same incorrect label [1404.6325].

A different phenomenon occurs in the **regular stochastic block model (RSBM)**. There, each vertex has exactly \(d_1\) neighbors within its community and \(d_2\) across communities. The graph is \(d=d_1+d_2\)-regular, removing the isolated-vertex obstruction of the ordinary sparse SBM. Under suitable conditions, the planted partition is unique up to exchanging the two communities, and exact recovery is information-theoretically possible at constant degree. Efficient spectral recovery is established when

\[
(d_1-d_2)^2>4(d_1+d_2-1)
\]

and \(d_1\) is even. In this regime, the planted sign vector is separated from the spectral bulk. If \(d_1>d_2+4\), sufficiently accurate partial recovery can be bootstrapped to exact recovery by repeated majority updates [1507.00930].

## 4. Estimation, Bayesian inference, and model selection

For an observed partition \(\mathcal C_1,\ldots,\mathcal C_Q\), natural estimators of the block proportions and connectivity matrix are

\[
\widetilde{\alpha}_q=\frac{N_q}{n},
\]

and

\[
\widetilde{\pi}_{qr}
=
\frac{
\sum_{(i,j)\in\mathcal C_{qr}}X_{ij}
}{
N_{qr}
},
\]

where \(N_{qr}\) is the number of possible node pairs between blocks \(q\) and \(r\). If classification is consistent, substituting the estimated partition yields consistent plug-in estimators. Parameter estimation can require larger networks than classification because every block and block pair must contain enough observations [1110.6517].

A Bayesian SBM commonly uses

\[
Q_{rs}\stackrel{\mathrm{ind}}{\sim}\operatorname{Uniform}(0,1),
\qquad
\pi\sim\operatorname{Dirichlet}(\alpha_1,\ldots,\alpha_Q),
\]

with latent labels conditionally categorical. The posterior for each \(Q_{rs}\) is Beta conditional on the labels. The induced prior on the edge-probability matrix is invariant to label switching. Under bounded-away-from-zero and bounded-away-from-one probabilities, posterior contraction for the normalized squared Frobenius loss occurs at squared rate

\[
\frac{Q^2\log(n/Q)}{n^2}
+
\frac{\log Q}{n}.
\]

The first term estimates \(Q^2\) block parameters and the second reflects latent-clustering uncertainty. This is near the classical minimax rate

\[
\frac{Q^2}{n^2}+\frac{\log Q}{n}
\]

up to a logarithmic factor in the block-parameter term [1505.06794].

Model selection can use integrated likelihoods, MDL, BIC-like penalties, ICL, or sequential testing. Integrated likelihoods combine fit with an automatic complexity penalty. For the ordinary SBM, conjugate Beta and Dirichlet priors yield closed-form integrated contributions for block edge counts and block memberships [1605.06794].

A fully marginalized Bayesian approach approximates the evidence using Laplace’s method and belief propagation. The **fully factorized information criterion** includes a BIC-like penalty, a small-cluster penalty, and a bicluster penalty. Its tractable implementation, \(F^2AB\), uses penalized belief propagation and automatically removes redundant clusters without fitting every candidate value of \(Q\). For sparse graphs, its per-sweep complexity is \(O(MQ^2)\), where \(M\) is the number of edges. The theoretical evidence approximation is consistent under stated regularity conditions, but the finite algorithm uses an approximate posterior and lacks an algorithmic consistency theorem [1602.02256].

A goodness-of-fit test evaluates whether a proposed \(K_0\)-block SBM is too coarse. After estimating the block mean matrix \(\widehat P\), form the variance-normalized residual

\[
\widetilde A_{ij}
=
\frac{A_{ij}-\widehat P_{ij}}
{\sqrt{(n-1)\widehat P_{ij}(1-\widehat P_{ij})}}.
\]

The test statistic is

\[
T_{n,K_0}
=
n^{2/3}\left[\sigma_1(\widetilde A)-2\right],
\]

where \(\sigma_1\) is the largest singular value. Under the null, the statistic is calibrated using the Tracy–Widom distribution of type 1. Under a finer SBM, degree-corrected model, or mixed-membership alternative, a structured residual mean produces a singular value of order \(n^{1/2}\), giving full asymptotic power under the theorem’s conditions. Sequential application provides a consistent estimator of the number of communities [1412.4857].

## 5. Degree correction and important extensions

The ordinary SBM assumes that vertices in the same block have statistically identical expected degrees up to block effects. This can cause genuine structural groups containing hubs and low-degree vertices to be split according to degree. The degree-corrected SBM introduces node-specific parameters:

\[
A_{ij}\sim
\operatorname{Poisson}
\left(
\theta_i\eta_{Z_iZ_j}\theta_j
\right).
\]

The normalization

\[
\sum_{i:Z_i=q}\theta_i=n_q
\]

is required because \(\theta_i\) and \(\eta_{qr}\) otherwise have a blockwise scaling non-identifiability. Degree correction permits heterogeneous node activity while preserving block-level interaction rates [1311.2520].

The Infinite Degree-Corrected SBM places a Dirichlet prior on normalized within-block weights,

\[
(\phi_i)_{Z_i=q}\sim
\operatorname{Dirichlet}(\gamma\mathbf 1_{n_q}),
\qquad
\theta_i=n_{Z_i}\phi_i.
\]

As \(\gamma\to\infty\), \(\theta_i\to1\) and the ordinary SBM is recovered. Small \(\gamma\) permits strong within-block degree heterogeneity. A Chinese Restaurant Process prior makes the number of groups random, while Gamma priors on block interaction rates preserve conjugacy. Collapsing the degree weights and interaction rates analytically leaves a partition-focused MCMC procedure. The model supports posterior prediction of missing links and model comparison through held-out AUC. On synthetic data, degree correction improves recovery when degree heterogeneity is present and is approximately equivalent to the ordinary SBM when degrees are homogeneous.

A regularized SBM adds a preference for assortative or disassortative mixing through the internal-degree ratio

\[
\frac{k_i^+}{k_i},
\]

where \(k_i^+\) is the number of neighbors of node \(i\) in its own block. With a prior ratio \(f_i\), the regularizer is

\[
-2\sum_i k_i
H\!\left(\frac{k_i^+}{k_i},f_i\right),
\]

where \(H\) is binary cross-entropy. The parameter can favor large internal-degree ratios, small ratios, or intermediate structure. When \(f_i=1/2\), the maximum-likelihood estimator coincides with the DCSBM estimator. The regularization is designed to reduce local-optimum instability when the unconstrained DCSBM finds an unintended disassortative or core–periphery partition [1903.11751].

Other extensions include the following.

- **Signed SBM**: positive and negative relations receive separate block matrices, with soft memberships, bridge scores, entropy, and directed source and target centrality parameters. It can represent assortative, disassortative, multipartite, and mixed signed structures [1501.00594].

- **Attributed SBM**: continuous node attributes follow community-specific multivariate Gaussian distributions,

  \[
  X_i\mid Z_i=q\sim\mathcal N(\mu_q,\Sigma_q),
  \]

  while edges retain the SBM likelihood. Connectivity and attributes are conditionally independent given the labels. The model supports joint community inference, link prediction, and collaborative filtering [1803.02726].

- **Neural-prior SBM**: attributes determine labels through a latent neural classifier rather than being generated conditionally on labels. In the GLM–SBM, a random perceptron generates binary labels, after which the sparse graph is sampled from the SBM. For Gaussian latent weights, the partial-recovery threshold is

  \[
  \lambda_c=
  \left(1+\frac{4\alpha}{\pi^2}\right)^{-1/2},
  \]

  lower than the ordinary two-community threshold \(1\). For binary latent weights, information-theoretic and algorithmic thresholds can differ, creating a hard region [2303.09995].

- **Multipartite block models**: several predefined functional node types participate in multiple binary, count-valued, or continuous networks. Each functional group has its own latent partition, and the same partition informs every network involving that group. Variational EM estimates parameters and ICL selects block numbers [1807.10138].

- **Exchangeable collections of networks**: a Bayesian nonparametric hierarchy clusters networks according to whether they share actor partitions. It permits binary or count-valued, directed or undirected relations and uses MCMC with split–merge moves [1606.05277].

- **Evolving and percolating SBMs**: when community numbers, sizes, and probabilities vary with \(n\), giant-component formation is governed by the spectral radius of the multitype branching matrix in locally tree-like sequences. For fixed blocks, the giant component satisfies

  \[
  S_r=1-\exp\!\left(-\sum_s c_{rs}S_s\right),
  \]

  and emerges when \(\lambda_{\max}(C)>1\). Degree-corrected models replace \(C\) by a matrix involving group mixing and mean excess degrees [2607.20719; 2609.27141].

## 6. Computational methods, applications, and limitations

SBM inference is generally nonconvex because the latent assignment space grows exponentially with the number of vertices. Common methods include maximum likelihood, EM, variational EM, belief propagation, MCMC, spectral methods, and graph-cut or diffusion-based optimizers.

For signed networks, EM computes posterior responsibilities for latent endpoint-group pairs and alternates with normalized parameter updates. Its complexity is \(O(TmQ^2)\), where \(T\) is the number of EM iterations and \(m\) the number of edges [1501.00594].

Belief propagation is particularly useful for sparse graphs. In fully Bayesian model selection, penalized belief propagation can jointly infer assignments and remove redundant blocks. In neural-prior SBMs, AMP handles dense attribute-to-label factors while BP handles sparse graph factors. The combined AMP–BP procedure has \(O(NM)\) time and memory complexity for \(N\) nodes and \(M\)-dimensional attributes [2303.09995].

Surface-tension formulations reinterpret degree-corrected SBM maximum likelihood as a discrete interfacial-energy problem. With

\[
W_{\alpha\beta}=-\log\omega_{\alpha\beta},
\]

the objective becomes a weighted cut term plus a volume term. This motivates mean-curvature flow, Allen–Cahn, and Merriman–Bence–Osher algorithms, together with splitting and merging procedures. The formulation provides a geometric interpretation but does not guarantee global optimization; initialization, time steps, and regularization remain important [1806.02485].

Applications extend beyond community detection. In distributed gradient coding, a stochastic block code samples a worker–function assignment matrix from an SBM. Within-block assignments provide repetition, while sparse cross-block assignments obscure the block structure from adversarial straggler selection. The code interpolates between fractional repetition and Bernoulli gradient codes [1805.10378].

In sparse matching, community structure affects whether Karp–Sipser is asymptotically optimal. For equitable SBMs, where every community has the same expected degree, the matching size and Karp–Sipser trajectory coincide at linear scale with the Erdős–Rényi case. In heterogeneous SBMs, ordinary Karp–Sipser can be linearly suboptimal because random Phase 2 edges may consume vertices needed by other communities [2403.02140].

Several limitations recur across SBM variants. The ordinary model imposes conditional edge independence, does not represent within-block degree heterogeneity, and identifies labels only up to permutation. Sparse regimes exhibit detectability thresholds and may prevent exact recovery. Bayesian procedures depend on prior specification and often require approximations. Degree correction increases flexibility but can create model-selection and optimization instability. Attribute-augmented models require assumptions about the attribute distribution and the relationship between attributes and connectivity. Goodness-of-fit rejection diagnoses lack of fit but does not by itself distinguish finer communities from degree correction, mixed membership, or other structured alternatives.

Connectivity is also not guaranteed by statistical block homogeneity. An SBM block may induce a disconnected subgraph if disconnected vertex sets have similar block-interaction profiles. Post-processing methods such as connected-component splitting, small-cut refinement, and reclustering can improve induced-subgraph connectivity, but they may reduce node coverage, shrink clusters, and incur substantial computational costs [2408.10464].

The central scope of the SBM is therefore best expressed as statistical equivalence under a specified generative model. It is not intrinsically a guarantee of dense, connected, assortative, or semantically meaningful communities. Its value lies in providing a flexible probabilistic language for latent network structure, with explicit assumptions that can be extended, tested, regularized, or replaced according to the inferential objective.

Source: https://www.emergentmind.com/topics/stochastic-block-model