davda54/sam
A PyTorch optimizer wrapper implementing Sharpness-Aware Minimization to improve deep learning model generalization.

This repository provides an unofficial implementation of SAM and ASAM optimizers for PyTorch. SAM works by performing two forward-backward passes to compute a regularized sharpness-aware gradient, which is then passed to an underlying optimizer like SGD with momentum. The technique leads to wider loss minima and improved generalization across various datasets, with robustness to label noise comparable to specialized noisy-label training procedures.