BASIL: Scalable Bayesian Semi-supervised Clustering with Feature Selection and Adaptive Constraint Weighting

Luwei Wang, Dagmara Panas, Ke Wang, Bruce Guthrie, Sohan SethICML 2026

The Challenge of Constrained Clustering

Clustering is traditionally an unsupervised learning task, grouping data points based on inherent similarities without the need for labeled examples. However, in many real-world applications, practitioners possess valuable "side information" in the form of pairwise constraints: must-link (two points belong in the same cluster) and cannot-link (two points belong in different clusters).

While constrained clustering effectively leverages this prior knowledge, existing Bayesian approaches face a "triple threat" of limitations:

  1. Poor Scalability: They typically require full passes over the entire dataset, making them computationally prohibitive for large-scale data.
  2. Lack of Interpretability: They often function as black boxes, failing to explain which specific features drive the formation of a given cluster.
  3. Brittleness to Noise: They assume all provided constraints are perfectly accurate. In reality, human-provided constraints are frequently noisy, subjective, or contradictory, which can severely degrade model performance.

Introducing BASIL

To address these bottlenecks, researchers have developed BASIL (Bayesian Semi-supervIsed cLustering), a scalable framework that jointly infers cluster assignments and feature importance weights. By combining stochastic variational inference with adaptive constraint weighting, BASIL processes massive datasets significantly faster than traditional methods while remaining robust to noisy "expert" advice.

Core Methodology

BASIL tackles the limitations of traditional constrained clustering through a unified generative model:

  • Stochastic Variational Inference (SVI): Instead of processing the entire dataset at once, BASIL utilizes mini-batches to update its parameters. This SVI approach is the key to its scalability, allowing the model to handle hundreds of thousands of samples efficiently.
  • Hidden Markov Random Fields (HMRF): BASIL employs an HMRF structure to directly encode must-link and cannot-link constraints into its probabilistic framework.
  • Feature Selection via Beta-Shrinkage: The model goes beyond simple grouping by learning a weight for every feature within every cluster. It uses a Beta-shrinkage prior to "shrink" unimportant features toward a global mean, thereby isolating and highlighting only the most discriminative features.
  • Adaptive Constraint Weighting: Rather than applying fixed penalties for violated constraints, BASIL treats constraint reliability as a latent variable with a Gamma prior. If a constraint consistently contradicts the underlying data distribution, the model learns to down-weight it.
  • Phased Optimization: To ensure stability, BASIL employs a "warmup" strategy. It initially fixes constraint weights to stabilize the feature manifold before allowing the model to evaluate and potentially discount noisy constraints.

Experimental Validation and Key Results

The research team evaluated BASIL across a diverse set of benchmarks, ranging from classic synthetic datasets and handwritten digits (DIGITS, MNIST) to massive real-world health datasets like ChestMNIST (112,120 chest X-rays) and CPRD electronic health records (over 500,000 patients).

Massive Speedups

BASIL demonstrates remarkable computational efficiency. On the 70,000-sample MNIST dataset, BASIL completed training in approximately 1.5 hours. In stark contrast, traditional baselines like MPCK-means failed to converge even after two days. This represents a 96% reduction in computation time.

Robustness to "Bad Advice"

The adaptive weighting mechanism proved highly effective at handling flawed supervision. BASIL can tolerate up to 30% noisy constraints without a significant drop in accuracy. On the DIGITS dataset with 20% corrupted constraints, the model achieved an AUROC of 0.97 in successfully separating clean constraints from noisy ones.

Visual Interpretability and Clinical Relevance

Because BASIL learns cluster assignments and feature importance simultaneously, the global distribution of unlabeled data helps refine the distance metrics learned from constraints.

This joint learning yields highly interpretable results. In the ChestMNIST dataset, the learned feature weights formed visual "importance maps." The model automatically focused on the cardiac silhouette to identify cardiomegaly, mirroring the diagnostic gaze of human radiologists. Furthermore, when applied to CPRD health records, BASIL successfully identified 28 distinct patient subgroups exhibiting clear, interpretable differences in mortality rates and emergency hospital admissions.

Limitations and Future Directions

While BASIL represents a significant step forward for semi-supervised clustering, the authors note a few areas for future improvement:

  • Mean-Field Assumption: The current model assumes features are independent given their cluster assignment. This can miss complex spatial correlations in image data (e.g., the relationship between adjacent pixels). The authors propose exploring "structured variational families" to address this.
  • Implementation Bottlenecks: The current iteration relies on single-core NumPy. Porting the operations to a GPU-accelerated framework like JAX or PyTorch could potentially yield an additional 10–50x speedup.
  • Continuous Data: The current paper focuses heavily on Bernoulli (binary) data distributions. Developing a Gaussian extension to better handle continuous data remains a primary direction for immediate future work.

Summary updated

BibTeX
@inproceedings{wang2026basil,
  author = {Luwei Wang and Dagmara Panas and KE WANG and Bruce Guthrie and Sohan Seth},
  title = {{BASIL: Scalable Bayesian Semi-supervised Clustering with Feature Selection and Adaptive Constraint Weighting}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=4Zps8v8Ni4},
}
Figure