NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Certified Retraining for Binary Hyperdimensional Classifiers Without an Attack Loop

Hyperdimensional computing (HDC) classifies by mapping each input to a very long random vector of ±1 entries, called a hypervector, and comparing it against one stored "prototype" hypervector per class. It is attractive for microcontrollers and in-memory hardware because training is a single pass of additions and inference is a handful of bitwise operations. The same randomness that makes HDC shrug off hardware bit flips does not protect it from a deliberate attacker. A genetic-search attack flips MNIST predictions by changing about 9 of 784 pixels. Adversarial retraining only brings that attack's success rate from 78% to 50%, and it needs up to 5,000 classifier queries per generated example (Adversarial Attacks on Brain-Inspired Hyperdimensional Computing-Based Classifiers). Adversarial training of deep networks has the same structure: an expensive inner search for a worst-case perturbation runs inside every training step. Fast single-step methods reduce that cost but stay fragile.

This note proposes a way out of the inner loop for one important case. For the standard random-projection binary encoder, the effect of any bounded input perturbation can be bounded exactly and cheaply, one coordinate at a time. A coordinate of the hypervector can only flip if its pre-threshold value lies within a computable distance of zero. The worst-case damage to the classification margin is therefore a sum over a known set of "fragile" coordinates. This bound does two jobs. It gives a multi-class robustness certificate for binary HDC, which no prior HDC work provides. It also drives a backpropagation-free retraining rule that uses a closed-form worst-case hypervector in place of a searched adversarial example. The resulting defense costs roughly one extra comparison per hypervector coordinate per training example, instead of thousands of queries or tens of forward and backward passes.

Core Claim

Consider a binary HDC classifier with encoder $h_j(x)=\mathrm{sign}(w_j^\top x+b_j)$ for $j=1,\dots,D$. Each class $k$ has a real-valued prototype $c_k$ that accumulates training hypervectors, and the classifier scores class $k$ as $s_k(x)=\langle h(x),c_k\rangle$. Under an $\ell_p$ perturbation of size $\epsilon$, coordinate $j$ can flip only if it belongs to the fragile set $F_\epsilon(x)=\{j : |w_j^\top x+b_j|\le \epsilon\|w_j\|_q\}$, where $q$ is the dual norm of $p$. Flipping coordinate $j$ changes the margin $m_k(x)=s_y(x)-s_k(x)$ between the true class $y$ and a rival class $k$ by exactly $-2h_j(c_{y,j}-c_{k,j})$. The worst-case margin is therefore bounded below by

$$\underline{m}_k(x)=m_k(x)-\sum_{j\in F_\epsilon(x)}\max\big(0,\;2h_j(x)(c_{y,j}-c_{k,j})\big),$$

and the prediction is certified at radius $\epsilon$ whenever $\underline{m}_k(x)>0$ for every $k\neq y$.

The bound is exact for the relaxed problem in which fragile coordinates flip independently. The real adversary is more constrained, because one perturbation $\delta$ must move all coordinates at once, so the bound is sound. Computing it reuses the pre-activations the encoder already produces, plus precomputed row norms $\|w_j\|_q$.

The bound also tells us which hypervector is worst for training. Let $\tilde h$ be $h(x)$ with the margin-hurting fragile coordinates flipped. The retraining rule then applies the familiar HDC perceptron update, $c_y \leftarrow c_y+\tilde h$ and $c_k\leftarrow c_k-\tilde h$, whenever the certificate fails for rival $k$. The inner maximization of adversarial training reduces to a thresholded comparison over $D$ coordinates. No gradients are needed and no attack is searched.

The claim to test is this: on the benchmarks where HDC adversarial behavior has been measured, certified retraining reaches certified accuracy comparable to the empirical robust accuracy of multi-step adversarial retraining, at a small fraction of the cost.

Relation to Prior Work

Two HDC papers motivate and constrain the design. Adversarial Attacks on Brain-Inspired Hyperdimensional Computing-Based Classifiers establishes the vulnerability and the high cost of attack-based retraining. It also proposes regenerating the random encoder ("re-keying"), which cut its attack's success below 10%. We differ in replacing searched adversarial examples with a closed-form worst case, and in reporting certificates rather than success rates against one attack.

