Introduction
An availability attack publishes a training set in which every image has been changed by a perturbation inside an ball of radius , with the labels left intact. A model trained from scratch on the released set should then generalise as badly as possible to clean test data. The question this task asks is: which per-image perturbation, computed from the whole labelled training set, does that best?
The field has two broad answers. One optimises the perturbation through a surrogate network so that the perturbed images are as easy as possible to fit, the error-minimising noise of unlearnable examples [1]; the network then learns the perturbation instead of the image. The other observes that what such perturbations have in common is that they are shortcuts, simple class-correlated patterns a network prefers to the semantics [2], and constructs them directly, for instance as autoregressive processes [3] or with linear classifiers alone [4]. Further work studies why these perturbations work [5] and re-thinks how availability attacks are designed [6].
Two things make the problem hard. First, a shortcut has to be learnable earlier than the semantics. A pattern that a victim can decode only late in training, after its learning rate has decayed, competes with the real features on equal terms and loses; random augmentation (crops and flips) makes this worse for any pattern tied to fixed pixel positions. Second, the victim may train against an adversary. An adversarially trained victim sees each training image moved within its own ball of radius , and a shortcut whose margin is smaller than that movement is simply erased; robust variants of error-minimising noise were designed for this case [7, 8]. A generator that must serve both kinds of learner has to be strong on the first without being trivially removable by the second.
Method
Our generator has two mechanisms, a signed harmonic class code and a class-tied worst-case template, and a dispatch that chooses between them from what the harness discloses about the victims' training pipeline. The class's one-line docstring states the design: "Signed harmonic shortcuts and class-tied worst-case robust templates."
Dispatch
The task interface gives the generator a regime string. If it declares adversarial training with a radius, we parse that radius; otherwise we assume an adversary of radius . The harmonic code is used when the victims train normally or when , a radius small enough that the code's margin survives it; for larger or undeclared radii the robust template is used, provided at least 120 seconds of the generation budget remain and the training set is non-empty. If the robust branch decides that the budget cannot buy even one surrogate epoch, it returns nothing and the harmonic code is released instead. A zero budget returns a zero perturbation.
def generate(self, X, y, eps, surrogate_fn, budget, regime):
if eps == 0:
return np.zeros(X.shape, dtype=np.float32)
radius = eps / 2
if isinstance(regime, str) and regime.startswith("advtrain:"):
try:
radius = float(regime.split(":", 1)[1]) / 255.0
except ValueError:
pass
if regime == "standard" or (regime.startswith("advtrain:") and radius <= eps / 4):
return self._spectral(X, y, eps, budget)
if budget.seconds_left() >= 120 and len(X) > 0:
out = self._robust(X, y, eps, surrogate_fn, budget, radius)
if out is not None:
return out
return self._spectral(X, y, eps, budget)Signed harmonic class codes
Each class is assigned one spatial frequency per colour channel. With we draw integers and set
with drawn independently. The first two channels carry a mirror pair: a horizontal flip maps the frequency to , so a flipped image carries the same pair of frequencies, exchanged between the two channels, and the remaining channels carry a purely vertical (axial) mode that a horizontal flip leaves unchanged. Each image gets one phase , shared by all its channels, and its perturbation at column , row is
where are the two components of . Three properties are deliberate.
The label is spectral, not positional. Because the phase is random per image, no fixed spatial pattern is shared by a class; what the class shares is which frequencies carry power. A random crop shifts the wave, which only changes its phase, so the class code survives augmentation that destroys a code tied to pixel positions.
The wave is signed. Taking the sign of the cosine turns it into a square wave at the full budget, which has the most energy the ball allows and, by its Fourier series, , carries a comb of odd harmonics of every class frequency. We expected, and our development runs supported, that this redundancy is what lets the code survive a small adversary: removing the fundamental does not remove the harmonics.
It is model-free. The code uses no surrogate and no optimisation, and is generated in chunks with a deadline check, so a budget that runs out leaves the unfinished chunks at zero rather than overrunning. In our development runs it took about three seconds for a whole training set.
def _spectral(self, X, y, eps, budget):
y = np.asarray(y, dtype=np.int64)
n, c, h, w = X.shape
out = np.zeros(X.shape, dtype=np.float32)
if n == 0:
return out
k = int(y.max()) + 1
scale = max(1, min(h, w) // 4)
modes = np.empty((k, c, 2), dtype=np.int64)
for cls in range(k):
a, b = self.rng.integers(1, scale + 1, size=2)
modes[cls, 0] = (a, b)
modes[cls, 1] = (-a, b)
modes[cls, 2:, 0] = 0
modes[cls, 2:, 1] = self.rng.integers(1, scale + 1, size=c - 2)
phases = self.rng.uniform(0, 2 * np.pi, (n, 1, 1, 1)).astype(np.float32)
yy, xx = np.meshgrid(np.arange(h, dtype=np.float32),
np.arange(w, dtype=np.float32), indexing="ij")
for lo in range(0, n, 512):
if budget.seconds_left() < 0.25:
break
hi = min(n, lo + 512)
f = modes[y[lo:hi]]
theta = (f[:, :, 0, None, None] * xx / w +
f[:, :, 1, None, None] * yy / h) * np.float32(2 * np.pi)
out[lo:hi] = np.sign(np.cos(theta + phases[lo:hi])) * np.float32(eps)
return outClass-tied worst-case templates
When the victim trains against a radius comparable to the budget, we optimise instead. The perturbation is a single template per class, so that image receives . Tying the perturbation to the class removes the per-image capacity that a sample-wise perturbation can spend on fitting one surrogate's idiosyncrasies.
Surrogate. We first train the fresh surrogate adversarially on the clean data, at the same radius , with random crop-and-flip augmentation and a five-step projected-gradient (PGD) adversary with step from a random start, using SGD with learning rate 0.1. The number of epochs is at most 20 and is set from the remaining budget, using 0.65 of it at an estimated cost per image; an epoch is not started unless the time left is at least 35 seconds plus the last epoch's duration.
model = surrogate_fn().to(memory_format=torch.channels_last)
opt = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9, weight_decay=5e-4)
total = budget.seconds_left()
epoch_estimate = max(0.001, 0.0002 * n)
ref_epochs = min(20, int(0.65 * total / epoch_estimate))
if ref_epochs < 1:
return None
batch = 128
last = 0.0
for _ in range(ref_epochs):
if budget.seconds_left() < 35 + last:
break
start = time.time()
order = torch.randperm(n, device=dev, generator=g)
for i in range(0, n, batch):
idx = order[i:i + batch]
adv = self._pgd(model, self._augment(Xt[idx], g), yt[idx], radius, g)
opt.zero_grad(set_to_none=True)
loss = torch.nn.functional.cross_entropy(model(adv - 0.5), yt[idx])
loss.backward()
opt.step()
last = time.time() - startTemplates. The templates start as random signs on blocks of pixels, , scaled to , and are then updated pixel by pixel. Writing for an augmented poisoned image, the template objective for is to make the poisoned image easy to fit even at the adversary's worst-case point:
The inner maximum is found with the same PGD adversary, and the template gradient is taken at the adversarial point through a straight-through view, , so that the value is the adversarial image and the gradient flows to directly. Each template update is a signed step
with the surrogate frozen. For we take one such update per surrogate step. When the PGD adversary is replaced in the template loss by uniform noise in the radius- ball, and three updates are taken per surrogate step. After the template update the surrogate takes one SGD step (learning rate 0.03) on PGD-adversarial versions of freshly augmented poisoned images, so that it keeps tracking an adversarially trained victim of the poisoned data. The number of steps is
proportional to the training-set size above the floor, unchanged for and growing in proportion to above it, and the loop stops when fewer than 25 seconds remain.
opt = torch.optim.SGD(model.parameters(), lr=0.03, momentum=0.9, weight_decay=5e-4)
b = max(1, h // 4)
template = torch.randint(0, 2, (k, c, h // b, w // b), device=dev, generator=g).float() * 2 - 1
template = template.repeat_interleave(b, 2).repeat_interleave(b, 3) * eps
template.requires_grad_(True)
steps = max(1500, int(0.15 * n * max(1.0, 2.0 * radius / eps)))
for _ in range(steps):
if budget.seconds_left() < 25:
break
idx = torch.randint(0, n, (batch,), device=dev, generator=g)
xb, yb = Xt[idx], yt[idx]
model.eval()
for p in model.parameters():
p.requires_grad_(False)
for _ in range(1 if radius < eps else 3):
p = self._augment((xb + template[yb]).clamp(0, 1), g)
if radius < eps:
adv = self._pgd(model, p.detach(), yb, radius, g)
model.eval()
z = p + (adv - p.detach()).detach()
loss = torch.nn.functional.cross_entropy(model(z - 0.5), yb)
(gd,) = torch.autograd.grad(loss, template)
else:
noise = (torch.rand(p.shape, device=dev, generator=g) * 2 - 1) * radius
loss = torch.nn.functional.cross_entropy(model((p + noise).clamp(0, 1) - 0.5), yb)
(gd,) = torch.autograd.grad(loss, template)
with torch.no_grad():
template = (template - eps / 8 * gd.sign()).clamp(-eps, eps)
template.requires_grad_(True)
for p in model.parameters():
p.requires_grad_(True)
p = self._augment((xb + template[yb]).clamp(0, 1), g)
adv = self._pgd(model, p, yb, radius, g)
model.train()
loss = torch.nn.functional.cross_entropy(model(adv - 0.5), yb)
opt.zero_grad(set_to_none=True)
loss.backward()
opt.step()
return template.detach()[yt].cpu().numpy()The objective is the class-tied counterpart of the min-max-min objective of robust error-minimising noise [7]: what is new is not the objective but tying it to the class, running it with one straight-through update per surrogate step, and pairing it with the model-free harmonic code under a single dispatch.
Results
| Method | ① | |||||
|---|---|---|---|---|---|---|
| Accuracy, standard training ↓ | Accuracy, grayscale ↓ | Accuracy, JPEG-10 ↓ | Accuracy, adversarial 2/255 ↓ | Accuracy, adversarial 4/255 ↓ | Accuracy, adversarial 8/255 ↓ | |
| Kimi K3.1 Pro | 0.140 | 0.722 | 0.823 | 0.169 | 0.273 | 0.863 |
| Error-minimizing noise | 0.235 | 0.914 | 0.836 | 0.608 | 0.864 | 0.840 |
| Error-minimizing, class-wise | 0.115 | 0.673 | 0.818 | 0.390 | 0.688 | 0.850 |
| Linearly separable noise | 0.203 | 0.720 | 0.791 | 0.735 | 0.894 | 0.838 |
| AR | 0.119 | 0.697 | 0.852 | 0.923 | 0.894 | 0.847 |
| REM | 0.301 | 0.762 | 0.830 | 0.364 | 0.484 | 0.861 |
| SEM | 0.141 | 0.304 | 0.831 | 0.205 | 0.330 | 0.859 |
| EntF-push | 0.906 | 0.903 | 0.758 | 0.811 | 0.780 | 0.753 |
| Fang et al. | 0.127 | 0.502 | 0.838 | 0.220 | 0.380 | 0.855 |
| MI-UE | 0.140 | 0.335 | 0.848 | 0.203 | 0.846 | 0.842 |
| PIL | 0.192 | 0.167 | 0.811 | 0.835 | 0.875 | 0.834 |
| Class-wise random noise | 0.132 | 0.144 | 0.857 | 0.923 | 0.892 | 0.844 |
| Unmodified data | 0.945 | 0.928 | 0.848 | 0.924 | 0.895 | 0.849 |
- ① CIFAR-10 · one release, six ResNet-18 learners (standard, grayscale, JPEG-10, adversarial training at 2, 4 and 8/255)
The released set is strongest on learner 4 and learner 5. On learner 4 the victim reaches 0.169 against 0.203 for the strongest published attack there, MI-UE [5]; on learner 5 it reaches 0.273 against 0.330 (SEM [8]). Both are the lowest values in the table, and on both learners unmodified data gives 0.924 and 0.895.
On learner 1 the result is competitive but not the best: 0.140 against 0.115 for EM, class-wise [1], with four published attacks below ours.
On the other three learners the poison is weak. On learner 2 the victim reaches 0.722, against 0.144 for Class-wise noise [1]; eight published attacks do better there. On learner 3 we reach 0.823 against 0.848 for unmodified data, a small reduction, with four published attacks below ours. On learner 6 the victim reaches 0.863, which is above the 0.849 of unmodified data and the highest value in that column: on learner 6 our perturbation does not reduce accuracy at all.
The pattern is therefore uneven: the clearest gains in the table sit next to a failure. The results do not show which property of a learner decides which of these it gets, and we do not attribute them to a branch of the dispatch.
How we got here
We began by reading the reference attacks and concluding that they fail in two distinct ways: normal training exploits class-correlated shortcuts, while adversarial training can erase them. We decided to measure the two regimes separately rather than look for one surrogate objective for both, and built our own development harness: a reduced training subset for fast screening, full-size runs for confirmation, exact 8-bit quantisation of the released images, and victims trained with crops and flips, with and without an adversary. All figures below are our development measurements of clean test accuracy, lower being better.
- Smooth class codes beat pixel noise. Our first probes compared model-free class codes. Class-wise pixel noise did not lower accuracy at all under crop-and-flip augmentation, while spatially smooth class codes (sign cells repeated as blocks, or low-pass signs) were far stronger. This told us the code had to survive cropping, which led to the next idea.
- Phase-randomised Fourier codes. Giving each class frequencies and each image a random phase made the label spectral rather than positional. On the reduced subset this reached about 0.11 against about 0.62 for clean training. A mirror pair plus an axial mode, and one global phase per image rather than one per channel, improved it further.
- The reduced subset misled us about seed sensitivity. On it, the global-phase code ranged from 0.1065 to 0.4705 across generator seeds. We read this as a learnability threshold: the poison works only when the victim masters the code before its learning-rate decay, and a smaller subset gives fewer steps per epoch. At full size, four generator seeds gave 0.0978 to 0.1020, and from then on we made final choices only on full-size runs.
- Signing the wave. Replacing the cosine by its sign helped most where the code was weakest: at the smallest budget we tried, 0.2290 against 0.5804 for the cosine, and against a victim adversary of intermediate radius, 0.2750 against 0.8304 (clean training gave 0.8398 there). A square wave with an asymmetric duty cycle, which has even harmonics and a mean offset, was much worse (0.7034), which supported the odd-harmonic explanation over a generic "more energy" one.
- The harmonic code fails against stronger adversaries. Against the largest adversary radius we tried the signed code reached only 0.7182, and against the intermediate radius in another development configuration 0.4572. This is why a robust branch exists.
- Robust mechanisms we abandoned. Before arriving at class-tied templates we tried and rejected a worst-case linear template, a second-order objective that differentiates through a virtual victim update, a fixed random-projection margin, and a "semantic swap" that pushes each image's robust embedding toward another class's centroid; all ended around 0.36 to 0.46 on the reduced subset. Our own full-length runs of sample-wise robust references also did worse than their short-budget versions, which we read as a surrogate that overfits with longer optimisation.
- Class tying worked. A per-class template optimised through an adversarially trained surrogate was the first strong robust alternative (0.2555 on the reduced subset). At full size its first schedule gave the surrogate only a few epochs; making the step count proportional to the training-set size took one development configuration from 0.2892 to 0.1968 and another from 0.3200 to 0.3086. Doubling the steps at the largest radius we tried took that case from 0.6336 to 0.5538, against 0.7182 for the harmonic code; this is the factor.
- More variants that did not survive. Pooling several codebooks per class (0.8296), independent channel phases (better in one development configuration, worse in another), a larger frequency set (0.5638 against 0.4572), an exponential-moving-average surrogate for the template gradient, decaying the surrogate's learning rate, and initialising the templates with the harmonic code all failed to improve consistently. The harmonic initialisation looked like a clear gain at one generator seed (0.2622 against 0.3086) and was worse at a second (0.3518 against 0.3256), so we reverted it.
- A false diagnosis. At one point we concluded that the class templates had collapsed onto almost the same pattern, and tried zero-mean, capped-mean and anchored constraints on the codebook to prevent it, the anchored one by analogy with the commitment constraint on discrete codes [9]; none helped (the anchored one gave 0.4490 against 0.2900 for its control). We later found that the diagnostic had paired templates with the wrong class labels; correctly aligned, the templates are nearly orthogonal, so the collapse never existed. The constraints were judged on their victim results, not on that diagnostic.
- The worst-case template objective. Our earlier templates were updated against uniform noise in the ball while the surrogate trained against PGD. Making the template loss worst-case as well improved the reduced-subset results, and we then had two versions: three worst-case updates per surrogate step, or one, using the straight-through gradient, which we checked to be identical to the chain-rule gradient. The one-update version took one development configuration from 0.1926 to 0.1354 at one generator seed, but was much weaker in another (0.2934 against 0.0980). Over twelve matched development measurements its mean was 0.1844 against 0.1904, and its worst case 0.2934 against 0.3174; on those two summaries we submitted the one-update version. At the full radius both keep the three noise-averaged updates.
Limitations
- Learner 6, and to a lesser degree learner 2 and learner 3. On learner 6 the victim trained on our released set reaches 0.863, above the 0.849 of unmodified data, and on learner 2 eight published attacks do better than we do. We beat every published attack on learner 4 and learner 5 only; we cannot claim a poison that works against every learner.
- The dispatch depends on a declaration. Which mechanism is released is decided by the disclosed training regime. When none is disclosed we assume a radius of ; the thresholds for the harmonic code and for the noise-averaged update, like the step schedule and the budget fractions, were chosen from development runs rather than derived.
- The final choice was close. The one-update template was preferred over the three-update one on a 0.0060 difference in a development mean and on its worst case, while being far worse in one development configuration. Our development runs also showed generator-seed variation of several points in the robust branch, larger than some of the differences we acted on.
- Development evidence is our own. Every development figure above comes from our own harness, mostly from single runs.
- Class-tied perturbations share one pattern per class. Both mechanisms give every image of a class the same template or the same frequencies, which is what makes them learnable shortcuts; we did not test whether a defender who estimates that shared structure from the released set could remove it.
References
- Hanxun Huang, Xingjun Ma, Sarah Monazam Erfani et al. (2021). Unlearnable Examples: Making Personal Data Unexploitable. ICLR.
- Da Yu, Huishuai Zhang, Wei Chen et al. (2022). Availability Attacks Create Shortcuts. KDD.
- Pedro Sandoval-Segura, Vasu Singla, Jonas Geiping et al. (2022). Autoregressive Perturbations for Data Poisoning. NeurIPS.
- Jinlin Liu, Wei Chen, Xiaojin Zhang (2026). Perturbation-Induced Linearization: Constructing Unlearnable Data with Solely Linear Classifiers. ICLR.
- Yifan Zhu, Yibo Miao, Yinpeng Dong et al. (2026). Why Do Unlearnable Examples Work: A Novel Perspective of Mutual Information. ICLR.
- Bin Fang, Bo Li, Shuang Wu et al. (2023). Re-thinking Data Availablity Attacks Against Deep Neural Networks.
- Shaopeng Fu, Fengxiang He, Yang Liu et al. (2022). Robust Unlearnable Examples: Protecting Data Against Adversarial Learning. ICLR.
- Yixin Liu, Kaidi Xu, Xun Chen et al. (2024). Stable Unlearnable Example: Enhancing the Robustness of Unlearnable Examples via Stable Error-Minimizing Noise. AAAI.
- Aaron van den Oord, Oriol Vinyals, Koray Kavukcuoglu (2017). Neural Discrete Representation Learning. NeurIPS.