Abstract
Deep learning (DL) models represent significant intellectual property, yet they are increasingly vulnerable to model extraction attacks. In these attacks, adversaries query a victim model's API to train a surrogate model that mimics its functionality. We present DynaMarks, a novel dynamic watermarking technique that protects models at inference time. By subtly altering output probabilities, DynaMarks "brands" any surrogate model trained on the stolen data without requiring expensive retraining or sacrificing original model accuracy. Our evaluations across Fashion MNIST, CIFAR-10, and ImageNet demonstrate that DynaMarks provides robust ownership verification even against model pruning and data reduction attacks.
The Threat of Model Extraction
Developing high-performing DL models is a resource-intensive process involving massive datasets and vast computational power. This makes models valuable assets. However, they are susceptible to model extraction attacks, where an attacker queries a victim model's API, records the soft labels (output probabilities), and uses them to train a "surrogate" model.
Existing defenses, such as trigger-set watermarking (inserting backdoors during training), often fail because the attacker controls the surrogate's training process. Other methods like "Entangled Watermarks" can double training time and degrade accuracy. DynaMarks addresses these gaps by providing a low-overhead, accuracy-preserving defense suitable for deployment even on untrusted edge devices.
The DynaMarks Framework
The core innovation of DynaMarks is Dynamic Watermarking performed at the API level. Instead of modifying the model's weights, it alters the responses sent to the user during inference.
Watermark Embedding
When a user queries the model, DynaMarks evaluates the output probability vector. If the top prediction's confidence falls within a secret range $(\alpha, \beta)$, the system subtly modifies the output. It shifts a small amount of probability mass ($\Delta p$) from the winning class to a secret "target" class. Crucially, this shift is calibrated to be small enough that it rarely changes the final predicted label, thus preserving the model's primary utility.
Watermark Transfer and Verification
Because the attacker uses these slightly "poisoned" probabilities to train their surrogate, the surrogate model unknowingly learns these secret-dependent distributions. To prove ownership, the original owner compares the output distributions of a suspected model against the original model ($F_{org}$) and the altered version ($F_{alt}$) using Jensen-Shannon Divergence (JSD). Ownership is confirmed if the suspected model is significantly more similar to the altered version than the original, indicated by a ratio $\eta$ exceeding a threshold $\tau$.
Experimental Evaluation
We evaluated DynaMarks on three standard benchmarks: Fashion MNIST, CIFAR-10, and a 10-class subset of ImageNet.
Zero Fidelity Loss
Because probability shifts are carefully controlled, the top-1 accuracy of the original models remained unchanged (e.g., 90.72% for Fashion MNIST and 92.40% for ImageNet). This "plug-and-play" nature allows for protection on pre-trained models without retraining costs.
Robustness to Data Reduction and Pruning
A key strength of DynaMarks is its resilience. Even if an attacker only uses a fraction of the available data to train their surrogate, the watermark remains detectable.
Furthermore, the watermark survives common post-extraction modifications like model pruning. As shown below for ImageNet, even when 50% of the surrogate model's connections are pruned, the detection ratio $\eta$ remains well above the verification threshold.
Conclusion and Future Work
DynaMarks offers a practical, hardware-efficient defense against model extraction. By exploiting the attacker's goal—to mimic the victim model as accurately as possible—it ensures that the more successful the theft, the more deeply the watermark is embedded. Future research will focus on adapting DynaMarks for hard-label attacks (where only the top class is returned) and investigating its resilience against sophisticated statistical steganalysis.
Summary updated