Targeted Counterfactual Fingerprinting for Black-Box LLM Ownership Verification

Yutong Wu, Xiaofan Bai, Shixin Li, Pingyi Hu, Ziqi Zhou, Zilong Wang, Xiaojing Ma, Songfeng Lu, Yuhong Li, Jin Xuan, Yi Wang, Dongmei Zhang, Bin Benjamin ZhuarXiv 2026

TL;DR

This paper introduces Targeted Counterfactual Fingerprinting (TCF), a non-invasive method to verify Large Language Model (LLM) ownership via black-box APIs by turning open-ended text generation into a robust, multiple-choice verification task. By optimizing prompt prefixes to trigger specific, highly unlikely "counterfactual" answers, TCF reliably distinguishes a model's derivatives (fine-tuned, quantized, or pruned versions) from independently trained competitors.

What Problem Does This Paper Address?

LLMs are incredibly expensive to train, making them high-value intellectual property. However, third parties can easily plagiarize or reuse released models through fine-tuning, quantization, or distillation, often hiding the derivative models behind a commercial black-box API.

Current ownership verification methods fall short: watermarking requires modifying the model during training or decoding (which can't be done retroactively), while existing black-box fingerprinting techniques are fragile. Because open-ended text generation is highly variable due to decoding randomness, paraphrasing, or formatting changes, full-text matching or soft behavioral scoring often fails. The authors tackle the challenge of obtaining reliable, auditable evidence of model ownership using only hard-label text responses from a black-box interface.

Methods

TCF reformulates verification from open-ended text matching into a constrained-answer targeted counterfactual transfer:

  1. Constrained-Answer Space: Verification prompts are structured as multiple-choice questions (e.g., restricting outputs to A, B, C, D). A deterministic parser maps responses to these hard labels, eliminating semantic scoring ambiguity and decoding noise.
  2. Targeted Counterfactual Transfer: For a given question, the authors identify a target answer that the source model is highly unlikely to choose normally. They then use Greedy Coordinate Gradient (GCG) optimization to find a discrete text prefix (perturbation) that forces the source model to output this specific counterfactual target answer.
  3. Source-Model Counterfactual Margin (SCM): This is a novel, unified metric computed solely on the protected source model. It quantifies both the unlikelihood of the target under the clean prompt and its likelihood after perturbation. SCM guides target selection, acts as an early-stopping criterion during optimization, and filters out weak fingerprints.

As shown in Figure 1, minimizing the target loss during optimization directly drives up the SCM, providing a reliable proxy for generating strong fingerprints:

Fig. 1. The relationship between target loss and SCM. Optimizing the source-side input perturbation reduces the source target loss, increases the mean SCM, and produces a strong negative relation.

Datasets

The fingerprint pool is constructed using multiple-choice questions from the MMLU (Massive Multitask Language Understanding) benchmark. To ensure topic diversity, the authors select 20 fingerprints across four distinct subject categories: Chemistry_val, Engineering_dev, Health_dev, and Physics_val (5 questions per category).

Evaluation is performed across four open-source LLM families acting as the protected source models:

  • Qwen3-1.7B Instruct
  • Qwen3-1.7B Base
  • Llama3-8B Base Direct
  • Mistral-7B-v0.3

These are tested against a suspect pool of 19 to 25 models, including direct derivatives (subjected to SFT, LoRA, RLHF, pruning, or merging) and independently trained negative models (like Yi-6B, Phi-3, and Falcon-7b).

Key Insights and Ideas

  • Hard Labels > Soft Semantics: Forcing the model into a multiple-choice format converts noisy text generation into reproducible, hard-label events. This eliminates the need for brittle semantic similarity models during auditing.
  • The SCM "Feasible Band": Maximizing SCM indefinitely isn't always optimal. Extremely strong perturbations can create generic prompt effects that accidentally transfer to independent models, increasing false positives. TCF utilizes early stopping to find a "sweet spot" prefix length.
  • Local Behavioral Closeness: Derived models inherit the local gradient geometry of their parent model. Even if a model is fine-tuned or quantized, it tends to retain the specific, source-induced counterfactual transitions triggered by the optimized prefixes, whereas independent models do not.

Key Results

  • State-of-the-Art Detection: TCF achieves an average Area Under the ROC Curve (AUC) of 0.9861 across the four LLM families, outperforming state-of-the-art baselines TRAP (0.7931), ProFLingo (0.8880), and ZeroPrint (0.9128). It achieves a perfect 1.0000 AUC on three out of the four evaluated families.
  • Resilience to Distillation and Merging: TCF remains highly effective against model distillation (where an adversary trains a student model on clean teacher outputs), achieving an AUC of 0.88. It also maintains a 1.0 AUC under linear model-merging attacks that cause baseline methods to fail.
  • Lower Overhead: TCF requires significantly less optimization time (~1,269 seconds per fingerprint) compared to TRAP (~8,460 seconds) and operates effectively with a compact, 20-query registry.

Limitations and Future Work

  • Temperature Sensitivity: High decoding temperatures introduce stochastic randomness that can degrade target accuracy, making extreme temperature settings the primary source of performance degradation.
  • Registry Privacy: For real-world deployment, the fingerprint registry must remain strictly confidential. If an adversary leaks or discovers the specific perturbed prompts, they can perform an adaptive LoRA erasure attack to train the model to bypass verification.
  • GCG Optimization Cost: Although faster than some baselines, discrete prompt optimization via GCG still demands substantial source-side computational resources during the offline fingerprint construction phase.

Summary updated

BibTeX
@misc{wu2026targeted,
  author = {Yutong Wu and Xiaofan Bai and Shixin Li and Pingyi Hu and Ziqi Zhou and Zilong Wang and Xiaojing Ma and Songfeng Lu and Yuhong Li and Jin Xuan and Yi Wang and Dongmei Zhang and Bin Benjamin Zhu},
  title = {{Targeted Counterfactual Fingerprinting for Black-Box LLM Ownership Verification}},
  year = {2026},
  eprint = {2608.08195},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.08195},
}
Figure