NASCTY: Neuroevolution to Attack Side-channel Leakages Yielding
  Convolutional Neural Networks
Side-channel analysis (SCA) can obtain information related to the secret key
by exploiting leakages produced by the device. Researchers recently found that
neural networks (NNs) can execute a powerful profiling SCA, even on targets
protected with countermeasures. This paper explores the effectiveness of
Neuroevolution to Attack Side-channel Traces Yielding Convolutional Neural
Networks (NASCTY-CNNs), a novel genetic algorithm approach that applies genetic
operators on architectures' hyperparameters to produce CNNs for side-channel
analysis automatically. The results indicate that we can achieve performance
close to state-of-the-art approaches on desynchronized leakages with mask
protection, demonstrating that similar neuroevolution methods provide a solid
venue for further research. Finally, the commonalities among the constructed
NNs provide information on how NASCTY builds effective architectures and deals
with the applied countermeasures.
Fiske Schijlen, Lichao Wu, Luca Mariot
# NASCTY: Neuroevolution to Attack Side-channel Leakages Yielding Convolutional Neural Networks

###### Abstract

Side-channel analysis (SCA) can obtain information related to the secret key by exploiting leakages produced by the device. Researchers recently found that neural networks (NNs) can execute a powerful profiling SCA, even on targets protected with countermeasures. This paper explores the effectiveness of _Neuroevolution to Attack Side-channel Traces Yielding Convolutional Neural Networks_ (NASCTY-CNNs), a novel genetic algorithm approach that applies genetic operators on architectures' hyperparameters to produce CNNs for side-channel analysis automatically. The results indicate that we can achieve performance close to state-of-the-art approaches on desynchronized leakages with mask protection, demonstrating that similar neuroevolution methods provide a solid venue for further research. Finally, the commonalities among the constructed NNs provide information on how NASCTY builds effective architectures and deals with the applied countermeasures.

_Keywords_ Side-channel analysis, Genetic algorithms, Neural networks, Neural architecture search

## 1 Introduction

Cryptographic algorithms are a ubiquitous part of modern life since they allow us to preserve the confidentiality and integrity of sensitive data. However, the implementation of such algorithms (even if they are mathematically secure) can sometimes leak information about security assets, for instance, through power [10] or electromagnetic radiation [16, 12]. An attacker can attempt a _side-channel analysis_ (SCA) on leakages to exploit that leakage and retrieve the secret key or its parts.

Assuming that the attacker has an identical copy of the target device, _profiling_ SCA becomes one of the most potent attack methods. Such an attack leverages traces generated on the copy to construct a model that profiles leakage patterns corresponding to
the key-related intermediate data or the key itself. The profiling model can then recover the secret key from traces generated by the target device. Nowadays, neural networks (NNs) have become one of the most popular profiling model options thanks to their strong attack capability, even if the leakage traces are protected with countermeasures [3, 8, 26, 28, 24]. This type of attack is commonly referred to as deep learning-based SCA (DL-SCA) [15].

In practice, one of the biggest obstacles to applying DL-SCA is the design of the NN architecture and the optimization of its hyperparameters. The _architecture_ of an NN refers to its inner components, such as the neurons and the connections in between. In side-channel analysis research, an NN's architecture is often decided empirically, resulting in different architectures even on the same dataset [3, 28, 24]. Indeed, it is challenging to find an optimal architecture given an enormous number of hyperparameter combinations. Even worse, the selected architecture may not be transferrable when attacking different datasets or implementations. Therefore, it would be helpful to have a sophisticated and automated approach to build an architecture for an SCA on any given dataset. While there are other approaches to the automated design for neural networks for SCA, they also come with specific issues. For instance, Rijsdijk et al. used reinforcement learning that produced top-performing neural networks, but the authors still needed to start with a general description of architectures to be designed [18]. Additionally, a reinforcement learning approach is computationally expensive and requires a cluster of GPUs and days of tuning time. On the other hand, Wu et al. used Bayesian optimization to find neural network architectures for SCA [25]. This approach is much faster than reinforcement learning while providing similar results (in terms of attack performance). Still, the authors needed to select the surrogate model and acquisition function for Bayesian optimization, which can again make the hyperparameter tuning significantly harder. Besides, both aforementioned methods rely on the experience obtained from iterations, and the question "_Is the selected model global optimal?_" is tricky to answer.

In this paper, we propose a _Genetic Algorithm_ (GA) as an alternative to the above-mentioned methods for the hyperparameter tuning task in the context of DL-SCA. In general, GAs are quite a versatile metaheuristic for hyperparameter tuning, which optimize a population of candidate hyperparameter vectors (or individuals, in the GA terminology). A GA mimics natural evolution for these vectors by applying genetic operators such as recombination and mutation, pruning the population with a selection method, and evaluating them against a fitness function. This process is iterated over multiple generations, after which the last generation's best-performing hyperparameter vector is taken as a solution. In principle, a GA allows for obtaining robust models for leakages acquired from different cryptographic implementations.

