Papers
Topics
Authors
Recent
Search
2000 character limit reached

Blocking-Augmented Sampling (BaS)

Updated 4 July 2026
  • Blocking-Augmented Sampling (BaS) is a design pattern that combines blocking and sampling to address inefficiencies in naive updates by targeting dependent regions.
  • It is applied in latent Dirichlet allocation for improved chain mixing via blocked Gibbs sampling and in approximate analytical joins to achieve valid confidence intervals.
  • BaS offers theoretical guarantees on mixing efficiency and empirical gains in perplexity and computational speed, especially in high-topic or sparse regimes.

Searching arXiv for the cited papers to ground the article in current records. Blocking-Augmented Sampling (BaS) denotes a family of methods that combine blocking with sampling so that inference or estimation is organized around groups or regimes that would be poorly handled by naive single-element updates or uniform sampling. In the available literature represented here, the term appears in two closely related but technically distinct senses. In latent-variable MCMC for latent Dirichlet allocation (LDA), it is instantiated by a blocked collapsed Gibbs sampler that jointly updates groups of topic indicators in order to improve chain mixing (Zhang et al., 2016). In approximate analytical joins over unstructured data, it is the explicit name of a hybrid algorithm that orchestrates embedding-based blocking and statistically principled sampling to achieve valid confidence intervals under an Oracle budget (Zhu et al., 17 Mar 2026).

1. Scope of the term and unifying idea

The two principal usages of BaS differ in objective, state space, and guarantees, but they share the same structural intuition: identify regions in which local updates or uniform treatment are inefficient, then replace them with a blocked or hybrid procedure better matched to the dependence structure or failure mode.

Usage Blocking object Stated effect
LDA blocked collapsed Gibbs sampler Bdv={zdn:wdn=v}B_{dv}=\{z_{dn}: w_{dn}=v\} improve chain mixing efficiency
Approximate analytical joins DbD_b and DsD_s regimes over the cross product statistical guarantees and high efficiency

In the LDA setting, the relevant dependence is posterior dependence among topic assignments that share document and word context. In the analytical-join setting, the relevant failure modes are embedding false negatives and false positives. This suggests that BaS is best understood not as a single fixed algorithm, but as a design pattern in which blocking is introduced precisely where a baseline sampler or estimator is known to be weak.

A common source of confusion is that the label “BaS” refers both to a general blocked-sampling principle and to a specific named query-processing algorithm. The shared terminology is justified by the common idea of orchestrating blocking and sampling, but the two literatures solve different problems and should not be conflated.

2. BaS in latent Dirichlet allocation

For LDA, the starting point is the standard collapsed Gibbs sampler, which integrates out the document-topic proportions θ1:D\theta_{1:D} and topic-word probabilities ϕ1:K\phi_{1:K}, leaving a marginal posterior over topic assignments z1:Dz_{1:D}. The standard single-site collapsed Gibbs sampler of Griffiths & Steyvers updates each zdnz_{dn} one at a time from

p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.

Its computational bottleneck is repeated evaluation of a KK-dimensional categorical distribution, and its mixing can be slow because only one latent variable moves per step (Zhang et al., 2016).

The blocked construction rewrites the latent state in terms of document-word-topic counts

ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),

with DbD_b0 the number of occurrences of word type DbD_b1 in document DbD_b2. The block is then

DbD_b3

that is, the set of topic assignments for all occurrences of word DbD_b4 in document DbD_b5. This choice is natural because tokens of the same word in the same document are strongly dependent under the collapsed posterior.

Under this parametrization, the block full conditional is expressed as a constrained product form: DbD_b6 subject to

DbD_b7

where

DbD_b8

This formulation is the essential BaS step. Instead of moving one topic indicator at a time, the sampler updates the whole allocation vector DbD_b9 jointly. Because all configurations of the individual DsD_s0 that induce the same block counts are uniform and interchangeable for the collapsed posterior, the counts themselves can be treated as the state.

3. Exact block simulation: backward and nested procedures

The computational difficulty is that the block conditional is defined over all allocations of DsD_s1 tokens across DsD_s2 topics. Naive enumeration is avoided by dynamic programming through normalising constants

DsD_s3

which satisfy convolution recursions. For left-to-right ranges,

DsD_s4

and for arbitrary ranges split at DsD_s5,

DsD_s6

Two exact sampling procedures are built on this recursion (Zhang et al., 2016). The first is an DsD_s7-step backward simulation. After precomputing DsD_s8, it samples DsD_s9 from its marginal, then recursively samples θ1:D\theta_{1:D}0, and finally samples θ1:D\theta_{1:D}1 jointly. The second is an θ1:D\theta_{1:D}2-step nested simulation, which builds a complete binary tree over the topic index set θ1:D\theta_{1:D}3, assigns the root size θ1:D\theta_{1:D}4, and recursively splits that size between left and right children according to conditional distributions involving θ1:D\theta_{1:D}5. The nested procedure is especially attractive when θ1:D\theta_{1:D}6 is large and θ1:D\theta_{1:D}7 is small.

