Noise impact on recurrent neural network with linear activation function
In recent years, more and more researchers in the field of neural networks
are interested in creating hardware implementations where neurons and the
connection between them are realized physically. The physical implementation of
ANN fundamentally changes the features of noise influence. In the case hardware
ANNs, there are many internal sources of noise with different properties. The
purpose of this paper is to study the peculiarities of internal noise
propagation in recurrent ANN on the example of echo state network (ESN), to
reveal ways to suppress such noises and to justify the stability of networks to
some types of noises.
  In this paper we analyse ESN in presence of uncorrelated additive and
multiplicative white Gaussian noise. Here we consider the case when artificial
neurons have linear activation function with different slope coefficients.
Starting from studying only one noisy neuron we complicate the problem by
considering how the input signal and the memory property affect the
accumulation of noise in ESN. In addition, we consider the influence of the
main types of coupling matrices on the accumulation of noise. So, as such
matrices, we take a uniform matrix and a diagonal-like matrices with different
coefficients called "blurring" coefficient.
  We have found that the general view of variance and signal-to-noise ratio of
ESN output signal is similar to only one neuron. The noise is less accumulated
in ESN with diagonal reservoir connection matrix with large "blurring"
coefficient. Especially it concerns uncorrelated multiplicative noise.
V. M. Moskvitin, N. Semenova
# Noise impact on recurrent neural network with linear activation function

###### Abstract

Over the past few years, artificial neural networks (ANNs) have found their application in solving many problems from pattern recognition to predicting climate phenomena. Despite the existence of high-power computing clusters with the ability to make parallel calculations, neural network modeling on digital equipment is a bottleneck in network scaling and the speed of obtaining and processing information. In recent years, more and more researchers in the field of neural networks are interested in creating hardware implementations where neurons and the connection between them are realized physically.

The physical implementation of ANN fundamentally changes the features of noise influence. In the case hardware ANNs, there are many internal sources of noise with different properties. The purpose of this paper is to study the peculiarities of internal noise propagation in recurrent ANN on the example of echo state network (ESN), to reveal ways to suppress such noises and to justify the stability of networks to some types of noises.

In this paper we analyse ESN in presence of uncorrelated additive and multiplicative white Gaussian noise. Here we consider the case when artificial neurons have linear activation function with different slope coefficients. Starting from studying only one noisy neuron we complicate the problem by considering how the input signal and the memory property affect the accumulation of noise in ESN. In addition, we consider the influence of the main types of coupling matrices on the accumulation of noise. So, as such matrices, we take a uniform matrix and a diagonal-like matrices with different coefficients called "blurring" coefficient.

We have found that the general view of variance and signal-to-noise ratio of ESN output signal is similar to only one neuron. The noise is less accumulated in ESN with diagonal reservoir connection matrix with large "blurring" coefficient. Especially it concerns uncorrelated multiplicative noise.

## 1 Introduction

Over the past few years, artificial neural networks (ANNs) have been applied in solving many problems [1]. Such tasks include image recognition [2, 3], image classification, improvement of sound recordings, speech recognition [4], prediction of climatic phenomena [5] and many others.

The basic principle of ANN construction is signal propagation between neurons using connections with some coefficients. In this case, the greatest efficiency and speed can be achieved by paralleling calculations on high-performance computing clusters. However, in this case the bottleneck is the speed of memory access and data processing. The maximum performance of calculations can be achieved only in case if ANN is
completely hardware-implemented. In this case, the problem of memory access and mathematical operations over a large amount of data disappears, since each neuron corresponds to an analog nonlinear component, and each connection to a physical connection channel.

In recent years, there has been an exponential increase in work with hardware implementations of ANNs. Currently, the most effective ANNs are based on lasers [6], memristors [7], and spin-torque oscillators [8]. Connection between neurons in optical ANN implementations is based on the principles of holography [9], diffraction [10, 11], integrated networks of Mach-Zender modulators [12], wavelength division multiplexing [13], and 3D printed optical interconnects [14, 15, 16]. Recently, the so-called photonic neural networks are gaining popularity [17, 18].