The main contributions of this work are:

1. We provide a methodology based on genetic algorithms for tuning the hyperparameters of neural networks for profiling side-channel analysis. Our approach is automated, extensible, and capable of producing various neural networks.
2. We analyze the components of well-performing architectures constructed with our method, giving insights into the effectiveness of CNN hyperparameter options for side-channel analysis.

The rest of this paper is organized as follows. In Section 2, we provide information about profiling SCA, neural networks, genetic algorithms, and the datasets we use. Section 3 gives an overview of related works. In Section 4, we provide details about our novel methodology. Section 5 provides details about the experimental setup and
reports the obtained results. In Section 6, we provide a discussion about the obtained architectures, and finally, in Section 7, we conclude the paper.

## 2 Background

In this section, we cover all necessary background concepts related to Side-channel analysis, neural networks, and genetic algorithms that form the basis of our contribution. The treatment is essential, as a complete overview of these subjects is clearly out of the scope of this manuscript. The reader can find further information in Picek et al.'s recent systematization of knowledge paper [15].

### Profiling Side-channel Analysis

A _profiling_ attack consists of a profiling phase and an attack phase, which are analogous, respectively, to the training and test phase in the context of supervised learning machine learning. In the profiling phase, an attacker uses leakages from a clone device to construct a model that maps the relationship between leakages and corresponding labels (i.e., key-related intermediate data). In the attack phase, he iterates over all possible key candidates and obtains the respective output probabilities for their labels. By repeating this process for each trace and summing the logarithms of the probabilities assigned to each key candidate, he ends up with a log probability vector used to determine the likelihood of each candidate being the correct key. Eq. (1) formulates the procedure of obtaining the log probability for key candidate \(k^{\prime}\) over \(N\) attack traces:

\[P_{log}(k^{\prime})=\sum_{i=0}^{N-1}\log(P(l(p_{i},k^{\prime}))), \tag{1}\]

where \(l(\cdot)\) denotes the cryptographic operation that generates the targeted intermediate data, \(P(\cdot)\) is the probability assigned by the profiling model, and \(p_{i}\) represents the plaintext used for leakage \(i\).

The attack performance is evaluated with the _key rank_ metric as follows:

\[\mathsf{KR}=\big{|}\{k^{\prime}|P_{\log}(k^{\prime})>P_{\log}(k)\}\big{|}. \tag{2}\]

Intuitively, the key rank is the number of key candidates with a higher likelihood of correctness than the correct key value. An attack is successful when the correct key is predicted with the highest likelihood or can be brute-forced after being placed among the few highest-likelihood candidates. In this work, we discuss the mean key rank achieved over multiple experimental runs, in which case the metric is commonly referred to as the _guessing entropy_[20]. Furthermore, as common in the related works, we will assess the attack performance against a single key byte only (which is denoted partial guessing entropy), but for simplicity, we will denote it as guessing entropy. A common assumption is that attacking a single key byte reveals the average effort required for other key bytes as well [27, 18].

#### 2.1.1 Countermeasures

SCA countermeasures aim to mitigate the information leakage produced during cryptographic operations. In this work, we consider the _Boolean masking_ and _desynchronization_ countermeasures. The masking countermeasure splits the sensitive intermediate
values into different shares to decrease the key dependency [12]. For instance, as implemented in the considered datasets [3], a random mask \(r\) is applied after the AdRoundKey operation in the first round of AES encryption. The intermediate value is then computed as:

\[Z=\textsf{SBOX}(p\oplus k)\oplus r. \tag{3}\]

Desynchronization is a common type of hiding countermeasure introducing time randomness to the leakages. In practice, such effects can be realized by adding clock jitters and inserting random instructions. We simulate this effect by randomly shifting with an upper bound for each trace [3, 26].

### Neural Networks

SCA can be considered a classification task that aims to map the input leakages to a cluster corresponding to the targeted labels. Such a task can be accomplished with a _neural network_ (NN), which is essentially a nonlinear function composed of layers of _neurons_, sometimes referred to as _nodes_. The output of a neuron is defined as follows:

\[y=\phi(\sum_{i=i}^{n}w_{i}x_{i}+b_{k}), \tag{4}\]

which is computed by multiplying the neuron's inputs \(x_{1},\dots,x_{n}\) from the previous layer with their corresponding weights \(w_{1},\dots,w_{n}\), adding the _bias_ value \(b_{k}\) corresponding to neuron \(k\), and finally transforming the result with the _activation function_\(\phi\). The activation function acts as a source of nonlinearity and often improves the efficiency of the training phase. Two common activation functions for NNs in SCA are the _rectified linear unit_ (ReLU) and _scaled exponential linear unit_ (SELU).