Lipschitz-based robustness estimation for hyperdimensional learning supplies the idea that HDC encoders admit analytic robustness margins and that encoder parameters, specifically the bandwidth of its continuous random-Fourier-feature encoder, can be tuned to enlarge them. That work covers only continuous encoders and binary classification, evaluated on MNIST 1-vs-2. It also tunes only the encoder, not the class prototypes. We extend the idea to the thresholded binary encoders used in hardware and to multi-class prototypes, and we put the bound inside the training rule.

The deep adversarial-training literature supplies the cost comparison. Adversarial training for free! reuses each backward pass for both the weight update and the perturbation update. Fast is better than free: Revisiting adversarial training shows that single-step attacks with random starts can match multi-step training if the model avoids catastrophic overfitting, a failure in which it learns to defeat one-step attacks while collapsing under iterative ones. Both methods still compute a perturbation by gradient, which the sign threshold of a binary encoder makes unreliable. Neither method certifies anything.

Obfuscated Gradients Give a False Sense of Security constrains our evaluation. It showed that non-differentiable and randomized defenses, including thresholding-style input encodings, routinely look robust only because gradients are broken. Binary HDC encoders are exactly such operations. This is why we lead with certificates and test them against adaptive attacks rather than trusting attack success rates.

The HDC fusion layers in Symbolic Representation and Learning With Hyperdimensional Computing and Gluing Neural Networks Symbolically Through Hyperdimensional Computing bind and bundle deep-network outputs without retraining. We considered a related idea: gluing a robust model onto a vulnerable one to share its robustness for free. We rejected it, because bundling is linear, so an attacker can simply push the vulnerable component's contribution, and a plain linear probe over concatenated features is a simpler equivalent.

The application regime is on-device learning. Efficient Uncertainty Aware Human Activity Recognition On Microcontrollers Using Hyperdimensional Computing And Conformal Prediction is an example of the setting where HDC is trained on the device itself, and where a 10-to-100× training multiplier from adversarial training actually costs energy.

Research Program

The first component is the certificate. We will derive the fragile-set bound for $\ell_\infty$ and $\ell_2$ threat models, for both dense Gaussian and sparse ternary projection matrices. We will then measure how loose the bound is by computing exact worst cases with integer programming on small $D$. The looseness comes from treating flips as independent. We expect it to grow with $D$ relative to input dimension, because a fixed number of input pixels then controls more coordinates. Quantifying this is the main analytic risk.

The second component is certified retraining. It starts from standard single-pass bundling and replaces the usual misclassification-driven perceptron update with the certificate-driven one above. We will add a margin-weighted variant that scales the update by how badly the certificate fails.

The third component is encoder shaping. We will choose the projection scale, sparsity, and bias distribution to shrink the expected size of $F_\epsilon(x)$. This is the binary analogue of the bandwidth tuning in the Lipschitz paper. It trades against encoding capacity, and we will map that trade-off explicitly.

The fourth component is an adaptive attack suite built specifically against our defense. It includes a straight-through gradient attack (the backward-pass approximation technique from the obfuscated-gradients paper) that replaces the sign function with a smooth surrogate, followed by AutoAttack-style ensembling as standardized in RobustBench. It also includes the genetic attack of Yang and Ren, an integer-programming attack at small $D$, and averaging over random encoder draws to attack re-keying. Every certificate is checked against every attack. Any attacked example that falls inside its certified radius means there is a bug, and the run is discarded.

Baselines

The naive reference point is a standard binary HDC classifier trained by bundling plus perceptron retraining, with no defense. Yang and Ren report a 78% attack success rate against such a model on MNIST. We will rebuild it with the same encoder dimension and the same number of retraining epochs as every other variant.

The most direct prior defense is attack-based adversarial retraining as in Yang and Ren. Training examples are generated by the genetic attack, which reduced its success rate to 50% at up to 5,000 queries per example. We run it with the same query budget per example that the paper used.

