TL;DR
When open-weight Large Language Models (LLMs) are stolen and disguised via fine-tuning, pruning, or merging, how do you prove where they came from? AttnDiff solves this forensic puzzle without altering the model beforehand, extracting an intrinsic "fingerprint" from how an LLM dynamically re-routes its internal attention when hit with a sudden, single-word semantic contradiction. Even after heavy structural surgery, a model’s instinctive way of untangling a logical conflict gives away its family tree.
What Problem Does This Paper Address?
Training a frontier LLM takes mountains of compute and data, making the resulting weights fiercely guarded intellectual property. Yet once open-weight models are released, bad actors can engage in "model laundering"—taking a checkpoint and disguising its origins through supervised fine-tuning, reinforcement learning (PPO/DPO), pruning, distillation, or merging multiple models together.
How can a legitimate owner prove a suspect model is a disguised derivative of their work? Existing approaches fall into two camps, both with frustrating blind spots:
- Invasive fingerprints inject watermarks or backdoor triggers during training. This can degrade model performance, introduce security vulnerabilities, and is useless for protecting models that are already out in the wild.
- Intrinsic (non-invasive) fingerprints inspect a model's native weights, hidden states, or text outputs. However, weight statistics shatter when layers are pruned, hidden representations drift during heavy fine-tuning, and output-based checks are easily fooled by simple decoding tweaks.
The authors needed a non-invasive, post-hoc forensic method (assuming white-box access during an audit) that survives aggressive parameter and architectural changes.
Methods
Instead of looking at static weights or final text outputs, AttnDiff looks at information-routing dynamics—specifically, how self-attention shifts under pressure.
Here is how the five-step pipeline works:
- Controlled Semantic Conflicts: The authors feed the model $M$ pairs of prompts (typically 60) that are identical except for a single "lexical pivot" word that flips the meaning—for example, "Two parallel lines never intersect" versus "Two parallel lines always intersect."
- Attention Extraction: In a white-box audit, they record the post-softmax causal attention maps across all layers and heads for both the original and corrupted prompts.
- Differential Attention: If different tokenizers cause slight length mismatches between the prompt pair, 2D adaptive average pooling smoothly aligns the matrices to a shared resolution. Then comes the novel core: subtracting the original attention map from the corrupted one ($\Delta A = \tilde{A} - A$). This isolates the exact re-routing triggered by the semantic contradiction.
- Spectral Compression: To make this massive tensor compact and length-invariant, they run Truncated Singular Value Decomposition (SVD) on each head's difference matrix, keeping only the top-$K$ singular values ($K=3$ by default) and concatenating them into a feature vector per probe.
- Cross-Architecture Comparison via CKA: What if an attacker pruned layers or heads, changing the fingerprint's vector length? Direct comparison would fail. Instead, AttnDiff computes an $M \times M$ Gram matrix capturing how the 60 probes relate to each other inside each model, and compares the two models using Centered Kernel Alignment (CKA)—a standard representation similarity metric that effortlessly handles mismatched dimensions.
Datasets
AttnDiff requires no training data—only forward passes at verification time.
- New Probe Dataset: To extract fingerprints, the authors introduce a lightweight set of $M=60$ prompt pairs (~30 words each) evenly split across six domains: Code, Math, Economics, Medicine, Daily QA, and Safe Alignment. Including diverse domains prevents domain-specific fine-tuning from washing out the signal, while Safe Alignment captures unique refusal/policy-gating routing behaviors.
- Evaluation Benchmarks: They test across a zoo of open-source models (1B to 14B parameters) from the Llama-2/3, Qwen2.5, Gemma, and Mistral families, alongside heavily modified derivatives (e.g., CodeLLaMA, Llemma, Sheared-LLaMA, FuseLLM). For adaptive attack tests, they evaluate language modeling utility on a slice of WikiText-2.
Key Insights and Ideas
- Instincts outlast knowledge: While fine-tuning on 700 billion math tokens drastically alters a model's weights and vocabulary preferences, its underlying circuitry strategy for resolving a sudden semantic contradiction remains remarkably intact—and distinct from other model families.
- Differencing is the secret sauce: Why subtract two prompts instead of just reading raw attention maps? In ablations, using standard (non-differential) attention caused similarity on heavily fine-tuned models like Llemma-7B to plummet to
0.29. Subtracting the baseline prompt strips away surface-level domain drift, snapping similarity right back to0.99. - Beating adaptive attackers with "probe refresh": What if a clever thief knows about AttnDiff, steals 80% of the defender's prompts, and explicitly trains the model to suppress attention differences on them? The authors show that the attacker largely overfits to the leaked prompts. Because AttnDiff requires zero model training, the defender can simply swap in a fresh reserve of 60 private prompts at audit time, immediately restoring detection.
Key Results
- Clear Separation: With 60 probes, AttnDiff yields > 0.98 similarity for related derivatives while pushing unrelated model families down to < 0.22.
- SFT & Pruning Resilience: Across Llama-2-7B models fine-tuned on up to 700B tokens, AttnDiff averages 0.9945 similarity (whereas parameter-based baselines collapse to ~0.50 on heavy adaptations). On aggressively pruned models (like Sheared-LLaMA-1.3B) where weight-matching scores literally
0.0000, AttnDiff maintains > 0.9879. - Multi-Parent Attribution in Merges: It tracks lineage across weight-merged models (> 0.95) and even cross-architecture distribution merges like FuseLLM (~0.79 across Llama, OpenLLaMA, and MPT parents).
- Classifier Accuracy & Speed: Treating lineage detection as binary classification across 69 related and unrelated models, AttnDiff achieves the highest overall AUROC (0.9883) and AUPR (0.9881). Better yet, fingerprinting a 7B model takes just 120 forward passes—about 5 minutes on a single RTX 5090 GPU.
Limitations and Future Work
- White-Box Requirement: AttnDiff needs access to internal attention activations, fitting legal audits or leaked weights, not locked-down commercial APIs. While the authors mention a preliminary "DiffLogits" gray-box extension using output log-probabilities, black-box text-only APIs remain out of reach.
- Scoped Adaptive Attack: Their adaptive attacker experiment tested LoRA fine-tuning under a fixed 96-step budget optimizing attention norms rather than CKA directly; unrestricted, compute-heavy adversarial attacks remain an open question.
- Missing Theoretical Guarantees: While CKA empirically handles pruning and fine-tuning gracefully, there is no formal mathematical model proving how specific weight perturbations propagate into spectral attention shifts—a ripe area for future theoretical work.
Summary updated