The physical implementation of ANN fundamentally changes the features of noise influence. In the case of digital computer implementation of ANN, noise can enter the system exclusively with the input signal, whereas in analog ANN there are many internal sources of noise with different properties. The purpose of this paper is to study the peculiarities of internal noise propagation in recurrent ANN, to reveal ways to suppress such noises and to justify the stability of networks to some types of noises.

In our previous studies we were focused on the effects of additive and multiplicative, correlated and uncorrelated noise on deep neural networks [19, 20]. Several models of varying complexity were considered. General features depending on the nonlinear activation function and the depth of the ANN were shown for simplified symmetric ANNs with global uniform connectivity between layers. All the findings and results were then validated for three trained deep ANNs used for number recognition, classification of clothing images, and chaotic realization predictions. Using the analytical methods described in Ref. [20], several noise reduction strategies were proposed in our next study [21].

In this work, we make a task of noise study more complicated by considering time-dependency. In contrast to previously considered deep neural networks, here we are focused on recurrent neural network on the example of echo state neural network (ESN). This network consists of three main parts: 1- input layer receiving the input signal and transmitting it to the next layer; 2 - one layer called reservoir which state depends on both input signal at current moment and previous states of reservoir at previous times; 3 - output layer making the final output signal. Such networks are often used to work with signals that are highly dependent on time. For example, prediction of chaotic temporal realizations, speech recognition, etc.

## 2 System under study

### Noise types

In this paper we consider only white Gaussian noise with zero mean and some constant dispersion \(D\). The noise values will be different for each neuron each time, so it is uncorrelated in time and in network. Mathematically speaking it is introduced into each artificial neuron according to the noise operator \(\mathbf{\hat{N}}\) as

