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.
Glossary
TRADES

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
| Feature | TRADES | Standard 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) |
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
TRADES sits at the intersection of accuracy and security. These related concepts define the theoretical foundations, attack vectors, and complementary defenses that contextualize the trade-off optimization problem.
Adversarial Training
The foundational defensive technique that augments training datasets with adversarial examples. Standard adversarial training minimizes loss on the worst-case perturbation, often leading to a robustness-accuracy trade-off. TRADES refines this by explicitly decomposing the error, providing a theoretical grounding for why standard methods degrade natural accuracy.
Projected Gradient Descent (PGD)
A powerful iterative white-box attack and the de facto standard for generating adversaries during TRADES training. PGD takes multiple small steps in the gradient direction and projects the result back onto an epsilon-ball constraint. TRADES specifically uses the KL divergence under PGD perturbations to measure boundary error.
Gradient Masking
A false sense of security where defenses produce obfuscated or shattered gradients, fooling gradient-based attacks like PGD. TRADES avoids this pitfall by optimizing a smooth surrogate loss. Detecting gradient masking is critical: if a defense relies on it, a black-box attack will easily break the model.
Certified Robustness
Unlike TRADES, which provides empirical robustness, certified methods offer a mathematical guarantee that no perturbation within a specified radius can change the prediction. Techniques like Randomized Smoothing complement TRADES by providing provable lower bounds on the robustness that TRADES optimizes heuristically.
Min-Max Optimization
The mathematical framework underpinning TRADES. The objective is to minimize the empirical risk against an adversary that maximizes the loss. TRADES reformulates this into a sum of natural error and a regularizer for boundary error, making the saddle-point problem more tractable and theoretically sound.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us