Convergence
Every iterate stays in the admissible set. Under a standard smoothness assumption, the Confidence Guard loss decreases monotonically and the correction reaches an approximate stationary point at rate O(1/K).
Robust and generalizable classification
Self-Adaptive Revisiting Awareness for Enhancing Robustness and Generalization in Classification Tasks
Overview
Deep networks are vulnerable to small input perturbations, and the samples near the decision boundary carry most of that risk. SARA revisits them while training. In every iteration it finds the misclassified and low-confidence samples of the mini-batch, moves each one to a nearby point that the current model classifies correctly with sufficient confidence and margin, and adds every successful correction to the batch. The correction follows a new loss, the Confidence Guard loss, and SARA works on top of standard training or of adversarial training.
A cross-entropy pull toward the true class plus a hinge penalty on the margin. It bounds the misclassification error and encodes the acceptance criterion exactly.
SARA wraps the base loss of standard training or of PGD, TRADES, MART and LSA adversarial training without changing it.
With the standard ResNet18 at ε = 8/255 and three seeds, SARA keeps the AutoAttack accuracy of adversarial training and lowers its calibration error under attack on every seed.
The correction converges under a standard smoothness assumption, and every accepted sample certifies a robust neighborhood.
The confidence threshold is set relative to chance level, ξ · 10 / C, so the acceptance criterion stays meaningful on CIFAR100 and Tiny-ImageNet-200.
Each accepted correction becomes a fixed target for the adversarial prediction of the same sample, a term that stays active after acceptance and has a provable bound.
Method
SARA adds an inner correction to each mini-batch and a second term to the training objective. Everything else in the training loop stays as it is.
| Challenging set | S = {(x, y) ∈ B : argmaxj fj(x) ≠ y or fy(x) < ξ} |
|---|---|
| Margin | h(x, y) = maxj≠y fj(x) − fy(x) |
| Confidence Guard loss | LCG(x, y) = CE(f(x), y) + λmargin · ReLU(h(x, y) + τ) |
| Inner update | δ ← ΠΔ(δ − α ∇δ LCG(x + δ, y)), Δ = {δ : ‖δ‖∞ ≤ ε, x + δ ∈ [0, 1]d} |
| Alignment | Align(S*) = (1/|B|) Σs∈S* KL(f(x*s) ‖ f(xadvs)), with f(x*s) held fixed |
| Outer objective | LossSARA = Lossbase(B) + LossCG,cap(S*) + β · Align(S*) |
Evidence
ResNet18 with a 3×3 stem, ε = 8/255, PGD-10 training, weight averaging, three seeds with identical initializations and mini-batches, and every SARA setting chosen on a validation split. AutoAttack runs all four stages on 2,000 test images.
| Method | Clean | PGD-20 | AutoAttack | Calibration error under PGD-20 | Cost |
|---|---|---|---|---|---|
| CIFAR10, 30 epochs | |||||
| AT-PGD | 80.52 | 49.95 | 46.80 | 8.54 | 1.00× |
| AT-PGD + SARA | 80.27 | 49.92 | 46.78 | 7.72 | 1.45× |
| SARA without acceptance test | 78.22 | 49.26 | 45.00 | 1.78 | 1.49× |
| SVHN, 20 epochs | |||||
| AT-PGD | 90.91 | 49.49 | 41.38 | 16.84 | 1.00× |
| AT-PGD + SARA | 91.00 | 49.89 | 41.27 | 14.84 | 1.35× |
| SARA without acceptance test | 90.98 | 50.50 | 41.13 | 13.28 | 1.35× |
Accuracies and calibration error in %, means over three seeds; calibration error before temperature scaling. SARA matches the robustness of PGD adversarial training on both datasets. On CIFAR10, removing the acceptance test costs 2.1 points of clean and 1.8 points of AutoAttack accuracy on every seed; on SVHN it changes neither. Training AT-PGD for as long as SARA takes lowers its own robustness. Per-image McNemar tests, temperature-scaled calibration, L2 and corruption results are in Appendix D of the paper and in the released records.
With the hyperparameters of each method tuned individually (Table 3 of the paper), adding SARA raised the robust accuracy of all five base methods. The paper's controlled study attributes most of these margins to per-method tuning and training settings.
Mean over the strongest reported attack per dataset: APGD with ε = 0.2 on MNIST and ε = 0.03 on CIFAR10 and SVHN.
How these numbers were obtained. The charts above show the tuned protocol (Tables 3 and 19 of the paper). The run records of every controlled and standard-protocol experiment are in the results directory.
Theory
Every iterate stays in the admissible set. Under a standard smoothness assumption, the Confidence Guard loss decreases monotonically and the correction reaches an approximate stationary point at rate O(1/K).
The Confidence Guard loss upper-bounds the misclassification indicator, and its two terms encode the confidence and margin conditions of the acceptance region exactly.
Under the current model, an accepted sample is surrounded by a ball of radius min{r, τ / Lh} on which the prediction does not change.
If the adversarial prediction is within KL divergence η of the accepted correction, its confidence and margin fall short of the acceptance criterion by at most √(η/2) and √(2η).
The outer objective adds to the empirical risk a model-dependent vicinity that is concentrated near the decision boundary.
Code
The repository contains the method, the GAIRAT, FAT and OHEM baselines, the scripts of every experiment, and unit tests. MNIST, CIFAR10, CIFAR100 and SVHN download automatically.
git clone https://github.com/khalooei/SARA.git
cd SARA && pip install -e .
python train.py --dataset cifar10 --model resnet18-cifar \
--base-loss pgd --at-epsilon 0.031373 --pgd-steps 10 \
--sara --sara-align 3 --xi 0.2 --sara-max-correct 64 \
--cg-confidence-cap --ema-decay 0.999 --epochs 30 \
--eval-apgd --eval-autoattack 1000 --out-dir runs/cifar10/sara
from sara import SARAConfig, build_base_loss, sara_training_step
base_loss = build_base_loss("pgd") # ce, pgd, trades, mart
cfg = SARAConfig(epsilon=8/255, xi=0.2, kappa=10, max_batch_correct=64,
cg_confidence_cap=True, align_weight=3.0)
for x, y in train_loader:
stats = sara_training_step(model, optimizer, x, y,
base_loss, cfg,
base_loss_kwargs={"pgd_steps": 7})
Citation
@misc{khalooei2026sara,
title = {Self-Adaptive Revisiting Awareness for Enhancing Robustness
and Generalization in Classification Tasks},
author = {Khalooei, Mohammad and Amirmazlaghani, Maryam
and Homayounpour, Mohammad Mehdi},
year = {2026},
howpublished = {\url{https://github.com/khalooei/SARA}}
}