When training a neural network, the weight and bias for each neuron are updated with gradient descent to minimize the loss function. A common loss function in multi-class classification problems is the _categorical cross-entropy_ (CCE). Cross-entropy is a measure of the difference between two distributions. Minimizing the cross-entropy between the true distribution of the classes and the distribution modeled by the neural network improves its predictions:

\[CCE(y,\hat{y})=-\frac{1}{n}\sum_{i=1}^{l}\sum_{j=1}^{c}y_{i,j}\cdot\log(\widehat {y_{i,j}}), \tag{5}\]

where \(c\) and \(l\) respectively denote the number of classes and data, \(y\) is the true value, and \(\hat{y}\) is the predicted value.

A primary type of NN architecture in SCA is the _multilayer perceptron_ (MLP), in which a sequence of fully-connected hidden layers of neurons is followed by an output layer that transforms the final output values to label prediction probabilities. A _convolutional neural network_ (CNN) is another commonly used type of network in SCA. It prepends its first fully-connected layer with one or more convolutional blocks. Such a block consists of a _convolutional layer_ that attempts to compute local features over the input data, and it is optionally followed by a _pooling layer_ that aggregates the resulting values, e.g., by calculating \(n\)-wise averages. Eq. (6) formally displays the application of \(j\) convolution filters with kernel size \(k\) on inputs \(\{x_{i},x_{i+1},\dots,x_{i+j}\}\). A convolutional layer repeats such convolutions until shifted through all \(n\) inputs, resulting in \(n\cdot j\) inputs
for the fully-connected layers. Formally, this operation can be stated as follows:

\[\begin{split}\mathsf{conv}(\{x_{i},x_{i+1},\dots,x_{i+j}\})=& \{c_{0,0}\cdot c_{0,1}\cdot\dots\cdot c_{0,k-1}\cdot x_{i},\\ & c_{1,0}\cdot c_{1,1}\cdot\dots\cdot c_{1,k-1}\cdot x_{i+1},\\ &\dots,\\ & c_{j-1,0}\cdot c_{j-1,1}\cdot\dots\cdot c_{j-1,k-1}\cdot x_{i+j }\}.\end{split} \tag{6}\]

### Genetic Algorithms

A genetic algorithm (GA) is a type of population-based optimization algorithm that typically utilizes elements from biological evolution [6]. A GA's objective is to optimize a solution to some problem by maintaining a population of such solutions and evolving them over several _generations_. We refer to such a solution as an _individual_ or _genome_ consisting of building blocks known as _genes_. One generation is performed by evaluating the fitness of each genome, selecting fit genomes as parents for reproduction, and applying genetic operators such as mutation and crossover on those parents to generate the offspring, which represents the next generation.

Before commencing the first generation, the genomes in the population are randomly initialized for diversity. One then starts an iteration of generations until the fitness evaluation budget expires or the fitness value of the best genome achieves a predefined threshold. Each generation starts with _fitness evaluation_, by assigning a fitness value to each genome that measures how well the corresponding individual performs concerning the relative optimization problem. The next step is _selection_, which aims to cull weak genomes from the population so that the algorithm favors genetic modifications that create fitter genomes. Rather than straightforwardly selecting a number of the fittest genomes, modern GAs employ more sophisticated methods to preserve diversity in the population. One such method is _tournament selection_[13], which determines parents by holding 'tournaments' of some randomly picked genomes and retaining the ones with the best fitness as parents.

Having selected the parents, a GA usually produces as many offspring individuals as the number of parents. Production of one child's genome involves applying one or multiple _genetic operators_ to one or multiple parents. These operators include _mutation_ and _crossover_[7], though the latter can be omitted in a nonmating GA. Mutation only requires one parent, cloned and randomly modified with a predefined mutation function to produce one child. On the other hand, crossover refers to the combination of properties of two or more parents to construct a child. In this work, we apply _polynomial mutation_, a mutation method for real-valued parameters introduced by Deb and Agrawal [4] that is designed for variables with predefined minimum and maximum boundaries. The method mutates some variable \(x\) towards either lower boundary \(x_{L}\) or upper boundary \(x_{U}\) with uniform probability. The degree of the mutation is then determined by pseudorandom number \(0\leq u<1\) and parameter \(\eta\), with a higher value of \(\eta\) resulting in a smaller mutation range. In other words, the mutated value \(x^{\prime}\) is equal to \(x+\bar{\delta}_{L}(x-x_{L})\) or \(x+\bar{\delta}_{R}(x_{R}-x)\) with \(\bar{\delta}_{L}\) and \(\bar{\delta}_{R}\) scaling with \(u\) and \(\eta\) as defined in Eq. (7).

\[\begin{split}\bar{\delta}_{L}=&(2u)^{\frac{1}{1+ \eta}}-1\\ \bar{\delta}_{R}=& 1-\left(2(1-u)\right)^{\frac{1}{1+\eta}}. \end{split} \tag{7}\]

