Bucks for Buckets (B4B): Active Defenses Against Stealing Encoders

Jan Dubinski, Stanislaw Pawlak, Franziska Boenisch, Tomasz Trzcinski, Adam Dziedzic

Abstract

Self-supervised learning (SSL) encoders represent significant computational investments for Machine Learning as a Service (MLaaS) providers, yet they remain highly vulnerable to model stealing attacks. Adversaries can query an API to obtain embeddings and train a local "student" model to replicate the "teacher" encoder at a fraction of the original training cost. We present Bucks for Buckets (B4B), an active defense framework that monitors user behavior in the embedding space. By utilizing Locality Sensitive Hashing (LSH) to track coverage and applying adaptive noise, B4B selectively penalizes adversarial behavior while preserving utility for legitimate users. Our evaluation shows that B4B reduces stealing accuracy from 65.2% to 12.01% while maintaining a negligible impact (<1%) on benign downstream tasks.

Introduction

In the modern AI ecosystem, high-quality Self-Supervised Learning (SSL) encoders are the "crown jewels" of model providers. Companies like OpenAI and Cohere invest massive compute resources to train models that transform raw data into rich vector representations (embeddings). These embeddings are then monetized via APIs, allowing users to solve various downstream tasks without training their own foundational models.

However, this business model faces a critical threat: Model Stealing. An adversary can query the API with a diverse dataset, record the resulting embeddings, and use them to train a local replica. Until now, defenses have been either reactive (detecting theft after it occurs) or passive (adding static noise that degrades service quality for all users). B4B introduces an active, real-time defense that distinguishes between legitimate use and systematic theft.

The B4B Framework

B4B is built upon the observation that legitimate users and adversaries exhibit fundamentally different querying patterns. Legitimate users typically focus on specific domains (e.g., medical imaging or financial sentiment), meaning their queries cluster in small neighborhoods of the embedding space. Conversely, thieves must explore the entire embedding space to create a faithful replica of the encoder.

1. Coverage Estimation (The "Buckets")

B4B uses Locality Sensitive Hashing (LSH) to discretize the embedding space into "buckets." As a user submits queries, the system tracks which buckets are being filled. Legitimate users, being "boring" in vector space, only occupy a small fraction of these buckets. Adversaries, needing to map the model's full manifold, inevitably fill a much larger percentage of the total bucket count.

2. Adaptive Cost Function (The "Bucks")

Once a user's bucket coverage exceeds a predefined threshold, B4B imposes a "utility tax." The system adaptively adds Gaussian noise to the returned embeddings. The more of the embedding space a user attempts to map, the higher the noise level becomes. This makes the resulting data increasingly useless for training a student model while remaining perfectly functional for the low-coverage queries of legitimate users.

3. Per-User Transformations (Anti-Sybil)

To prevent attackers from circumventing coverage limits by using multiple accounts (Sybil attacks), B4B applies a unique, secret transformation to each user's output. These transformations—such as affine shifts or element shuffling—ensure that embeddings from different accounts exist in different coordinate systems. This forces the attacker to solve a computationally expensive remapping problem before they can aggregate data from multiple accounts.

Experimental Evaluation

The researchers evaluated B4B using state-of-the-art encoders, including SimSiam (ResNet50) and DINO (Vision Transformer).

  • Legitimate Tasks: Evaluated on CIFAR10, STL10, SVHN, and FashionMNIST.
  • Adversarial Datasets: Thieves queried the API using large-scale datasets like ImageNet and LAION-5B.

Key Results

The defense effectively broke the economics of model stealing:

  • Legitimate Utility: Benign users experienced a performance drop of less than 1%. For instance, CIFAR10 accuracy only shifted from 90.41% to 90.24%.
  • Adversarial Deterrence: A standard stealing attack that achieved 65.2% accuracy against an unprotected model was reduced to just 12.01% under B4B protection.
  • Sybil Resistance: Even when attackers split queries across multiple accounts, the per-user transformations increased the query complexity and computational cost by orders of magnitude, making the theft attempt impractical.

Discussion and Limitations

While B4B represents a significant advancement in active model defense, it is not without challenges. The system requires careful parameter tuning, specifically regarding LSH bucket density and noise thresholds, which currently vary by model architecture. Furthermore, while linear remapping between Sybil accounts is mitigated, highly sophisticated adversaries might attempt non-linear remapping using deep neural networks—though this would further increase the financial and temporal cost of the attack.

Conclusion

Bucks for Buckets (B4B) transforms the embedding space into a "toll road" where the cost of travel is paid in signal quality. By leveraging the behavioral differences between legitimate users and thieves, B4B provides a surgical defense that protects intellectual property without compromising the user experience for paying customers. This framework moves the industry toward a more secure MLaaS model where high-value encoders can be shared safely.

Summary updated

BibTeX
@inproceedings{dubinski2023bucks,
  author = {Jan Dubinski and Stanislaw Pawlak and Franziska Boenisch and Tomasz Trzcinski and Adam Dziedzic},
  title = {{Bucks for Buckets (B4B): Active Defenses Against Stealing Encoders}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=NfpYgGZC3B},
}
Figure