Sharpness-Aware Minimization (SAM) is a training procedure that seeks parameters in regions where the loss function is uniformly low, rather than just at a single low-value point. It formulates this as a min-max optimization problem, explicitly penalizing sharp minima by minimizing the maximum loss within a defined neighborhood of the current parameters.
Glossary
Sharpness-Aware Minimization (SAM)

What is Sharpness-Aware Minimization (SAM)?
Sharpness-Aware Minimization (SAM) is an optimization algorithm that simultaneously minimizes the loss value and the sharpness of the loss landscape to find flatter minima, which are empirically linked to better generalization and adversarial robustness.
By biasing the optimizer toward flatter minima, SAM reduces the model's sensitivity to small input perturbations, inherently improving its resistance to adversarial examples and noisy data. This approach is distinct from adversarial training, as it modifies the optimization geometry without requiring the generation of specific attack vectors during training.
Core Characteristics of SAM
Sharpness-Aware Minimization (SAM) is an optimization procedure that simultaneously minimizes loss value and loss sharpness to find flatter minima, which are empirically associated with improved adversarial robustness and generalization in deep learning modulation classifiers.
Simultaneous Loss-Value and Loss-Sharpness Minimization
SAM reformulates the standard optimization objective by seeking parameters that minimize not just the training loss, but the maximum loss within a defined neighborhood. This is achieved by solving a minimax optimization problem: an inner maximization step identifies the worst-case perturbation in parameter space, and an outer minimization step updates the weights to reduce the loss at that perturbed location. This dual objective explicitly penalizes sharp minima—regions where the loss landscape exhibits high curvature—and biases convergence toward flat minima that are less sensitive to small parameter variations.
The Perturbation Radius (Rho) Parameter
The hyperparameter ρ (rho) defines the radius of the neighborhood over which the inner maximization is performed. It controls the trade-off between sharpness penalization and convergence speed:
- Small ρ: Behaves similarly to standard SGD, converging to sharper minima with potentially higher training accuracy but lower robustness.
- Large ρ: Aggressively seeks flatter regions, improving generalization and adversarial robustness but may slow convergence or underfit.
- Typical values: Range from 0.01 to 0.2 for normalized inputs; optimal values are dataset and architecture dependent. The perturbation is typically scaled by the parameter norm to maintain scale-invariance across layers.
Connection to Adversarial Robustness
Flat minima discovered by SAM exhibit a direct correlation with adversarial robustness in modulation classification tasks. The underlying principle is that a classifier operating in a flat loss basin requires a larger input perturbation to cross a decision boundary compared to one in a sharp basin. Key mechanisms:
- Gradient obfuscation resistance: Unlike some adversarial training methods, SAM does not rely on gradient masking, making it harder to circumvent with adaptive attacks.
- Complementary defense: SAM can be combined with adversarial training (e.g., PGD-based) to achieve robustness against both white-box and black-box evasion attacks.
- Empirical evidence: Studies show SAM-trained models maintain higher classification accuracy under FGSM and PGD attacks compared to standard SGD-trained baselines.
SAM Optimization Algorithm Mechanics
The SAM algorithm proceeds in two distinct steps per iteration:
- First forward/backward pass: Compute the gradient of the loss at the current parameters w. Scale this gradient to obtain the perturbation ε̂(w) that maximizes loss within the ρ-neighborhood.
- Second forward/backward pass: Evaluate the loss gradient at the perturbed parameters w + ε̂(w). Use this gradient to update the original parameters w. This effectively doubles the computational cost per iteration compared to standard SGD. Variants like ASAM (Adaptive SAM) introduce normalization to make the sharpness definition scale-invariant, improving performance on architectures with varying weight scales.
Generalization Benefits Beyond Robustness
While SAM is prominently studied for adversarial robustness, its primary contribution is to standard generalization—improving test accuracy on clean, unperturbed data. In modulation classification, this translates to:
- Improved performance under channel impairments: Models generalize better to unseen fading, noise, and frequency offset conditions without explicit augmentation.
- Reduced overfitting on small RF datasets: SAM acts as a strong implicit regularizer, particularly valuable when labeled signal data is scarce.
- State-of-the-art results: SAM and its variants have achieved top performance on benchmarks including CIFAR-10, CIFAR-100, and ImageNet, often surpassing sophisticated augmentation strategies alone.
Integration with Adversarial Training Pipelines
SAM can be integrated into existing adversarial training workflows to produce models that are robust to both natural distribution shifts and deliberate adversarial perturbations. A combined approach typically:
- Uses SAM as the outer optimizer to find flat minima.
- Generates adversarial examples (via PGD or FGSM) on-the-fly during training.
- Updates parameters using the adversarial loss gradient at the SAM-perturbed location. This dual strategy addresses two distinct robustness concerns simultaneously: parameter-space sharpness (handled by SAM) and input-space perturbation sensitivity (handled by adversarial training). The resulting models demonstrate superior certified robustness under randomized smoothing frameworks.
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.
Frequently Asked Questions
Explore the mechanics and security implications of the Sharpness-Aware Minimization (SAM) optimizer, a technique designed to find flatter loss minima that correlate strongly with improved adversarial robustness in deep learning modulation classifiers.
Sharpness-Aware Minimization (SAM) is an optimization procedure that simultaneously minimizes the loss value and the loss sharpness of a neural network. Unlike standard optimizers like SGD or Adam that seek a single point with low loss, SAM explicitly seeks a flat minimum in the loss landscape. It works by performing a two-step process: first, it identifies the worst-case parameter perturbation within a defined neighborhood that maximizes the loss; second, it computes the gradient at this perturbed point and applies it to update the model weights. This prevents the model from settling into sharp, narrow minima that are highly sensitive to small input variations, such as adversarial perturbations.
Related Terms
Sharpness-Aware Minimization (SAM) is a foundational optimization technique. The following concepts represent the broader ecosystem of attacks it defends against and complementary robustness strategies.
Evasion Attack
An attack deployed at inference time where an adversary modifies a malicious sample to bypass a trained classifier. In signal classification, this involves adding a carefully crafted adversarial perturbation to an IQ sample. SAM defends against these by finding flatter minima where small input variations do not cause sharp changes in the loss landscape, reducing the attack surface.
Adversarial Budget
The maximum allowable magnitude of a perturbation, typically defined by an Lp-norm bound. In RF modulation classification, this budget constrains the signal-to-noise ratio of the adversarial waveform. SAM's objective directly relates to minimizing the worst-case loss within this budget by ensuring the loss landscape remains flat across the epsilon-ball.
Over-the-Air Attack
A physical-world adversarial attack where a perturbed waveform is transmitted through a real radio channel. The channel introduces natural distortions that can compound with adversarial noise. SAM's flat minima provide resilience not just to the synthetic perturbation but also to the channel impairment variations encountered in real wireless environments.

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