_Neuroevolution_ is the usage of an evolutionary algorithm for constructing or optimizing an NN. In this work, we will use a GA to construct a neural network architecture for
SCA. In such a scenario, a genome in a GA describes the hyperparameter combination of an NN. The fitness is determined through the evaluation of the network's performance.

### Datasets

We use the ASCAD dataset [3], where each trace comprises 700 trace points corresponding to the S-box operation of the third key byte. Note that we are referring to the _fixed-key_ ASCAD dataset, where the same encryption key is used in all AES operations. These traces are protected with the _masking_ countermeasure, so the intermediate value \(Z\) was computed as in Eq. (3) for some random mask byte \(r\).

The training (35 584) and validation (3 840) sets are balanced samples taken from the 50 000 training traces. Their respective numbers were chosen such that both sets are sufficiently large for their respective purposes. Since we use the identity leakage model in all our experiments with this method, both sets' numbers are a multiple of 256, i.e., the number of possible output labels. Note that while we do not expect many issues with the identity leakage model and class imbalance [14], we still balance the classes to mitigate any undesired effects. Ten thousand attack traces are used to assess the attack performance. Finally, we conduct experiments on this dataset with and without the desynchronization countermeasure.

## 3 Related Work

We now give an overview of the literature concerning optimizing NN's architectures for the SCA domain, considering both manual and fully automated approaches. Next, we briefly survey the automated methods based on neuroevolution.

### Network Architecture Optimization in SCA

In 2016, Maghrebi et al. proposed several DL-based approaches and verified their effectiveness on the DPAv2 dataset [23] and custom AES implementations with and without first-order masking [11]. The customized neural networks obtained a key rank of zero with fewer than \(10^{5}\) training traces on the masked implementation. Interestingly, their CNN architecture was determined with a genetic algorithm using the guessing entropy as a fitness function, but they do not provide in-depth elaboration on their methodology.

Benadjila et al. [3] further explored the performances of neural networks in the SCA context. Upon evaluating several promising architectures from the existing literature, VGG-16 [19] or deep CNNs with similar structures were deemed well-suited for SCA. Kim et al. [8] enhanced the attack performance in combination with data augmentation, which turned out to be an effective way of priming the CNN to deal with several kinds of countermeasures. Next, Zaid et al. introduced efficient CNN architectures [28] that could obtain state-of-the-art performance with significantly reduced neural network size. Wouters et al. [24] further reduced the networks' size with data preprocessing strategies.

Besides manually optimizing the neural network, recent research has also attempted fully automated approaches for network architecture search. Rijsdijk et al. [18] customized the MetaQNN reinforcement learning algorithm for SCA to automatically find CNN architectures. However, the search space is roughly limited to hyperparameters that we know to be effective, and pure MLP architectures are not discussed. Each NN is
evaluated by training it for 50 epochs using the Adam optimizer and the SELU activation function in their work. Wu et al. proposed AutoSCA [25], which uses _Bayesian optimization_ to find architecture hyperparameters for both MLPs and CNNs. Their approach produced good results and mainly focused on finding larger architectures with at least 100 neurons in each dense layer.

The application of neuroevolution to perform side-channel analysis has only scarcely been explored in existing work. Knezevic et al. used genetic programming to evolve custom activation functions specific to side-channel analysis [9] that can outperform the widely used ReLU function. The genome in their approach encodes an activation function as a tree containing unary and binary operators, with leaves representing the function's inputs. Such a tree is initialized with a depth of two to five levels and limited to twelve levels during evolution. For fitness evaluation, they compute the mean number of attack traces required to obtain a key rank of zero over one hundredfold and add it to one minus the accuracy. The method resulted in novel activation functions that improve performance on large and efficient MLPs and CNNs. Acharya et al. proposed InfoNEAT [1], an approach that tailors the _NeuroEvolution of Augmenting Topologies_ (NEAT) algorithm [21] specifically for side-channel analysis. Their approach considers the identity leakage model and uses NEAT to evolve an NN architecture with a single output node for each of the 256 output classes. The resulting 256 binary networks are combined by a _stacking_ approach that uses the networks' outputs as inputs for a logistic regression model. Such a stacked model is created for multiple different folds of balanced traces taken from the complete dataset, after which those models' prediction probabilities can be summed to form a final prediction for each attack trace.

### Evolution-based Network Architecture Search

Evolutionary approaches have been widely used in automated network architecture searches. Real et al. developed one such method for image classification on modern datasets [17], a task that requires large networks. They propose a nonmating GA with both NEAT-like [21] mutations and layer-level mutations to evolve CNNs on granular and large scales. Specifically, each genome is trained with backpropagation on 45 000 samples before evaluating its fitness. In this approach, a child's genome keeps the weights and biases of its parent, effectively training each network over time.

