Accelerating Approximate Analytical Join Queries over Unstructured Data with Statistical Guarantees

Yuxuan Zhu, Tengjun Jin, Chenghao Mo, Daniel Kang

TL;DR

The authors introduce Blocking-augmented Sampling (BaS), a novel algorithm that makes complex join queries on unstructured data (like images and text) both fast and statistically reliable. By intelligently combining embedding-based "blocking" with importance sampling, BaS reduces estimation errors by up to 19x while providing rigorous confidence intervals that standard methods lack.

What Problem Does This Paper Address?

Data analysts increasingly need to join unstructured datasets—for example, matching product descriptions across different e-commerce sites or identifying the same vehicle across multiple traffic cameras. While Large Language Models (LLMs) and Vision-Language Models (VLMs) can act as an "Oracle" to determine if two items match, they are prohibitively expensive to run on every possible pair in a large dataset (an $O(N^2)$ problem).

Existing shortcuts fall into two camps, both flawed:

  1. Embedding-based Blocking: Uses fast vector similarity to filter pairs. It’s efficient but unreliable; if the embedding model misses a match (a "false negative"), the final aggregate count or average becomes biased, and there’s no way to calculate a valid confidence interval.
  2. Uniform Sampling: Randomly checks pairs. It provides statistical guarantees but is incredibly inefficient for "rare event" joins where only a tiny fraction of pairs actually match.

The authors seek a "middle way" that offers the efficiency of blocking with the mathematical rigor of sampling.

Methods

The core contribution is Blocking-augmented Sampling (BaS). It treats the similarity threshold not as a hard filter, but as a dynamic boundary that splits the search space into two regimes:

  • The Blocking Regime (High Similarity): Here, the risk of "false positives" (items that look similar but don't match) is high. BaS executes the Oracle deterministically on these pairs to eliminate sampling variance.
  • The Sampling Regime (Low Similarity): Here, the risk of "false negatives" is the main concern. BaS uses Weighted Wander Join (WWJ)—a technique that uses embeddings as an "approximate index" to perform importance sampling. This ensures that even matches with low similarity scores are eventually accounted for, maintaining unbiasedness.

To make this work, the authors developed a two-stage adaptive allocation algorithm:

  1. Pilot Sampling: A small portion of the budget is used to estimate the variance within different "strata" (groups of pairs based on similarity).
  2. Optimal Allocation: Based on the pilot, the algorithm solves an optimization problem to decide exactly which strata should be blocked and which should be sampled to minimize the overall Mean Squared Error (MSE).
  3. Bootstrap-t Resampling: Because the two-stage process makes the data non-independent, the authors use a specialized bootstrapping technique to derive valid 95% confidence intervals.

Datasets

The authors evaluated BaS on a diverse suite of 16 datasets covering text, images, and bimodal data:

  • Real-World Joins: Entity resolution (Company), paraphrase detection (Quora), redundancy impact (Webmasters), and visual search/traffic analytics (Roxford, VeRi).
  • SemBench: A benchmark for semantic query processing across E-commerce and Movie domains.
  • Synthetic Stress-Tests: Large-scale joins (up to 1.3 trillion pairs) and controlled experiments to test how the algorithm handles varying embedding quality.

Key Insights and Ideas

  • Orchestrating Failure Modes: The "aha moment" is recognizing that blocking and sampling fail in opposite ways. Blocking is ruined by false negatives; importance sampling is slowed down by false positives. By splitting the data into two regimes, BaS uses each tool where it is strongest.
  • Embeddings as Approximate Indices: Rather than needing a perfect index, BaS treats embeddings as a "hint" for where matches might be. This allows it to use the logic of Wander Join (a structured data algorithm) on unstructured data.
  • Theoretical Superiority: The authors mathematically prove that BaS will asymptotically match or outperform standalone sampling. It effectively "de-biases" the efficiency of blocking.
  • Model Agnostic: BaS doesn't care if you use TF-IDF, CLIP, or a state-of-the-art LLM for embeddings. It adaptively adjusts to the quality of the model you provide.

Key Results

  • Massive Error Reduction: BaS reduced the Root Mean Squared Error (RMSE) by 1.04x to 19.5x compared to the best-performing baselines like Uniform sampling or prior AQP systems (Abae, BlazeIt).
  • Statistical Validity: In tests, standard blocking produced "invalid" confidence intervals (where the true error was much higher than the predicted bound) in almost every case. BaS consistently maintained valid 95% coverage.
  • Extreme Efficiency: Running BaS on a CPU costs roughly $0.03 for tasks that would cost over $43,000 to run fully with GPT-4o mini.
  • Better Query Planning: By providing more accurate "cardinality estimates" (predicting how many rows a join will produce), BaS helped query optimizers choose better execution plans, reducing total costs by 12.7% in multi-way joins.

Limitations and Future Work

  • Computational Overhead: While much cheaper than an LLM, BaS is more computationally intensive than uniform sampling because it involves sorting and stratifying the cross-product of tables.
  • Memory Constraints: For truly massive tables (billions of rows), the $O(N^2)$ cross-product cannot fit in memory. The authors suggest using nearest-neighbor-based blocking to mitigate this, but it remains a challenge for extreme scales.
  • Embedding Sensitivity: While BaS provides guarantees regardless of embedding quality, its efficiency still drops if the embeddings are very poor (e.g., if the model can't distinguish matches from non-matches at all).

Summary updated

BibTeX
@article{zhu2026accelerating,
  author = {Yuxuan Zhu and Tengjun Jin and Chenghao Mo and Daniel Kang},
  title = {{Accelerating Approximate Analytical Join Queries over Unstructured Data with Statistical Guarantees}},
  journal = {Proc. ACM Manag. Data},
  year = {2026},
  doi = {10.1145/3802004},
}

Loading related content...

Figure