# How sensitive are feedforward Neural Network to weight changes?

Let's consider the space of feedforward neural networks with a given structure: $$L$$ layers, $$m$$ neurons per layer, ReLu activation, input dimension $$d$$, output dimension $$k$$.

Which means I'm considering the map $$F: \mathcal{W}_1 \times \mathcal{W}_2 \times \dots \times \mathcal{W}_L \times \mathbb{R}^d \to \mathbb{R}^k$$, where $$\mathcal{W}_i$$ is the space of possible weights for layer $$i$$. We also assume, for simplicity, that every weight matrix has a norm upper bounded by a constant $$M$$. Let's now assume that I have fixed parameters so that we obtain $$v = F(W_1, \dots, W_L, x^*) \in \mathbb{R}^k$$ (note that $$x^*$$ is fixed as well).

Now imagine that I inject some random noise $$\eta \in \mathbb{R}^{m \times m}$$ in a weight matrix $$W_i$$, where the norm of the noise is 10% of the norm of the matrix, e.g. $$||\eta|| = ||W_i||/10$$ . How does it affect my final output?

which means, what's the expected value of $$||v - v_*||$$, where $$v_*$$ is the output of the network obtained after the small changes in the weights described before?

Note that this has nothing to do with the learning process, it's just about the sensitivity/resistance of a neural network with respect to random noise injected in a weight matrix.

you are asking for the condition I would say. If you skim through the formulae, the german explanation is more detailed.

In particular, the absolute condition at $$x$$ is defined as $$\kappa_{\text{abs}}:= \lim \sup _{\tilde{x} \rightarrow x} \frac{||f(x) - f(\tilde{x})||}{||x - \tilde{x}||}$$, which means $$\kappa_{\text{abs}} \geq 0$$ is the smallest number such that there is a $$\delta >0$$ so that all $$\tilde{x}$$ with $$||\tilde{x}-x|| < \delta$$ it holds that $$|| f(\tilde{x})-f(x) || \leq \kappa_\text{abs} || \tilde{x} - x ||.$$

The relative condition $$\kappa_{\text{rel}} \geq 0$$ at $$x$$ is the smallest number such that there is a $$\delta > 0$$ so that all $$\tilde{x}$$ with $$||\tilde{x}-x|| < \delta$$ satisfy: $$\frac{|| f(\tilde x)-f(x) ||}{||f(x)||} \leq \kappa_\text{rel} \frac{|| \tilde{x} - x ||}{||x||}.$$

The difference is thus, that the $$\kappa_{\text{rel}}$$ compares the relative change of the output with the relative change of the input.

In general, let $$\tilde{f}$$ denote an approximation of the real function $$f$$, $$\tilde{x}$$ the input with some noise, then there are 4 categories in numerics:

• condition: Analyze $$||f(x)-f(\tilde{x})||$$
• stability: Analyze $$||\tilde{f}(x)-\tilde{f}(\tilde{x})||$$
• consistence: Analyze $$||\tilde{f}(x)-f(x)||$$
• convergence: Analyze $$||\tilde{f}(\tilde{x})-f(x)||$$.

Your question is also related to adverserial attacks. You can have a look into the literature.

Note also that $$\kappa_{\text{rel}} = \frac{||Df(x)||||x||}{||f(x)||}$$, so that you could compute the condition number for any given neural network.

Its very hard to determine how exactly it would affect the learning of the network but from my experience, these are the possible scenarios. on how it can affect the output:

1. It might take your network a longer time to converge
2. Your network might never really reach the accuracy values as seen before adding the noise.
3. Certain weights can be dropped during learning or made to 0 when using a regularizer.

I am not quite aware if the affect on the output can be really modeled by a mathematical equation when a certain type of noise is added, if that is what you are looking for.

• I'm not talking about the learning process, I'm assuming that the parameters of the neural network are fixed. I'm looking at the NN as a mathematical function which takes as an input points in a $d$-dimensional vector space and outputs points in a $k$ dimensional one. Now, once I have this function, which has fixed parameters, I add the noise mentioned above. My question is how this noise affects the output of the function. I'll edit because I think I wasn't clear enough Jan 13, 2019 at 19:49
• IMO, the function will not change, just the parameters will be tuned to either learn the noise or learn to ignore the noise based on regularization methods used. Neural network as a function is not modeled around the dataset but on the problem the network needs to solve. Jan 14, 2019 at 15:10
• @NischalHp The OP is imagining an already tuned neural network (for whatever task or no task at all). The question is then what happens if we alter the network weights by randomly perturbing them a small amount? How similar are the outputs of this new network and the original network? Training and regularization are irrelevant here. Aug 16, 2020 at 22:11