Skip to content
All library documents

SAMformer: Applying Sharpness-Aware Minimization to Convolutional Layers

Article MQL5 articles

Summary

This article covers an implementation step for SAMformer, a shallow Transformer approach to multivariate time-series forecasting that uses Sharpness-Aware Minimization (SAM). It focuses on adding SAM optimization to a convolutional layer in an MQL5 neural-network library. The new layer inherits ordinary convolution behavior, stores adjusted parameter buffers, and uses a blur coefficient to control the SAM step; setting that coefficient to zero returns optimization to the base method. The article explains the inheritance choice and describes how adjusted weights are used during training.

The broader rationale is that a shallow architecture can reduce model complexity, while SAM seeks parameter settings that are less sensitive to small perturbations and may generalize better. The author says models were trained on historical data and that tests improved baseline performance without extra training cost, sometimes reducing it. However, the supplied material includes no numerical results or experimental detail to judge the claim. It describes an implementation rather than a general trading strategy, and the cited benefits require independent validation across datasets and market conditions.

Key ideas

  • SAMformer combines a shallow forecasting architecture with Sharpness-Aware Minimization to target improved generalization.
  • The article implements SAM adjustments for convolutional weights in an MQL5 neural-network layer.
  • A zero blur coefficient bypasses SAM and uses the parent layer's ordinary weight update method.
  • The author reports improved baseline results on historical data but provides no detailed figures in the supplied material.
  • The article concerns model training and implementation, not a tested entry or exit strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.