# SGM-EMA: Speech Enhancement Method Score-Based Diffusion Model and EMA Mechanism
## 2 Methodology
### Numerical SDE Solver  
In the speech enhancement task, the accuracy and stability of the numerical SDE solver directly affect the performance of the model. This section elaborates on the solution method for numerical SDEs. When dealing with the numerical solution of stochastic differential equations, researchers have developed a variety of approximate methods based on discrete time steps. In general, the time interval \([0,\text{T}]\) is divided into N equal parts, with each subinterval having a length of \(\Delta t=\text{T}/\text{N}\). Based on this, the original continuous formula is transformed into a discrete sequence \(\{\mathbf{x}_{t}\), \(\mathbf{x}_{T-\Delta t}\),..., \(\mathbf{x}_{0}\}\) to be solved numerically. Among the many single-step methods, the Euler-Maruyama method is widely used. In each iteration, it first checks the state of the previous moment and then combines the characteristics of drift and Brownian motion to infer the state value of the current moment. This method is relatively intuitive in calculation, but it is also necessary to pay attention to the impact of the choice of step size on the result. In this study, we used the predictor-corrector (PC) samplers proposed by [PERSON] et al. [41]. The core of this sampler is to cleverly combine the solution strategy of the reverse SDE with numerical optimization methods, such as annealing Langevin dynamics [46]. Algorithm 1 [41] outlines the principles of the PC sampler. The PC sampler mainly consists of two main components: the predictor and the corrector. The predictor can use various single-step calculation methods, and its primary function is to approximate the reverse SDE through iterative computation. After each iteration of the predictor, the current state of the process will be further optimized and improved by the corrector. The corrector is essentially a stochastic gradient ascent optimizer based on Markov chain Monte Carlo sampling. In each iterative step, a small adjustment is made along the gradient direction of the estimated score function, and a small amount of noise interference is introduced to ensure that the sampling points converge near the target distribution, improving the generation quality and stability. The solver is implemented in Python 3.12.3. In this study, we explore two different numerical methods for the predictor: the Euler-Maruyama method, a classic single-step method for approximating SDEs, and the reverse diffusion method, which offers higher accuracy in solving the reverse SDE. Through iterative updates, the predictor guides the sampling trajectory toward cleaner speech representations. Our ablation studies demonstrate that the choice of method in the predictor impacts speech enhancement quality. ```
```
1:N:Number of discretization steps for the reverse-time SDE
2:M:Number of Corrector steps
3:Initialize \(\mathrm{x}_{N}\backsim\mathrm{x}_{T}\)
4:for\(i=N-1\) to 0 do
5:\(\mathrm{x}_{i}\leftarrow\mathrm{Predictor}(\mathrm{x}_{i+1})\)
6:for\(j=1\) to \(M\) do
7:\(\mathrm{x}_{i}\leftarrow\mathit{Corrector}(\mathrm{x}_{i})\)
8:return \(\mathrm{x}_{0}\)
```

**Algorithm 1**Predictor-Corrector (PC) Sampling

### EMA Mechanism

The basic principle of the traditional attention mechanism is to assign weights to each element in the input sequence and perform a weighted summation to extract the key features. It has been shown [47; 48] that capturing multi-level contextual information is crucial to improving the performance of speech enhancement models based on deep neural networks. The EMA mechanism [49] adopts a novel approach by dynamically generating attention weights through multi-scale parallel sub-networks and cross-space learning instead of the traditional exponential moving average. To update the attention weights, EMA incorporates three parallel pathways, with two in the \(1\times 1\) branch and one in the \(3\times 3\) branch, as shown in Figure 2[49].