Other successful neuroevolution methods that construct CNNs for image classification include the Deep Evolutionary Network Structured Representation approach DENSER [2] and EvoCNN [22]. DENSER uses a 2-level genotype where the first level encodes the NN's hyperparameters while the second encodes layer-specific variables such as the number of neurons or the variables for a convolutional filter. This structure enables the algorithm to be used for MLPs, CNNs, and other types as long as they can be appropriately defined in the genome's second level. Furthermore, DENSER trains NNs with backpropagation before evaluating the fitness on a validation set. EvoCNN works similarly but evolves the weight initialization values along with the architecture hyperparameters.

## 4 Nascty

_Neuroevolution to Attack Side-channel Traces Yielding Convolutional Neural Networks_ (NASTY-CNNs) is a GA that modifies hyperparameters of CNNs for side-channel analysis. Algorithm 1 shows the main procedure of our approach. This section will
specify the genome structure, the initialization of the population, the fitness evaluation method, and the method used to produce offspring. Note that the sampling of training and validation data is only performed once, meaning that we use the same data for fitness evaluation in every generation. Furthermore, we only use balanced data samples, i.e., a sampled set of traces is taken such that it contains an equal number of traces corresponding to each possible output label. Following [17, 2, 22], we also use tournament size 3 during selection, which means we randomly choose three individuals and select the fittest one as a potential parent for reproduction. Finally, note that all experiments are performed targeting the third (masked) key byte of the fixed-key ASCAD dataset in which each trace consists of 700 trace points, each of which is normalized between -1 and 1.

### Genome Structure

The NASCTY genome represents a CNN and consists of a list of zero up to and including five convolutional blocks, an optional pooling layer when no convolutional blocks are present, and a list of one up to and including five dense layers. Each of the convolutional blocks is described with the number of convolutional filters, the filter size, a Boolean denoting the presence of a batch normalization layer, and a pooling layer. Any pooling layer in the genome comprises a pooling type, either max pooling or average pooling, a pool size, and a pool stride. Finally, a dense layer is described only by its number of neurons. An example of the genome structure is presented in Figure 1.

When expressing a NASCTY genome as a neural network, following the state-of-the-art architectures, we always use the SELU activation function for all hidden neurons, use He weight initialization for the convolutional blocks and dense layers, and use Glorot uniform weight initialization for the output layer, which uses the softmax activation

Figure 1: An example of the genome encoding used in the NASCTY algorithm.
function. Although enlarging the genome parameter spaces would increase the diversity of the populations, applying the prior knowledge would speed up the evolution process.

### Population Initialization

We initialize all networks randomly with hyperparameters within the ranges displayed in Table 1. These hyperparameter ranges, as well as the genome structure itself, are inspired by the VGG-like networks for SCA found in prior work [3, 8], as well as by the automated architecture search approach for SCA based on reinforcement learning [18].

Note that one can initialize the population by starting with architectures with a minimal number of trainable parameters to reduce the required evaluation time. However, we opt to completely initialize the population at random to avoid local optima that may come about due to the reduced diversity in the population.

### Fitness Evaluation

Once a genome is defined, the corresponding CNN is trained with the Adam optimizer.1 The loss value on the validation set is used for the fitness evaluation. By minimizing loss, we aim to have a system aligned with the related works in DL-SCA. Naturally, one could consider other options here, for instance, the ones applied in [25]. The objective of training the networks before evaluating them is to enable us to differentiate their quality more accurately. We chose to train each network for ten epochs as other works do [25, 2, 22] and preliminary experiments following the methodology recommendations by [22] showed that this is enough for similarly sized networks to observe significant CCE differences in networks of different qualities.

Footnote 1: All networks are trained with the same seed in every generation to ensure they are fairly compared.

### Offspring Production

After evaluating the fitness of each genome in one generation, the members of the next generation (offspring) can be produced. Half of these members are produced by applying tournament selection to the population to find fit genomes that will act as parents. The

\begin{table}
\begin{tabular}{l c} \hline \hline
**Parameter** & **Options** \\ \hline Num. convolutional blocks & 0 to 5 in a step of 1 \\ \hline Num. dense layers & 1 to 5 in a step of 1 \\ \hline Num. convolutional filters & 2 to 128 in a step of 1 \\ \hline Filter size & 1 to 50 in a step of 1 \\ \hline Batch normalisation layer & False, True \\ \hline Pooling type & Average, Max \\ \hline Pool size & 2 to 50 in a step of 1 \\ \hline Pool stride & 2 to 50 in a step of 1 \\ \hline Num. dense neurons & 1 to 20 in a step of 1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Ranges for CNN genome hyperparameters in the NASCTY algorithm.
remaining half, on the other hand, is constructed by randomly choosing pairs of those parents on which the crossover and mutation operations are applied. Optionally, we may only apply tournament selection to some proportion of the top-performing members of the population to select parents. This operation is performed to ensure the best genomes are maintained in the population, a concept known as elitism which can be tuned with a _truncation proportion_ parameter.

