Sharpness-Aware Minimization with Z-Score Gradient Filtering: +5.26% accuracy over SGD, Apple Silicon optimized, fully reproducible
Clone the repo and run the demo:
git clone https://github.com/bangyen/zsharp.git
cd zsharp
pip install -e .
pytest # optional: run tests
python -m scripts.train --config configs/zsharp_baseline.yamlOr open in Colab: Colab Notebook.
| Scenario / Dataset | Baseline | This Project | Δ Improvement |
|---|---|---|---|
| CIFAR-10 ResNet-18 | 74.89% | 80.15%* | +5.26% |
*Benchmark results from full training runs. Local results may vary based on configuration.
- Z-Score Gradient Filtering — Intelligent gradient filtering with a default 70th percentile threshold (configurable) for improved training stability.
- Apple Silicon Optimization — Up to 4.39x speedup using MPS (Metal Performance Shaders) for faster training on Mac.
- Comprehensive Testing — 98% test coverage with 51 unit tests ensuring reliability and reproducibility.
zsharp/
├── zsharp_demo.ipynb # Colab notebook demo
├── scripts/ # Training and experiment scripts
├── tests/ # Unit/integration tests (51 tests)
├── docs/ # Documentation and training curves
├── configs/ # Configuration files
├── results/ # Experimental results
└── src/ # Core implementation
- ✅ 98% test coverage (
pytest) - ✅ Reproducible seeds for experiments
- ✅ Benchmark scripts included
- Sharpness-Aware Minimization with Z-Score Gradient Filtering — Original research paper by Juyoung Yun.
- Sharpness-Aware Minimization — Foundation SAM algorithm research.
This project is licensed under the MIT License.
