1. Introduction
Despite their remarkable success in various tasks, neural networks (NNs) can sometimes behave in unexpectedly fragile ways, particularly in image recognition. One well-known problem is the existence of
adversarial examples, where even small, carefully crafted perturbations to the input can lead to incorrect outputs [
1,
2]. While adversarial examples highlight an important class of vulnerabilities, they are not the only cause of unreliability. Such behaviors are not merely the result of noisy inputs or training data limitations but may reflect deeper issues rooted in the architecture of the neural networks. In this work, we take a different perspective to examine a structural property of neural networks, namely their
null space, as a potential source of fragility.
Many existing studies attribute the vulnerability of neural networks to input-level manipulations. In 2014, Szegedy et al. [
3] first discovered an intriguing weakness of deep neural networks. They showed that neural networks for image classification can be easily fooled by small perturbations. Following this observation, numerous studies have been carried out to find different ways to generate adversarial examples (see, for example, [
2,
4,
5,
6]). It is observed that adversarial examples have good transferability across models, which suggests that the existence of adversarial examples is also a property of data sets [
7]. Thus, adversarial examples are not restricted to the given model.
Unlike the adversarial examples, our study focuses on a structural property of neural networks: the null space of neural networks. The null space is a well-established concept in linear algebra, but its connection to neural networks may not be obvious. If one were to consider a standard neural network from the perspective of a mathematician, the input can be considered a vector, generally in a high-dimensional space. Considering
Figure 1, each entry
in the input vector
is placed in an open circle in the input layer. If we ignore for the moment the unitary node indicated by the 1 at the bottom of the first layer, the weights
are multiplied by the entries in the input vector to produce the intermediate values
, where
at the nodes in the middle layer. Hence, the mathematical structure is basically a matrix multiplication of a weight matrix
W times the input vector
, so the presence of a null space associated with the weight matrix is very possible. Further, in the case of an NN, the known information is in the input vector and the weight matrix is to be determined via the training process. Note that the number of degrees of freedom in
W is much greater than the dimension of the input vector; thus the training process can lead to underdetermined systems and high-dimensional null spaces.
In the simplest examples of NNs, the transformation from one layer to the next may be a linear transformation, but a bias term, as indicated by the unitary node labeled 1 at the bottom of the input layer, is usually introduced, which then converts the transformations into affine transformations. The affine form will introduce some complications, and this paper will explore the impact of this on the null space characteristics of the linear transformation component of NNs. When all of the layers are considered, along with the activation functions, we say that we have a fully connected neural network (FCNN) with
nodes in the first layer,
nodes in the second layer, and so on. This FCNN is also referred to as an
-FCNN. Finally, it should be mentioned that a nonlinear activation function is usually applied to the data in an intermediate layer, such as a sigmoid function or ReLU function, but these functions can be thought of as a compressing or compactifying function that diminishes the impact of outlier results or, in the case of ReLU, negative-valued intermediate results. While these nonlinear activation functions can obfuscate the impact of the null space effects, this paper will separate out the stages to show that the null space properties, extended to consider the nonlinear effects, can be used to fool the NN and cause it to give unexpected classification results. A detailed analysis will be given in
Section 2.
As a primary goal, we discuss how the null space of a neural network affects classification outcomes, revealing it to be a critical factor that may inherently limit a model’s ability to make reliable predictions. The approach takes advantage of the (nonlinear) null space properties of the neural network and generates examples to fool the neural network by adding a large difference to images without changing the predictions. More importantly, to the naked eye, the large differences will look like completely different objects than those that will be recognized by the neural network, achieved via image steganography. Considered from a broader perspective, only a few studies have analyzed the null space properties of neural network functions. Cook et al. [
8] integrated the null space analysis on weight matrices with the loss function to detect out-of-distribution inputs rather than analyzing the reliability of NN predictions. Rezaei et al. [
9] used the null space of the last layer weight matrix to quantify overfitting. Beyond these, some studies have investigated the null space structure of the parameter space. Sonoda et al. [
10] showed that the parameter spaces of overparameterized NNs inherently contain null components that do not affect training loss but may impact generalization. In addition, a few studies have worked on the null space associated with the input data itself [
11,
12,
13].
However, there is still a lack of understanding regarding the global effects of null space properties for NNs. In this study, inspired by the null space of linear maps, we introduce the concept of a null space for nonlinear maps and discuss how the null space applies to fully connected neural networks (FCNNs). We show how the null space is generally an intrinsic property of NNs. Further, in most cases, once the NN’s architecture is determined, the dimension of the null space of the NN is also determined. To illustrate this in concrete terms, we use null space-based methods to fool an image recognition NN, demonstrating an application of image steganography.
Image steganography is a technique to hide an image inside another image [
14,
15]. Traditional image steganography methods can be categorized into two main types: methods operating in the spatial domain [
16] and the transform domain [
17]. Among methods operating in the transform domain, discrete orthogonal moment transforms have been widely used in image analysis and image steganography [
18,
19,
20,
21,
22]. In addition to traditional steganography methods, approaches based on NNs have also been employed for image steganography, using several different approaches [
23,
24,
25,
26,
27,
28,
29,
30,
31]. In this paper, inspired by the null space analysis of NNs, we propose a null space-based method for image steganography. Our approach shares some similarity with discrete orthogonal moment-based steganography, as both methods decompose images with respect to a chosen basis. However, while moment methods rely on polynomial bases (e.g., Tchebichef, Krawtchouk), our method employs basis vectors from the null space of a neural network. In addition, although conceptually related to other steganographic methods, the null space-based method presented in this paper provides new degrees of freedom and a clear process for creating steganographic images for NNs. The main goal is to hide an image and recognize the correct class of the hidden image while presenting to the (human) viewer an image that is completely different to the hidden image that will be recognized by the NN.
In summary, the main contributions of this paper are as follows:
We introduce a novel perspective on NN reliability by analyzing the role of the null space structure for the NN and showing that its dimension is architecture-dependent.
We propose a null space-based steganographic method that generates visually different images while hiding images that are recognized with high certainty by the model.
The rest of this paper is organized as follows:
Section 2 introduces the (nonlinear) null space of NNs. Inspired by null space analysis, an image steganography method based on the null space of FCNNs is introduced in
Section 3.
Section 4 presents a series of experiments on different image data sets. In
Section 5, we offer some discussion and conclusions about the advantages and limitations of the null space method and the differences between the null space image steganography method and adversarial examples. Additionally, more examples are presented to emphasize that what the NN is seeing and using to make classification decisions is not what we humans might perceive it to be seeing.
2. Methodology and Theory
In this section, we introduce the null space of nonlinear maps and discuss the null space of neural networks (NNs). In order to keep the flow of ideas consistent, detailed proofs will be placed in the appendix.
2.1. Null Space of Linear and Nonlinear Maps
In linear algebra, the null space of an matrix A is and is a subspace of . Consider a linear map with nontrivial. By the definition of a null space, it is not difficult to see that for any and , . That is, adding any vector in to any input will not change the output since the transformation is a linear map.
In most cases, null space in nonlinear maps is not defined as described above. The set for a nonlinear map is not a subspace of . Moreover, the property of linearity does not hold for the nonlinear map f. Although we can still find the set , the property is no longer true for all . To preserve this useful property, the concept of null space can be adapted to nonlinear maps by identifying a set of vectors that satisfy the condition for any :
Definition 1 (Null space of a nonlinear map).
The null space of a nonlinear map , denoted as , is the set of all vectors in which, by adding these vectors to any input, the image under the map, or output, will not change: When this definition is applied to linear maps, it is equivalent to the null space concept in linear algebra. However, for the purposes of this paper, we will use the term “null space” in a broader sense, extending its application to include affine maps, nonlinear maps, etc. Similarly to the null space in linear algebra,
is a subspace of
(Proposition A1). Furthermore, as demonstrated in Proposition A2, all the vectors in
are mapped to a single point by
f. More specifically, for any
. Further properties about null spaces of nonlinear maps are provided in
Appendix B. One difference between null spaces of linear and nonlinear maps is that a nonlinear map will not always map null space vectors to zeros.
The definition of the null space for nonlinear maps is straightforward. However, in practice, it is difficult to find a null space explicitly by following this definition. Next, we will introduce an alternative yet equivalent definition for the null space of nonlinear maps, which provides a more accessible way with which to find the null space of a nonlinear map.
To begin with, given a nonlinear map , let us consider the subspaces of . Suppose f has a decomposition; then, f can be expressed as the composition of two functions and is linear. It follows that is a subspace of . This is straightforward to see, since for any , holds for every , and so . Therefore, we now have a method to find a subspace of . Hence, we define a partial null space as follows:
Definition 2 (Partial null space of a map). Given a nonlinear map, . If f has a decomposition , where is a linear map, then the null space of is defined as a partial null space of f (given by ). We denote it as .
Then, the question of how to find the null space with partial null spaces and the decomposition of maps remains. In the following lemmas, we present some results regarding partial null spaces and the null space of a nonlinear map. Detailed proofs are provided in
Appendix B.
Lemma 1. Let be a nonlinear map. Every partial null space is a subspace of , .
Lemma 2. For every nonlinear map , there exists a decomposition , where is a linear map such that , i.e., the partial null space given by is equal to .
Note that is not always true for any arbitrary decomposition . In the following corollary, we further discuss the conditions under which this equation holds.
Corollary 1. Let be a nonlinear map. The null space of f is the largest partial null space of f. That is, if , is a linear map, and has the largest dimension among all decompositions of f.
Directly from Lemmas 1 and 2, Corollary 1 gives an equivalent definition of
in terms of its partial null space. Consequently, instead of searching for all possible vectors that satisfy Equation (
1), we have turned the null space problem into a problem of finding a decomposition of
f that yields the largest partial null space.
2.2. Null Space of Fully Connected Neural Networks
Consider a fully connected neural network , where denotes the number of hidden layers of f, with representing widths of the hidden layers, i.e., the number of nodes in each hidden layer. are the input and output dimensions, respectively. f is called a layer fully connected neural network (FCNN). In this paper, we refer to this FCNN architecture as a FCNN.
As shown in
Figure 2, assume the input values are
and the activation functions are denoted by
; then the output of the
kth neuron in the
jth layer is given by
and the outputs of the
jth layer can be written in a compact matrix form
The function represented by this neural network is
Define a sequence of linear and affine transformations as
for
, respectively. The function of FCNN
f can also be represented by a composition of maps:
Common activation functions include sigmoid activation function and Rectified Linear Unit (ReLU). We refer to the -FCNN with ReLU activation as a -ReLU NN.
According to Corollary 1, we can conduct null space analysis on FCNNs using the composite function form (Equation (
2)). An FCNN can be naturally decomposed into two parts,
and
, where
is linear. Thus,
is a partial null space of FCNN
f which, in most cases, is also the null space
.
As will be shown in
Section 3, input images can be decomposed into null space and non-null space components, which can be used to fool the neural networks in an image steganography application.
2.3. Null Space of Convolutional Neural Networks
Similarly, a convolutional neural network (CNN) can also be represented by the composition of maps. Instead of having only affine transformations and activation functions, the early layers of a CNN allow two additional types of computation: convolution, denoted as C, and pooling, denoted as S. To determine the null space of a CNN f, we can first decompose f into the composition of maps . So, in most cases, the first convolution operation C is the maximum linear map of f, and .
The null space of a CNN is significantly more complex than an FCNN. In this paper, we will only give an overview of the null space analysis for CNN in a simple case. Consider the case when the input image of a CNN only has one channel, for example the grayscale number images in the MNIST data set (a color image typically has three channels).
A typical convolutional layer in a CNN comprises multiple kernels. To find the null space of the entire convolutional layer
, we can initially determine the null space of a single kernel
corresponding to one convolution operation. As shown in
Appendix C, given one kernel, if the convolution operation keeps the output image with the same dimensions as the input image (same padding), then
in most cases. If the output image of the first convolution operation has fewer dimensions than the input image (valid padding),
can be nontrivial. According to Lemma A1, in most cases, the null space of a given kernel has a dimension that is equal to the difference between the dimensions of the input and output image. For example, given a
image and a
kernel, the dimension of the null space of this convolution operation is
in most cases.
Assume that the first convolutional layer C has n kernels ; then . For instance, if the input is a image and the first convolutional layer has six kernels, then the null space of the CNN is the intersection of six dimensional subspaces of . The likelihood of there being a non-trivial intersection between 109-dimensional subspaces of a 784-dimensional space is low, but care must be taken when designing the kernels.
Compared to FCNNs, CNNs can achieve a trivial null space with fewer unknown parameters in the first weight matrix and perhaps greater robustness.
3. Photo Steganography Based on the Null Space of a Neural Network
In considering the task of hiding secret information inside another image, a natural idea emerges from our previous discussions on the null space properties of FCNNs. To this end, in this section we propose a method for creating steganographic images, referred to as “stego images”, to fool FCNNs and pass on secret classification information.
In terms of a pre-trained FCNN
f, for any input image
X, the FCNN
f gives a decomposition,
where
is the projection of
X onto the null space of
f and
is the orthogonal complement that determines the prediction. Since
, the output depends solely on
; that is,
. This decomposition provides the idea for controlling the predicted label/classification independently of the image’s appearance.
Consider two images
H and
C:
H is the
hidden image which carries the secret label.
C is the
cover image which determines the visual appearance. Our goal is to pass a new image
S that visually looks like
C but secretly hides the classification information of
H, i.e., which is classified the same as the hidden image by
f. This can be achieved by decomposing both
H and
C with respect to the null space
: the null space projections, denoted by
and
, which lie in the null space and do not affect the prediction; and the orthogonal complements, denoted by
and
, which contribute to the output of
f. Importantly, this method does not involve retraining the network; instead, the null space
is computed directly from the first layer of a pre-trained neural network
f. By combining the null space projection of
C, denoted by
, with the prediction-relevant component of
H, denoted by
, we construct
so that
S appears similar to
C but satisfies
if the
f is trained on grayscale images to correctly classify the scaled inputs, such as
for
. The pseudocode of the proposed image steganography method is provided in
Appendix A.
Figure 3 provides a visualization of the whole process. We consider a data set
, where
are
grayscale images normalized to the range
and
are class labels. First, a fully connected ReLU network
f is trained on both the original images
and their rescaled versions
, where
, to create “headroom” for linear combinations. Then, the null space
is obtained by computing the singular value decomposition (SVD) of the first hidden layer weight matrix
and extracting the columns of
V associated with zero singular values, which form an orthonormal basis for the null space
. These columns form the matrix
. If
H and
C are column vectors in the form of neural network inputs, we compute
and
as follows:
where
and
give the coefficients (dot products) of
H and
C along the null space basis vectors, respectively. Multiplying by
reconstructs the projection within the null space. Thus,
is composed only of null space vectors, while
has all null space components removed. Finally, we construct the stego image
. Note that the resulting stego image
S must remain within the normalized range
, consistent with the range of the neural network inputs. This condition constrains the choice of
and
:
cannot be too large (otherwise some entries of
S may fall outside
) or too small (otherwise the hidden component becomes too weak to carry sufficient information from the hidden image). Also, guaranteeing the visual quality of the cover image requires
to be as large as possible.
In this example, the network classifies
S as the digit eight based on the hidden image
H while ignoring the visual features of the cover image
C. So, for the example in
Figure 3, the stego image looks like an “8”, but when presented to the NN, it is classified as a “6”.
In the next section, we will show experiments using the MNIST, Fashion-MNIST (FMNIST), and Extended MNIST (EMNIST) data sets. For simplification, we present experiment results using
. Other values of
may also be used as long as the stego image remains within the range
. Further discussion on the choice of parameters
and
can be found in
Appendix D.
4. Experimental Results
All experiments presented in this section were implemented in TensorFlow. The data sets used in these experiments include MNIST [
32], Fashion-MNIST [
33], Extended MNIST (EMNIST) [
34], and CIFAR-10 [
35].
4.1. Hide the Digits
In this section, we use the MNIST data set to conduct experiments in image steganography. For these experiments, we trained a (784, 32, 16, 10) − ReLU NN, i.e., the ReLU NN has images as the input vector in length, 32 nodes in the first hidden layer, 16 nodes in the second hidden layer, and 10 nodes in the output layer. The training was based on an expanded image training data set that included the original data set and the data set rescaled with , with a prediction accuracy of on the original training data. For the original training data correctly predicted, the average confidence level is . When evaluated on the rescaled training data, this ReLU NN maintained a high prediction accuracy of with an average confidence of on correctly predicted data. Expanding the data set to include the rescaled training data slightly reduced the training accuracy; the accuracy remains high and still provides a large pool of correctly classified images for constructing steganographic images. Notably, this ReLU NN has a 752-dimensional null space. This large null space plays a crucial role in the steganographic capabilities of the network.
We then filter out only the correctly predicted images to create a new data set. This data set comprises a total of 50,000 images, with each class having 5000 examples. The (784, 32, 16, 10) − ReLU NN can correctly predict both original and rescaled data from this new data set. The main purpose of this process is to ensure that for any chosen hidden image H from the new data set, feeding into the ReLU NN does not create scaling issues and yields a correct classification. Next, we will show some representative results with stego images produced by , where can be chosen in the range of and is generally set to around .
Figure 4 and
Figure 5 present stego images generated using the images from the new data set. For each set of three images, the first is the cover image, the second is the hidden image, and the third, the stego image, combines parts of the cover and the hidden image. Additionally,
Figure 4 annotates the combination weights
of stego images and the predictions and their corresponding confidence levels. In each case, the ReLU NN predicts the hidden digit with high confidence.
As shown in the figures, we can barely see the hidden digits in the stego images, which have patterns extremely similar to the cover images, even if the cover image is from another data set. However, these stego images are not predicted to be in the same classes as the cover images; rather, they are identified as the hidden images with high confidence. The cover image’s portion within the stego image falls entirely in the null space of the ReLU NN, giving the stego image a visible pattern that resembles the cover image (plus some noise-like structure) but makes no contribution to the prediction with the ReLU NN. On the other hand, the part of the hidden image included in the stego image appears as noise (as shown in
Figure 3), but it is this portion that carries the most important information for prediction with the ReLU NN.
4.2. Results on Other Data Sets
This proposed image steganography method is general and can be applied to any image data set. In addition to the MNIST data set, we also applied our method to other image data sets: FMNIST, EMNIST, and CIFAR-10.
For the FMNIST data set, we trained a
-ReLU NN with a 752-dimensional null space. To generate stego images, we first created a new data set comprising both the correctly predicted original and rescaled images (also scaled by a factor of 0.2). This new data set has an average confidence of
for the original images and
for the rescaled images. Examples of stego images created from the new data set are shown in
Figure 6 and
Figure 7.
Similarly, as expected, the stego images have the look of cover images (as seen in the first column) but are recognized as the same categories as their corresponding hidden images (shown in the second column) with high confidence.
To continue this investigation, we also perform experiments on the EMNIST Balanced data set (
Figure 8) and CIFAR-10 data set (
Figure 9), where the same technique works. The figures suggest that the null space-based image steganography method is also applicable to more complicated and colorful images. To guarantee the capability of concealing an image within any chosen cover image, we can train a neural network model with a sufficiently large null space. As observed in the experiments, when simple digit or letter images are used as cover images, their null space components
tend to preserve most of their visual information under projection, while more complex and colorful images, such as the images in the CIFAR-10 data set, may appear more “noisy” after being projected onto the null space, therefore requiring a larger null space to maintain visual fidelity.
4.3. Analysis of Reduced Confidence in Stego Images
While most stego images constructed by our method are classified the same as the hidden image with nearly 100% confidence, in a few cases, a reduced confidence is observed. In this regard, it is worthwhile to look at these outliers.
One such outlier result is shown in
Figure 6a. While the original hidden image
H is predicted to be a “shirt” with confidence close to 1, the stego image
is predicted to be a “shirt” with a lower confidence of
. The reduced confidence level is caused by the rescaled hidden image. According to the null space method, the prediction and confidence level for the stego image
S should align with those for
and, consequently,
. Consistent with this analysis, the rescaled hidden image
is also predicted to be “shirt” with 86.4% confidence. Therefore, the confidence drop reflects the effect of rescaling rather than a limitation of the null space method.
Unlike the experiment with the MNIST data set, it is more common to see lower confidence stego image examples in the experiment with the FMNIST data set. In
Figure 10, we compare the original hidden image
H and rescaled hidden image
in
Figure 6a. For the rescaled image
, the NN gave a reduced confidence of
for the correct prediction of “shirt”, but it also predicted the related category of “T-shirt/Top” with a confidence of
. As shown in
Figure 10, the rescaling operation reduces contrast and leads to the loss of some visual details, which causes lower confidence. For instance, the buttons and collar cannot be clearly observed in the rescaled image, so it is also more likely to be identified as a “T-shirt/Top”.
Therefore, the achievement of high confidence in steganographic images depends on having “good” hidden images with high confidence on both original and rescaled data. Essentially, the prediction confidence level of the hidden images will be no better than the prediction confidence of the original images after rescaling has been applied.