Our algorithm uses one of two possible types of crossover, i.e., either _one-point_ crossover or _parameter-wise_ crossover, both of which are common crossover strategies in genetic algorithms. The performance of these two methods is evaluated in Section 5.2. To enact a one-point crossover with two parents, we apply one-point crossover separately on the parents' lists of convolutional blocks and dense layers. For a list of either convolutional blocks or dense layers, we achieve this operation by picking a random cutoff point in both parents' lists of that layer type. The first child's list of that type is then created by connecting the first parent's list before its cutoff point to the second parent's list after its cutoff point, while the second child's list is created by connecting the remaining units. The one-point crossover operation is then finalized by randomly dividing the parents' optional pooling layers that are present in the absence of convolutional blocks among the offspring.

In our implementation of parameter-wise crossover, the first child genome is created by iterating over the parents' pairs of convolutional blocks and randomly inheriting

Figure 2: Visualisation of one-point crossover on a list of convolutional blocks or dense layers in a NASCTY genome.
convolutional block genes from either parent. The second child's genome then inherits the remaining hyperparameters for these blocks. The exact process is repeated for the parents' lists of dense layers. In the typical scenario where one parent has more convolutional blocks or dense layers than the other parent, the excess units are appended unmodified to the first child's genome.

After the crossover operation, the offspring are mutated through one of the following methods with a uniform probability:

* Adding one random convolutional block or dense layer with randomly initialized hyperparameters;
* Removing one random convolutional block or dense layer;
* Modifying all hyperparameters through _polynomial mutation_ with probability \(\frac{1}{n}\), where \(n\) is the total number of modifiable hyperparameters in the genome.

The polynomial mutation is described in Section 2.3 and is designed for variables with predefined minimum and maximum boundaries, which fits our task of exploring proper hyperparameter values within predefined ranges. This mutation method comes with a parameter \(\eta\), which can be increased to reduce the degree to which a given parameter is modified. The value for \(\eta\) is recommended to be between 20 and 100 [5], though experimentation is the only way to determine a proper value of \(\eta\) for an untested scenario.

## 5 Experiments

In this section, we discuss the experimental evaluation of NASCTY. We start by describing the setup of our experiments. Then, we show the outcome of the preliminary tuning phase based on grid search. Finally, we present the results obtained by GA with the best-performing parameter combination on masked and desynchronized traces of ASCAD.

### Experimental Setup

For the experimental validation of our approach, we optimize GA parameters through a grid search, then evaluate the performance on the masked ASCAD traces and masked and desynchronized ASCAD traces for several desynchronization levels. The objective of these experiments is to determine:

* The effectiveness of GA parameters for our approach;
* Whether our automated approach can produce NNs that outperform similar NNs found through trial and error;
* Architecture components that contribute to the effectiveness of an SCA.

To account for the randomness introduced by the mutation operations, we run five experiments for each GA parameter configuration and report the best results. The best genome resulting from the NASCTY algorithm is evaluated by training its corresponding NN for 50 epochs and computing the mean incremental key rank [18] over 100 folds.

All experiments are executed with 52 parallel workers, each of which runs at approximately 2.1GHz on an Intel E5-2683 v4 CPU. With these computational resources,
the discussed experiments required 84GB RAM and took at least four and at most seven days to complete. This significant variance in runtime complexity is caused by the pseudorandom nature of GAs, which results in the construction and evaluation of NNs of varying sizes.

### Parameter Tuning by Grid Search

Table 2 shows a summary of the GA parameters for the grid search. Note that additional parameter options, mutation strategies, and crossover strategies could potentially result in better performance, but such adjustments would have to significantly diverge from our current strategy to assess the general effectiveness of the algorithm. We run each grid search experiment with a population size of 52 to match the number of available parallel workers and run the GA for ten generations. Furthermore, each of these experiments uses the same training data, validation data, and initial population to observe the impact of the parameter changes more accurately.

We expect lower values of the polynomial mutation parameter \(\eta\)[4] a better choice in these experiments where we run for relatively few generations. More specifically, smaller values of \(\eta\) cause larger mutations, which carry the potential to find better networks faster, but a value of 20 for \(\eta\) is still large enough to avoid unreasonably risky mutations [5]. For similar reasons, a larger truncation proportion would result in better performance as it preserves diversity in an already-small population. However, its influence is likely not as significant as that of the chosen crossover and mutation configurations since those can modify the population more straightforwardly. Finally, we expect either crossover strategy to perform well since both allow the algorithm to find effective architectures in the predefined hyperparameter ranges. The performance of the final network of each parameter combination's best run is shown in Figure 3.

Figure (a)a implies that each parameter combination is capable of producing fit architectures for the considered ASCAD traces. Similarly, the best runs' fitness plots over generations shown in Figure (b)b demonstrate that the best genome's CCE, i.e., the validation loss, can improve significantly in as few as ten generations, regardless of the parameter combination under consideration.