\[y_{i}(t)=\mathbf{\hat{N}}x_{i}(t)=x_{i}(t)\cdot(1+\xi_{M}(t,i)+\xi_{A}(t,i), \tag{1}\]

where \(x_{i}\) and \(y_{i}\) are noise-free and noisy outputs of the \(i\)th artificial neuron, respectively. \(\xi\) are the sources of white Gaussian noise with zero mean. The indices 'A' and 'M'
points out the noise types, namely additive (A) and multiplicative (M) noise with noise dispersions \(D_{A}\) and \(D_{M}\). As can be seen from (1), the additive noise is added to the noise-free output, while the multiplicative noise is multiplied on it. The part \((1+\ldots)\) is needed to keep the useful signal. The notation of noise operator \(\mathbf{\hat{N}}\) will be used further to indicate which outputs of neurons become noisy.

The noise dispersions will be fixed throughout the paper as \(D_{A}=D_{M}=10^{-2}\). This order of values corresponds to what we have previously obtained in an RNN realized in optical experiment [6, 19].

### Recurrent neural network

There are many different types of neural networks. Their topology and type of neurons strongly depend on a signal type and features of the tasks being solved. If the network is trained to work with signals changing in time, such as speech recognition, prediction of chaotic phenomena etc., then the neural network must have a property of memory. Here come to the aid of recurrent neural networks (RNNs). In RNNs, the part of neurons have the memory about their previous states. In this paper we consider an echo-state network (ESN) schematically shown in Fig. 1 as an examples of RNN. This network contains input and output neurons (orange) and a hidden layer with multiple neurons called reservoir (gray). The connectivity and weights of neurons inside the reservoir \(\mathbf{W}^{\text{res}}\) are usually fixed and randomly assigned. The output connection matrix \(\mathbf{W}^{\text{out}}\) is varied during training process to make the network producing correct responses to certain input signals.

In this paper we are mainly interested in the impact of noise on reservoir part of the network, and therefore, only gray neurons have a noise influence.

In accordance with notations in Fig. 1, the input signal \(x^{\text{in}}\) passes thought the input neuron and comes to reservoir neurons coupled via the input matrix \(\mathbf{W}^{\text{in}}\) of size \((1\times N)\), where \(N\) is the number of neurons inside reservoir. It is fixed throughout the paper as \(N=100\). The reservoir neurons have the connection to their previous states via connection matrix \(\mathbf{W}^{\text{res}}\) of size \((N\times N)\). Thus, the equation of reservoir neurons is

\[\mathbf{x}^{\text{res}}_{t}=f(\beta x^{\text{in}}_{t}\cdot\mathbf{W}^{\text{ in}}+\gamma\mathbf{y}^{\text{res}}_{t-1}\cdot\mathbf{W}^{\text{res}}); \hskip 28.452756pt\mathbf{y}^{\text{res}}_{t}=\mathbf{\hat{N}}\mathbf{x}^{ \text{res}}_{t}, \tag{2}\]

where \(f(\cdot)\) is the activation function of reservoir neurons. The type of activation

Figure 1: Schematic representation of considered recurrent neural network.
function often depends on the current task. In this paper we are mainly focused on linear activation function \(f(x)=\alpha x\), since linear and partly linear functions are often used in RNNs. The nonlinear activation function can lead to completely different dynamics and noise accumulation, and it will be therefore a subject of another study.

The index \(t\) corresponds to the current time moment, while \((t-1)\) in the term \(\mathbf{y}^{\mathrm{res}}\) indicates that the outputs of reservoir neurons are taken from the previous time moment. The bold font used for \(\mathbf{y}^{\mathrm{res}}_{t}\) and \(\mathbf{y}^{\mathrm{res}}_{t}\) indicates that they are row-vectors \((1\times N)\).

Parameters \(\beta\) and \(\gamma\) control the impact of input signal (\(\beta\)) and memory (\(\gamma\)). In order to keep the same range of the output signals, the condition \(\beta+\gamma=1\) is imposed on them.

The output of the network comes from the output neuron connected with reservoir via connection matrix \(\mathbf{W}^{\mathrm{out}}\) of size (\(N\times 1\)):

\[x^{\mathrm{out}}=\mathbf{y}^{\mathrm{res}}_{t}\cdot\mathbf{W}^{\mathrm{out}}. \tag{3}\]

In order to see the pure impact and statistics of noise, the output connection matrix \(\mathbf{W}^{\mathrm{out}}\) is fixed and uniform with elements \(1/N\). The input connection matrix \(\mathbf{W}^{\mathrm{in}}\) is responsible for sending an input signal to the reservoir. That is why its values are set to be unity.

## 3 One noisy neuron

As a first step let us consider how noise impacts on one isolated neuron with linear activation function. The neuron receives the input signal \(x^{\mathrm{in}}_{t}\) and produces the noise-free signal \(x^{\mathrm{out}}_{t}=f(x^{\mathrm{in}}_{t})\) becoming \(y^{\mathrm{out}}_{t}=\hat{\mathbf{N}}x^{\mathrm{out}}_{t}\) after the noise influence. The input signal contains \(T=200\) random values from \(-1\) to \(1\).

Figure 2 shows the impact of additive (green), multiplicative (orange) and mixed (blue) noise.

In order to see the noise impact we will use the next two characteristics. The first one is a dispersion showing the dispersion of the output signal. It is calculated in the next way. Each input signal \(x^{\mathrm{in}}_{t}\) is repeated \(K=1000\) times to get the statistics of output values. Then the obtained sequence of noisy output values is averaged to get the corresponding mean value \(\mu(y^{\mathrm{out}}_{t})\) and dispersion \(\sigma^{2}(y^{\mathrm{out}}_{t})\). The dispersion for different noise types is given in Fig. 2a.

The second characteristics is a signal-to-noise ratio (SNR) showing the relation between the mean output value and its variance or dispersion. In our previous papers [19, 20] we calculated the characteristics similar to SNR, as working for only positive input and output values. Now we will consider both positive and negative values and use therefore more common form of SNR calculated as \(\mathrm{SNR}[y^{\mathrm{out}}]=\mu[y^{\mathrm{out}}]/\sigma^{2}[y^{\mathrm{ out}}]\) (see Ref. [22]). The SNR for different noise types is given in Fig. 2b.

As can be seen from Fig. 2a, the additive noise (green points) lead to the constant level of dispersion which does not depend on the input and output signal. The corresponding dispersion can be found as the variance of a random signal:

\[\sigma^{2}[y^{\mathrm{out}}_{t}]=\mathrm{Var}[y^{\mathrm{out}}_{t}]=\mathrm{ Var}[f(x^{\mathrm{in}}_{t})+\xi_{A}]=\mathrm{Var}[\xi_{A}]=D_{A}. \tag{4}\]

In the case of multiplicative noise, the variance becomes completely different (orange). There is a quadratic relationship between mean output value and its variance. In terms
of expectation value and variance, the variance of the output signal of one neuron with multiplicative noise can be found as follows

\[\mathrm{Var}[y_{t}^{\mathrm{out}}]=\mathrm{Var}[f(x_{t}^{\mathrm{in}})\cdot(1+ \xi_{M})]=(\mathrm{E}[f(x_{t}^{\mathrm{in}})])^{2}\cdot\mathrm{Var}[\xi_{A}]=D_{ A}\cdot(\mathrm{E}[y_{t}^{\mathrm{out}}])^{2}, \tag{5}\]

where \(\mathrm{E}[\cdot]\) is the expectation value. The expectation value of the output signal is \(\mathrm{E}[y_{t}^{\mathrm{out}}]=\mathrm{E}[x_{t}^{\mathrm{out}}]=\mathrm{E}[ f(x_{t}^{\mathrm{in}})]\).

In the case of linear activation function the dispersion strongly depends on the parameter \(\alpha\):

\[\sigma^{2}[y_{t}^{\mathrm{out}}]=\mathrm{Var}[y_{t}^{\mathrm{out}}]=\mathrm{ Var}[f(x_{t}^{\mathrm{in}})\cdot(1+\xi_{M})]=D_{A}(\alpha x_{t}^{\mathrm{in}})^{2}. \tag{6}\]

Mixed noise (blue points in Fig. 2) combines features of both additive and multiplicative noise. Thus, the dispersion (panel a) is the sum of additive and multiplicative variances. For this reason, the SNR in the case of mixed noise with \(D_{A}=D_{M}\) is reduced twice (panel b).

The impact of \(\alpha\)-parameter on SNR and dispersion is shown in Fig. 3. It confirms Eqs. (4,6). The input signal and \(\alpha\) does not change the dispersion in case of additive noise (Fig. 3a) and SNR in case of multiplicative noise (Fig. 3e). The parameter \(\alpha\) has no impact on SNR with additive noise (Fig. 3d), while both \(\alpha\) and input signal change the dispersion in case of multiplicative noise (Fig. 3b).

## 4 ESN with uniform connection matrix

In this section, we will focus on the interplay of input signal and memory. In order to see pure noise accumulation without the impact of connectivity matrices, we consider the uniform connection matrix in reservoir: \(W_{ij}^{\mathrm{res}}=1/N\).

Figure 2: Dispersion \(\sigma^{2}\) (panel a) and SNR (panel b) calculated for the output of one noisy neuron with only additive noise (green points), only multiplicative noise (orange) and mixed noise (blue) depending on corresponding mean output value. The dispersion of noise sources are \(D_{A}=D_{M}=10^{-2}\). The neuron has linear activation function with \(\alpha=1\).
As a first step, we set \(\gamma=0\), when the reservoir has no memory, and the state of reservoir depends only on the input signal. According to Sect. 2.2, if \(\gamma=0\), then \(\beta=1\).

If the property of memory is turned off, then how the input signal depends on time is irrelevant. Therefore, we use the same random input signal from -1 to 1 as in the previous section.

Figure 4a shows the dispersions calculated by the output signal of ESN with \(\gamma=0\) for additive (green) and multiplicative (orange) noise. The general view of these dependencies is the same as was for one noisy neuron. The difference is the range of these values. Comparing Figs. 2a and 4a, the dispersion of ESN's output is reduced by a factor of 100. Thus, the final output signal becomes less noisy.

This can be explained as follows. We introduce the noise only to neurons of the reservoir. In the case of only additive noise their dispersion can be calculated according Eq. (4). If \(\gamma=0\), then the output signal can be calculated as \(x_{t}^{\rm out}=\frac{1}{N}\sum\limits_{j=1}^{N}x_{t,j}^{\rm res}\). Then the output dispersion and variance for additive noise is

\[{\rm Var}[x_{t}^{\rm out}]=\Big{(}\frac{1}{N}\Big{)}^{2}\sum\limits_{j=1}^{N} {\rm Var}[\alpha x_{t}^{\rm in}+\xi_{A}(j,t)]=\Big{(}\frac{1}{N}\Big{)}^{2}\sum \limits_{j=1}^{N}{\rm Var}[\xi_{A}(j,t)]=\frac{1}{N}{\rm Var}[\xi_{A}]=\frac{D _{A}}{N}. \tag{7}\]

Comparing this equation with (4), the variance is reduced by the factor of \(N=100\)

Figure 3: Dispersion (panels a–c) and SNR (panels d–f) calculated for the output of one noisy neuron with only additive noise (a,d), only multiplicative noise (b,e) and mixed noise (c,f) depending on input value \(x^{\rm in}\) and parameter \(\alpha\). The dispersion of noise sources are \(D_{A}=D_{M}=10^{-2}\).
Therefore the dispersion level is reduced from \(10^{-2}\) in one neuron to \(10^{-4}\) in ESN.

Now we turn on the property of memory making \(\gamma=\beta=0.5\). Then sequence of input signal becomes important. To keep the same range of signal and include the property of growing and decreasing input signal, we will use sine function as an input (Fig. 4e). Figure 4b shows the dispersions for this case. From that moment on we will plot these characteristics depending on the time \(t\) to underline the peculiarities of the input signal. Comparing scales of dispersion in panels a and b, one can see that dispersion grows with increasing \(\gamma\), as now the noise is accumulated in reservoir.

The another one thing that should be pointed out is the view of these dependencies. Comparing Fig. 4a and 4c, there may be an erroneous opinion that now the general form of dependencies has changed a lot. However, it is not so. IF we change the dependence on time in panels (c,d) to the dependence on the mean output value as before, then the general view will be exactly the same as in Fig. 4a,b.

Figure 4: Dispersion (a,b) calculated for the output of ESN with \(\gamma=0\) (left panels) and \(\gamma=0.5\) (right panels). The input signal (c) was used when \(\gamma\neq 0\). Parameters: \(\alpha=1\), \(\beta=1-\gamma\), \(D_{A}=D_{M}=10^{-2}\).
If \(\gamma\) grows further up to \(0.9\), the maximal dispersion level will be increased to \(\approx 5\cdot 10^{-4}\). The general view of dispersion dependencies remains the same as it is shown in Fig. 4b. In the case of additive noise the dispersion dependency is almost constant, while this dependency for multiplicative noise looks like a doubled sine function and covers a range from zero to some maximal level depending on \(\gamma\). In order to reveal the impact of parameter \(\gamma\), Fig. 5 shows how mean dispersion level for additive noise and dispersion range for multiplicative noise changes depending on the parameter \(\gamma\).

A uniform reservoir connection matrix \(\mathbf{W}^{\mathrm{res}}\) may look like a rather degenerate case. However, this matrix is sometimes set randomly and does not change during the training process. According to our previous studies [20], in terms of network noise accumulation, a similar uniform connectivity can be interpreted as a matrix with random values and a mean value of \(1/N\). Thus, the conclusion "the smallest level of dispersion in this case can be obtained with weak memory of reservoir and then grows exponentially with parameter \(\gamma\) responsible for memory property" also holds for uniform random \(\mathbf{W}^{\mathrm{res}}\).

## 5 ESN with diagonal-like connection matrix

As it has been mentioned in previous section, the reservoir connection matrix \(\mathbf{W}^{\mathrm{res}}\) can be set without change during training process. Usually, it is set to be uniform or diagonal-like [23]. In this section we consider the last type of the network. Figure 6a,d shows the diagonal matrices which we will use in reservoir. Both networks are set with some _blurring_ coefficient \(\zeta\). We set this "blurring" effect using Gaussian function. For example, in Fig. 6a this coefficient is set \(\zeta=2\) meaning that main diagonal and two terms from the left and right sides of the main diagonal are set according Gaussian function, while the rest are set to be zero. In order to keep the same range of values, we need to make the sum of the elements in each row and column of the matrix \(\mathbf{W}^{\mathrm{res}}\)

Figure 5: Mean dispersion level (dashed line) for additive noise and dispersion range for multiplicative noise depending on parameter \(\gamma\). Other parameters: \(\alpha=1\), \(\beta=1-\gamma\), \(D_{A}=D_{M}=10^{-2}\).
equal to one, as before. Therefore, the non-zero elements of this matrix are set in the next way:

\[W_{k,i}^{\rm res}=\frac{e^{-(k/\zeta^{2})}}{\sum\limits_{j=-\zeta}^{\zeta}e^{-(j/ \zeta^{2})}},\ \ \ \ k\in[i-\zeta;i+\zeta]. \tag{8}\]

In this section we will consider two diagonal-like matrices \(\mathbf{W}^{\rm res}\) with two "blurring" coefficients \(\zeta=2\) (Fig. 6a) and \(\zeta=20\) (Fig. 6d).

Figures 6b,e show the dispersion of the output signal for reservoir connection matrices with \(\zeta=2\) and \(\zeta=20\) given in corresponding left panels and parameter \(\gamma=0.8\). There is a clear difference between dispersion in case of diagonal matrices and dispersion obtained for uniform matrices (Fig. 4b). The form of \(\sigma^{2}\)-dependencies for additive and multiplicative noise remains almost the same, but there is a clear quantitative difference. In the case of uniform connection matrix and diagonal matrix with small \(\zeta\) (Fig. 6b) the maximal value of dispersion for multiplicative noise coincided with its

Figure 6: Dispersion of the output signal of ESN with diagonal matrices \(\mathbf{W}^{\rm res}\). Panels a and d show the connection matrices with \(\zeta=2\) and \(\zeta=20\), respectively. Panel b shows the dispersion for additive (green) and multiplicative (orange) noise in the case of \(\zeta=2\). Panel c shows how this dispersion changes depending on \(\gamma\). Panels d,e are the same but for \(\zeta=20\). Other fixed parameters: \(\alpha=1\), \(\gamma=0.8\), \(\beta=1-\gamma\), \(D_{A}=D_{M}=10^{-2}\).
mean value for additive noise. These dependencies are moving away form each other faster for diagonal matrix (Fig. 6c) comparing with uniform matrix (Fig. 5).

These dependencies drift apart faster with larger "blurring" coefficient \(\zeta=20\) (see Figs. 6e,f).

Comparing the impact of additive noise in Figs. 5 and 6c, one can see that dispersions for additive and multiplicative noise depending on \(\gamma\) are very similar for diagonal matrix with small "blurring" coefficient (Fig. 6c) and uniform connection matrix (Fig. 5). Moreover, the noise is accumulated less for large "blurring" coefficient \(\zeta\) (Fig. 6f). In the case of large \(\gamma\) the final dispersion level becomes less with growing \(\zeta\). This difference is more clear for multiplicative noise. Comparing dispersion ranges in panels c and f of Fig. 6, one can see that multiplicative dispersion level for large \(\zeta=20\) is much less than for small \(\zeta=2\).

## Conclusion and discussion

In this paper we have studied the impact of uncorrelated additive and multiplicative noise on echo state neural network. The noise was added only to neurons inside the reservoir. These neurons had linear activation function. To analyse the output level of noise we mainly used a dispersion and a signal-to-noise ratio derived from it.

The parameter \(\alpha\) controlling the slope of activation function has no impact on accumulation of additive noise. At the same time, the dispersion for multiplicative noise has a quadratic dependency on \(\alpha\) and input signal. The dispersion can be predicted analytically by Eqs. 4-6. In our next studies we plan to consider other types of activation functions such as sigmoid functions and piecewise linear activation function.

ESNs are usually set with random uniform reservoir connection matrix or diagonal-like matrix, which are not changed during training process. Therefore, in this paper we considered both types of connection matrices and study the impact of memory on accumulation of noise. We have found some interesting results for these matrices. The noise is less accumulated in ESN with diagonal reservoir connection matrix \(\mathbf{W}^{\mathrm{res}}\) with large "blurring" coefficient. Especially it concerns uncorrelated multiplicative noise. The accumulation of noise in uniform \(\mathbf{W}^{\mathrm{res}}\) is almost the same as in diagonal \(\mathbf{W}^{\mathrm{res}}\) with small "blurring" coefficient.

## Acknowledgements

This work was supported by the Russian Science Foundation (Project no. 21-72-00002).