The computational profile has two parts. Precomputation of the required θ1:D\theta_{1:D}8-values is θ1:D\theta_{1:D}9 per block. Sampling itself is ϕ1:K\phi_{1:K}0 for backward simulation and ϕ1:K\phi_{1:K}1 for nested simulation. For the special case ϕ1:K\phi_{1:K}2, the contrast is sharp: the single-site sampler requires one ϕ1:K\phi_{1:K}3-dimensional categorical draw, backward simulation requires up to ϕ1:K\phi_{1:K}4 Bernoulli/binomial draws, and nested simulation requires at most ϕ1:K\phi_{1:K}5 binary splits. A plausible implication is that the nested scheme is not merely a mixing improvement but also a structural acceleration for large-topic, sparse-text regimes.

4. Mixing guarantees and empirical behavior in LDA

The theoretical guarantee invoked for the blocked sampler comes from Liu, Wong, and Kong (1994): grouping of dependent variables in Gibbs sampling weakly improves or at least does not worsen the asymptotic variance and spectral gap when the joint update is exact. In this setting, the single-site sampler updates one ϕ1:K\phi_{1:K}6 at a time, whereas the blocked sampler updates the entire ϕ1:K\phi_{1:K}7 block from its exact full conditional. Because the variables within ϕ1:K\phi_{1:K}8 are dependent under the collapsed posterior, blocking yields better or equal mixing efficiency in the sense of reduced asymptotic variance of Monte Carlo estimators, larger spectral gap, and lower autocorrelations. The paper is explicit that whenever ϕ1:K\phi_{1:K}9, the blocking is theoretically guaranteed to accelerate mixing compared to single-site updates of those variables; Celeux et al. (2000) are cited in connection with the incremental nature of single-site updates in mixture models (Zhang et al., 2016).

Empirically, the gains depend on corpus structure. On a simulated dataset with z1:Dz_{1:D}0, z1:Dz_{1:D}1, z1:Dz_{1:D}2, document length z1:Dz_{1:D}3, z1:Dz_{1:D}4, and z1:Dz_{1:D}5, all collapsed samplers converge quickly, with blocked and single-site collapsed samplers both outperforming data augmentation in perplexity. The blocked sampler yields modestly better mixing and perplexity, but differences are small because the problem is small.

On the KOS corpus, with z1:Dz_{1:D}6, z1:Dz_{1:D}7, total tokens z1:Dz_{1:D}8, and z1:Dz_{1:D}9, the blocked sampler is similar to single-site in log posterior and slightly better in perplexity. The reported reason is structural: about zdnz_{dn}0 of words appear only once per document, so many zdnz_{dn}1 blocks degenerate to single-site updates. On the NIPS corpus, with zdnz_{dn}2, zdnz_{dn}3, total tokens zdnz_{dn}4, and zdnz_{dn}5, the blocked sampler reaches a high posterior region several hundred iterations earlier than single-site and yields lower perplexity on average, because many blocks satisfy zdnz_{dn}6.

The timing comparison sharpens the distinction between backward and nested simulation. Backward simulation is slower per iteration than single-site on both KOS and NIPS. Nested simulation is similar to backward for small zdnz_{dn}7, slightly slower than single-site when zdnz_{dn}8 is small, but for zdnz_{dn}9 it becomes about p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.0 faster per iteration than single-site on KOS and about p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.1 faster on NIPS. This clarifies a recurrent misconception: block updates do not automatically reduce wall-clock cost; the computational benefit in this case depends on the nested-simulation design and appears most clearly when the number of topics is over hundreds.

5. BaS for approximate analytical joins over unstructured data

In the database and data-management setting, BaS is a query-processing algorithm for approximate analytical joins over unstructured data. The JoinML system supports queries of the form

DbD_b11

The semantic join condition is evaluated by an expensive ML “Oracle” p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.2 on tuples from the cross product p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.3. The target aggregates are

p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.4

The basic difficulty is that full pairwise or full cross-product Oracle inference is prohibitive, while existing approaches expose a tradeoff between efficiency and statistical validity (Zhu et al., 17 Mar 2026).

Embedding-based blocking uses cosine similarity or, for p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.5-way joins, a product of pairwise similarities to prune candidate tuples. Its weakness is bias from false negatives: true matches with low similarity are pruned away permanently. Uniform sampling is statistically sound but inefficient when matches are rare. Weighted Wander Join (WWJ) uses similarity-weighted sampling and importance weighting, giving unbiased estimators and valid confidence intervals, but its variance can be high when high-similarity tuples are mostly false positives.