The best mean incremental key rank among all grid search experiments was approximately 0.50419 and resulted from the experiments with a polynomial mutation \(\eta\) value of 20, one-point crossover, and a truncation proportion of 1.0. Therefore, those parameters are applied for all further experiments. To determine each GA parameter's influence on the final performance, we observe the effect of modifying one variable at a time while keeping the others constant at the aforementioned best-observed values. Table 3 displays how such modifications affect the mean incremental key rank. From the table, we can infer that only the crossover strategy significantly affects the final performance among the parameters we considered; one-point crossover is preferred over the parameter-wise crossover. Since the best runs using parameter-wise crossover in Figure 3 still perform

\begin{table}
\begin{tabular}{l c} \hline \hline
**Parameter** & **Options** \\ \hline Polynomial mutation \(\eta\) & 20, 40 \\ \hline Crossover type & One-point, parameter-wise \\ \hline Truncation proportion & 0.5, 1.0 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The parameter values we consider during grid search for NASCTY.
well, the performance difference likely results from poor consistency compared to runs using the one-point crossover. We suspect that the additional consistency observed with one-point crossover is achieved through its advantage in retaining functional sequences of convolutional blocks or dense layers. In addition, one-point crossover on lists of layers intuitively provides synergy with our mutation strategy of adding or removing an entire layer because effective additions or removals can be identified more quickly when they are separated into offspring in a modular fashion.

### ASCAD: Masked and Desynchronized

All remaining experiments are run with the best-performing parameter options found through our grid search experiments. In addition, we run these experiments with a population size of 100 to fully exploit the resources at our disposal. In contrast to our grid search experiments, these experiments do not use a seed for the pseudorandom numbers involved anywhere in the GA except for the fitness evaluation procedure, in which we use a seed for the training of each NN to ensure the genomes are fairly compared.

We first run NASCTY on masked ASCAD traces for 75 generations to evaluate the algorithm's general effectiveness. Then, we run experiments on the same masked dataset, further protected with desynchronization as described in Section 2.1.1. Specifically, we run three sets of experiments with desynchronization levels of 10, 30, and 50,

Figure 3: NASCTY grid search results corresponding to the best network obtained with each parameter combination.

\begin{table}
\begin{tabular}{l l l l} \hline \hline \(\eta\) & **Crossover type** & **Truncation proportion** & **Mean incremental key rank** \\ \hline
20 & One-point & 1.0 & 0.50419 \\ \hline
40 & One-point & 1.0 & 0.50880 \\ \hline
20 & Parameter-wise & 1.0 & 0.89354 \\ \hline
20 & One-point & 0.5 & 0.50966 \\ \hline \hline \end{tabular}
\end{table}
Table 3: The effect of each parameter on the final incremental key rank in NASCTY grid search experiments.
respectively. With this approach, we aim to determine whether NASCTY can circumvent or mitigate countermeasures without additional algorithm modifications and whether larger desynchronization levels hinder NASCTY's ability to find good architectures.

The fitness progression trends in Figure 2(b) indicate that more generations would improve the observed fitness of the best genome. Following this, we first ran NASCTY on masked ASCAD traces for 75 generations with a population size of 100. Figure 4 shows the results of this first experiment. As shown in Figure 3(a), the best-obtained network converges smoothly. Ultimately, the network breaks the target in 314 attack traces and achieves a mean incremental key rank of 0.51857. The best fitness value progresses (Figure3(b)) continually after ten generations have passed, then stagnates well before the seventy-fifth generation is reached. Moreover, despite the difference in the population size and the number of generations, the best network is outperformed by several of the NNs obtained with our grid search experiments. This observed fitness stagnation implies that the algorithm may be prone to get stuck in local optima. Typically, the mutation is the source of global search in a GA, so we recommend that future work evaluates lower values of \(\eta\) for polynomial mutation or possibly more perturbing mutation strategies.

Due to the observation of fitness progress in the previous experiment, we ran NASCTY on the masked and desynchronized ASCAD traces for 50 generations instead of 75. The results for desynchronization levels 10, 30, and 50 are displayed in Figure 5. As shown in Figure 4(a), the time-randomness introduced by desynchronization affects the algorithm's performance, considering both fitness progress and final performance are noticeably diminished as the desynchronization level increases. Still, the results show that NASCTY can find effective architectures despite the added countermeasures, with the networks evaluated in Figure 4(b) being able to obtain key rank 0 in 338, 474, or 531 traces respectively for desynchronization levels 10, 30, and 50.

## 6 Discussion

The best run on the synchronized ASCAD traces produced the CNN architecture shown in Figure 5(a). It has 10 470 trainable parameters and vaguely resembles the efficient CNN proposed by Zaid et al. [28]. In comparison, the architecture produced with NASCTY