The strongest empirical competitor is one we construct ourselves: multi-step projected-gradient adversarial retraining of the HDC model through a straight-through surrogate of the sign encoder, together with its single-step random-start variant in the style of Wong et al. For context, that single-step recipe reports 45% robust accuracy on CIFAR-10 for a convolutional network trained in 6 minutes (Fast is better than free). That number is for a different model class and is not a target for HDC. No reported result was found on Lacuna for projected-gradient adversarial training of binary HDC classifiers. To keep the comparison fair, we give the gradient methods the same encoder, the same epochs, and a tuning budget over step size and $\epsilon$-schedule equal to the budget we spend on our margin weighting. We then report both their empirical robust accuracy and the certified accuracy our bound assigns to their trained prototypes.

Re-keying is the zero-training baseline from Yang and Ren, which reports below 10% attack success. We evaluate it against attacks that average over encoder draws, as well as attacks that transfer from a known key.

Encoder shaping alone, without certified retraining, isolates the contribution of the Lipschitz-style approach. For that paper's own setting, no reported result was found on Lacuna for robustness margins or accuracy.

The key ablation swaps our per-coordinate bound for a single global Lipschitz bound, either in the certificate or in the training rule. It shows whether the fragile-set structure is what does the work.

Beating the strongest competitor means the following. At matched clean accuracy (within one point), certified accuracy at the target $\epsilon$ is within a few points of, or above, projected-gradient retraining's empirical robust accuracy under our adaptive suite. Training cost must at the same time be at least 10× lower, measured in encoder evaluations and in measured energy on a microcontroller.

Why not just…?

Why not just run projected-gradient or fast single-step adversarial training on the HDC model with straight-through gradients? HDC models are small, so a 10× multiplier is cheap on a GPU. This is the real threat. These methods may reach higher empirical robust accuracy than our certified accuracy. Two considerations cut the other way. First, the straight-through surrogate used to craft training perturbations is the same kind of approximation the obfuscated-gradients paper warns about, so apparent robustness may be partly masking. Second, in the on-device regime the 10× multiplier is paid in battery. The matched-budget comparison settles this question directly. If gradient retraining dominates at equal cost even after we certify its prototypes, the training-rule half of this proposal fails, and only the certificate survives as a contribution.

Why not just re-key the encoder? Re-keying needs no training and drove one attack below 10% success. Its protection comes from the attacker not knowing a random key. That is exactly the stochastic-defense pattern that averaging over randomness broke in Obfuscated Gradients Give a False Sense of Security, where such a defense fell to 0% accuracy. Our experiment attacks re-keying with averaging over encoder draws and with transfer from known keys. Re-keying is also compatible with our method, since certificates hold for any key, so we additionally report the two combined.

Why not just tune the encoder bandwidth as in the Lipschitz-based work? If encoder shaping alone achieves most of the certified accuracy, the prototype-level training rule is unnecessary. The shaping-only ablation measures this directly. We expect shaping alone to fall short because it cannot widen margins between specific confusable class pairs, which is what the certificate-driven update targets. That expectation is unproven.

Why not just use a small certifiably trained neural network? On MNIST such a network may well beat any HDC model. No reported result was found on Lacuna for that comparison. We concede the point outside the HDC regime. Our claim is restricted to classifiers that must keep bitwise inference and single-pass, backpropagation-free on-device training.

Proposed Experiments

The primary benchmark is 10-class MNIST, directly comparable to Yang and Ren. MNIST 1-vs-2 serves as a sanity check against the Lipschitz paper's setting. CIFAR-10 is a stress test, using raw pixels and a fixed, non-learned random-convolution front end. HDC clean accuracy there will be modest, and we will report it honestly rather than tuning around it.

We sweep $D$ from 1,000 to 10,000 and $\epsilon$ across standard $\ell_\infty$ and $\ell_2$ radii. For each setting we report clean accuracy, certified accuracy, empirical robust accuracy under the full adaptive suite, the bound's looseness at small $D$, and training cost in encoder evaluations, wall-clock time, and microcontroller energy.

Three checks are decisive. First, no adaptive attack ever goes below a certificate. Second, certified retraining matches or exceeds attack-based retraining's empirical robustness at at least 10× lower cost. Third, the per-coordinate bound beats the global Lipschitz ablation by a clear margin.

We will report the project as negative if either of two things happens. One is that the fragile set covers most coordinates at useful $\epsilon$, which would make certificates vacuous. The other is that certified accuracy trails gradient retraining's empirical robust accuracy by more than ten points at matched clean accuracy.