BaS addresses these failure modes by partitioning the domain into two regimes. In the sampling regime p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.6, corresponding to low-similarity strata where embeddings are likely to have false negatives, it applies WWJ. In the blocking regime p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.7, corresponding to high-similarity strata where embeddings have many false positives, it runs the Oracle exhaustively. The combined estimators are

p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.8

and for averages it uses the ratio estimator

p(zdn=kz1:D(dn),w1:D,α1:K,β)(Sdk(dn)+αk)  (Svk(dn)+β)Sk(dn)+Vβ,v=wdn.p(z_{dn}=k \mid z_{1:D}^{(-dn)}, w_{1:D}, \alpha_{1:K}, \beta) \propto \frac{ (S_{d\cdot k}^{(-dn)} + \alpha_k) \; (S_{\cdot v k}^{(-dn)} + \beta) }{ S_{\cdot \cdot k}^{(-dn)} + V\beta }, \quad v = w_{dn}.9

followed by a Taylor-based bias correction that reduces the bias from KK0 to KK1.

The algorithm is two-stage. First, it constructs a maximum blocking regime of size KK2, consisting of the top KK3 tuples by similarity, splits that region into KK4 equal-sized strata KK5, and sets KK6 as the minimal sampling regime. Pilot budget KK7 is allocated to strata in proportion to KK8, where KK9 denotes normalized similarity weights. Per-stratum variances are estimated from the pilot sample, and BaS then solves an empirical MSE minimization problem over subsets ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),0, where ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),1 denotes the strata assigned to blocking. In Stage 2, blocking strata are fully evaluated and sampling strata are sampled by WWJ with budgets again proportional to the sum of weights. Because the final sample is not i.i.d., confidence intervals are constructed by bootstrap-ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),2.

6. Guarantees, empirical findings, and broader significance

For approximate analytical joins, the stated guarantees are explicit. For COUNT and SUM, the estimators are unbiased and MSE decays as ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),3. For AVG, the ratio estimator is asymptotically unbiased with bias ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),4, reduced to ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),5 by bias correction. For COUNT, SUM, AVG, MEDIAN, MIN, MAX, and GroupBy, bootstrap-ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),6 yields asymptotically correct coverage, with coverage error ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),7 under the paper’s asymptotic theory based on Hadamard differentiability and results from van der Vaart and Hall (Zhu et al., 17 Mar 2026).

Two asymptotic comparisons to standalone sampling are central. First, if ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),8 is the true optimal allocation and ndvk=nδ(v,k)(wdn,zdn),n_{dvk} = \sum_n \delta_{(v,k)}(w_{dn}, z_{dn}),9 is the allocation estimated from pilot samples, then the relative excess MSE converges at rate DbD_b00. Second, relative to WWJ, BaS asymptotically outperforms WWJ under two conditions: improved importance distribution on the sampling region and higher match sparsity in the sampling region. If those conditions fail, BaS still asymptotically matches WWJ, because it can choose DbD_b01 and degenerate to WWJ plus a negligible pilot cost.

The experimental findings are correspondingly framed around validity and efficiency. The paper reports valid confidence intervals and estimation-error reductions of up to DbD_b02 compared to state-of-the-art baselines, and up to DbD_b03 lower than WWJ in some settings. Blocking alone can produce true errors up to DbD_b04 larger than the confidence-interval width, whereas BaS maintains error ratio DbD_b05. Across 16 datasets and multiple modalities, BaS remains effective at Oracle budgets as low as DbD_b06, and its adaptive allocation is reported to be within DbD_b07–DbD_b08 of optimal improvement on the stated ablation.

The limitations differ across the two BaS literatures. In the LDA setting, benefit can be limited when most blocks degenerate to DbD_b09, as in KOS, or when the preprocessing cost outweighs mixing gains for small DbD_b10. In the analytical-join setting, efficiency gains depend on embeddings being at least somewhat informative; with completely uninformative embeddings, BaS degrades to WWJ or uniform performance, though not asymptotically worse. The join setting also inherits practical costs from nearest-neighbor search, stratification, and bootstrap, even if those CPU costs are reported to be negligible relative to Oracle execution in the experiments.

The broader significance is methodological. The LDA paper explicitly proposes turning the blocking scheme into a general methodology for other mixture structures, including Dirichlet process mixture models and hierarchical Dirichlet process models with discrete observations and conjugate priors (Zhang et al., 2016). The analytical-join paper similarly points toward more complex query patterns, streaming or online settings, and combinations with physical execution optimizations (Zhu et al., 17 Mar 2026). Taken together, these lines of work suggest that BaS is most naturally viewed as a principled way to exploit structure—posterior dependence in one case, embedding failure modes in the other—by assigning different parts of the problem to exact blocking or statistically corrected sampling, rather than forcing a single global update or estimator on the entire domain.

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 Blocking-Augmented Sampling (BaS).