Figure 4: NASCTY results corresponding to the best network obtained on masked ASCAD traces.
has an additional dense layer and possesses several unintuitive components, such as 27 convolutional filters of size 45 and a pool stride that exceeds the pool size. Since the efficient MLP proposed by Wouters et al. [24] only required two layers of ten neurons each, we surmise that NASCTY may be inclined to include unnecessary model complexity. In other words, NASCTY does not sufficiently discourage redundant model complexity. Indeed, by increasing the desynchronization from 30 to 50, the number of trainable parameters of the best architecture decreases from 90 379 to 68 427. A possible solution would be to introduce a model size penalty in the fitness function. Still, NASCTY, with the current configuration, is sufficient in generating good network architectures. Table 4 shows that NASCTY can compete with other state-of-the-art automated hyperparameter tuning methods for SCA, although it is ultimately outperformed.

The architecture corresponding to a desynchronization level of 10 is similar to the architecture for synchronized traces in both structure and size, with the main difference being the addition of more convolutional filters and another dense layer. Both architectures also feature a pooling layer with a stride that exceeds its size, suggesting their convolutional layers have produced features that are either redundant or incorrectly utilized.

The NASCTY architectures for the two more severe desynchronization levels (30 and 50) provide more insight into NASCTY's way of mitigating this countermeasure. As can be seen in Figures 5(c) and 5(d), both of these architectures start with a convolutional layer with over 100 filters, a significantly larger number than that of the other architectures' convolutional layers. In addition, both feature two convolutional blocks and two dense

\begin{table}
\begin{tabular}{l|c|c} \hline \hline
**Method** & \multicolumn{2}{c|}{**Num. traces to**} & **Num. trainable parameters** \\  & **obtain mean key rank 0** & \\ \hline RL-SCA [18] & 242 & 1 282 \\ \hline AutoSCA [25] & 158 & 54 752 \\ \hline NASCTY & 314 & 10 470 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison of automated hyperparameter tuning methods for SCA on synchronized, masked ASCAD traces.

Figure 5: NASCTY results for ASCAD traces at desynchronization levels 10, 30, and 50.
layers, with the first dense layer in each network having two neurons. The larger number of filters is consistent with existing approaches to mitigate desynchronization, but the usage of such small dense layers is uncommon when attempting to break protected ASCAD traces. Finally, average pooling appears to be the preferred pooling type in these networks, with max pooling only occurring once. We emphasize that our architecture for desynchronization of 50 outperforms the approach of [18] or performs very similarly to the state-of-the-art methods proposed in [28, 24].

## 7 Conclusions and Future Work

This paper proposed a genetic algorithm for network architecture search in the SCA domain. In NASCTY, each genome encodes the hyperparameters representing a CNN's architecture, and a genome's fitness is evaluated by the validation loss. During offspring production, we apply either one-point crossover on parents' lists of layers or parameter-wise crossover to create a pair of child genomes that we immediately mutate by adding a layer, removing a layer, or applying polynomial mutation on its genes. With this approach, NASCTY could produce comparable architectures to state-of-the-art techniques. The redundant complexity and unintuitive architecture components found in some NASCTY networks suggest that our method can likely be improved further,

Figure 6: Best architectures produced by NASCTY for masked ASCAD traces protected with several desynchronization levels.
implying unexplored potential to match or surpass current state-of-the-art approaches.

Furthermore, NASCTY found effective architectures for traces protected with masking and desynchronization levels up to 50 while keeping its GA parameters and implementation largely unmodified. However, the desynchronization did affect the final networks' performances: networks produced by NASCTY for desynchronization levels 0, 10, 30, and 50 obtained key rank 0 within 314, 338, 474, and 531 attack traces, respectively. We recommend that future work evaluate NASCTY's effectiveness and resulting architecture patterns on traces protected with other countermeasures. The observed network architectures showed that NASCTY tends to combat desynchronization by adding a convolutional layer and increasing the number of filters in the first convolutional layer, which was the case in architectures generated for desynchronization levels 30 and 50. Interestingly, these networks started their fully-connected part with a dense layer of two neurons. Additionally, some architectures contained pooling layers of which the stride was larger than their size, which is uncommon in other approaches and suggests that NASCTY may be generating redundant features through unnecessarily large numbers of convolutional filters. The architectures NASCTY generated for synchronized and mildly desynchronized traces also came with more trainable parameters than models from related work, that achieve better performance on the same task [24], corroborating the hypothesis that NASCTY is prone to adding redundant model complexity. Regardless of the presence of desynchronization, average pooling was preferred to max-pooling in nearly all pooling layers.

For future work, it would be interesting to explore the application of a complexity penalty to fitness evaluation or population initialization with minimal architectures to reduce the network size. Furthermore, we recommend experimenting with more mutation parameters to stimulate a better global search to avoid getting stuck in a local optimum, which often seems to occur well before the algorithm terminates. Once those drawbacks have been resolved, we may find better, more interesting architectures by expanding the search space. To do so, we suggest introducing new hyperparameters to the genome, e.g., activation functions for each layer and the learning rate for more general applications. Finally, our approach considers the ASCAD dataset with a fixed key. It will be interesting to see how well our approach works for other, more difficult datasets, like ASCAD with random keys.
