Inferensys

Glossary

TRADES

TRADES (TRadeoff-inspired Adversarial DEfense via Surrogate-loss minimization) is a training algorithm that optimizes the trade-off between natural accuracy and adversarial robustness by decomposing the prediction error into natural and boundary errors.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
ADVERSARIAL ROBUSTNESS TRAINING

What is TRADES?

TRADES (TRadeoff-inspired Adversarial DEfense via Surrogate-loss minimization) is a training algorithm that optimizes the trade-off between natural accuracy and adversarial robustness by decomposing the prediction error into natural and boundary errors.

TRADES is a min-max optimization framework that explicitly balances a model's performance on clean data against its resilience to adversarial perturbations. The algorithm decomposes the total prediction error into a natural error term, minimized on clean examples, and a boundary error term, which penalizes the divergence between the model's output on clean inputs and their adversarially perturbed counterparts. This decomposition allows practitioners to tune a regularization parameter that directly controls the trade-off between standard accuracy and certified robustness.

Unlike standard adversarial training, which optimizes a single loss on adversarially generated examples, TRADES uses a surrogate loss that combines a standard cross-entropy objective with a Kullback-Leibler divergence regularization term. This formulation encourages the model to learn decision boundaries that are not only correct but also smooth and distant from the training data, providing stronger robustness against white-box attacks like Projected Gradient Descent (PGD) without the catastrophic overfitting often observed in single-objective methods.

THE TRADE-OFF ALGORITHM

Key Characteristics of TRADES

TRADES (TRadeoff-inspired Adversarial DEfense via Surrogate-loss minimization) is a foundational adversarial training algorithm that explicitly balances natural accuracy and adversarial robustness by decomposing prediction error into natural and boundary components.

01

The Error Decomposition Principle

TRADES mathematically separates a classifier's prediction error into two distinct sources: natural error (performance on clean data) and boundary error (performance near decision boundaries). The algorithm then optimizes a surrogate loss that minimizes the sum of these errors, creating a tunable trade-off parameter (λ) that controls the balance between standard accuracy and adversarial resilience. This decomposition provides theoretical grounding for why robust models often sacrifice clean accuracy.

λ parameter
Trade-off Controller
2 components
Error Sources
02

The TRADES Objective Function

The core loss function is: min_f E[L(f(x), y) + λ · max_{x'∈B(x,ε)} L(f(x), f(x'))]. The first term enforces natural accuracy by minimizing cross-entropy on clean inputs. The second term enforces robustness by minimizing the KL divergence between predictions on clean data and their worst-case adversarial perturbations within an ε-ball. The hyperparameter λ directly controls the robustness-accuracy trade-off, with higher values prioritizing adversarial resilience.

KL Divergence
Robustness Metric
ε-ball
Perturbation Constraint
03

Multi-Step Perturbation Generation

Unlike single-step methods like FGSM, TRADES employs Projected Gradient Descent (PGD) with multiple iterations (typically 10-20 steps) to craft the inner maximization's adversarial examples. Each step takes a gradient ascent move toward maximizing the KL divergence between clean and perturbed predictions, then projects the perturbation back onto the L∞ ε-ball constraint. This iterative approach generates stronger adversaries than single-step methods, leading to more robust trained models.

10-20 steps
PGD Iterations
L∞ norm
Constraint Type
04

Theoretical Robustness Guarantees

TRADES provides provable upper bounds on the robust error of the learned classifier. The algorithm is derived from a theoretical analysis showing that the robust error is bounded by the sum of natural error and boundary error. By minimizing this bound directly, TRADES achieves state-of-the-art certified robustness under the L∞ threat model. This theoretical foundation distinguishes TRADES from heuristic adversarial training approaches that lack formal guarantees.

Provable
Guarantee Type
L∞ bound
Threat Model
05

Comparison with Standard Adversarial Training

Standard adversarial training (Madry et al.) uses adversarial labels—generating perturbed examples and training with their original labels. TRADES instead uses clean labels for the natural loss and encourages prediction consistency between clean and adversarial views via KL divergence. This key difference means TRADES doesn't force the model to classify perturbed inputs identically to clean ones, but rather to maintain similar output distributions, resulting in smoother decision boundaries and often better clean accuracy at equivalent robustness levels.

Smoother
Decision Boundaries
Higher
Clean Accuracy
06

Implementation and Hyperparameter Tuning

Key implementation considerations include: λ selection (commonly 1.0-6.0, with 6.0 used in the original paper for CIFAR-10), step size for PGD (typically ε/4 for L∞ attacks), and number of PGD steps (10 during training, 20+ for evaluation). TRADES is often combined with early stopping and learning rate scheduling (e.g., piecewise decay at epochs 75 and 90 for 100-epoch training). The algorithm is implemented in the Adversarial Robustness Toolbox (ART) and widely available in open-source repositories.

λ=6.0
Default Trade-off
ε/4
PGD Step Size
METHODOLOGY COMPARISON

TRADES vs. Standard Adversarial Training

A feature-level comparison between the TRADES algorithm and standard adversarial training (e.g., PGD-AT) for achieving model robustness.

FeatureTRADESStandard Adversarial Training

Core Objective

Minimize trade-off between natural and boundary errors

Minimize worst-case empirical risk

Loss Function Decomposition

Natural loss + Regularization term (boundary error)

Cross-entropy on adversarial examples only

Clean Data Utilization

Explicitly trains on clean data in natural loss term

Often discards clean data or uses it only for validation

Perturbation Generation

Generated to maximize KL divergence from clean prediction

Generated to maximize cross-entropy loss

Hyperparameter Sensitivity

Sensitive to λ (trade-off regularization weight)

Sensitive to ε (perturbation radius) and step size α

Natural Accuracy Preservation

Theoretical Guarantee

Decomposes error into natural and boundary components

Empirical robustness; no formal error decomposition

Computational Overhead

Higher (requires clean and adversarial forward/backward passes)

Lower (single adversarial forward/backward pass)

TRADES ALGORITHM

Frequently Asked Questions

Explore the mechanics of the TRADES algorithm, a foundational method for optimizing the trade-off between standard accuracy and adversarial robustness by decomposing prediction error into natural and boundary components.

TRADES (TRadeoff-inspired Adversarial DEfense via Surrogate-loss minimization) is a training algorithm that optimizes a trade-off between natural accuracy and adversarial robustness. It works by decomposing the prediction error into two distinct components: natural error (performance on clean data) and boundary error (performance near the decision boundary). The algorithm minimizes a loss function that combines the standard cross-entropy loss on clean examples with a regularization term that penalizes the divergence between the model's predictions on clean data and their adversarial counterparts. This divergence is measured using the Kullback-Leibler (KL) divergence, encouraging the model to maintain consistent outputs within an epsilon-ball around each training point. Unlike standard adversarial training, TRADES provides a tunable hyperparameter 1/λ that explicitly controls the balance between accuracy and robustness, allowing practitioners to adjust the trade-off based on deployment requirements without retraining from scratch.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.