Background
Choosing a neural-network architecture involves decisions about model depth, hidden-layer size, activation functions, and regularisation. These choices are often made manually or through exhaustive hyperparameter search.
This project explored whether a Genetic Algorithm (GA) could instead search over neural-network architectures for a six-class Farsi vowel classification task.
Rather than optimising the weights of a fixed architecture, the GA operated over architectural choices, treating each candidate network configuration as an individual in an evolving population.
Research Goals
- Represent neural-network architecture choices as a genetic search space.
- Use selection, crossover, and mutation to evolve candidate architectures.
- Evaluate candidate networks using validation performance as a fitness signal.
- Examine how population size affected the behaviour and outcome of the evolutionary search.
- Compare the fitness observed during architecture search with the performance obtained when selected architectures were trained and evaluated again.
Dataset
The experiments used a Farsi vowel dataset containing six classes, provided in MATLAB .mat format.
The data were converted into tensors for model training and evaluation in PyTorch.
Search Space
Each individual in the Genetic Algorithm represented a feed-forward neural-network architecture.
The encoded architectural choices included:
- Number of hidden layers
- Number of neurons in the hidden layers
- Activation function
- Dropout rate
Candidate architectures were instantiated and trained in PyTorch before their validation performance was used as the fitness signal for the evolutionary search.
Methodology
Genetic Algorithm
The search procedure followed the standard evolutionary cycle:
- Initialise a population of candidate neural-network architectures.
- Train and evaluate each candidate.
- Assign fitness according to validation performance.
- Select stronger candidates for reproduction.
- Generate new architectures through crossover and mutation.
- Repeat the process across generations.
This allowed architectural configurations to be explored without manually specifying a single network design in advance.
Population-Size Experiment
I compared Genetic Algorithm runs using population sizes of:
- 5
- 10
- 20
The experiment examined whether increasing the number of candidate architectures evaluated within each generation necessarily produced better solutions.
Architecture Evaluation
Promising architectures identified during the evolutionary search were evaluated again to compare their search-time fitness with subsequent validation performance.
This distinction was important because neural-network training is stochastic: the fitness observed during one search run does not guarantee identical performance when the same architecture is trained again.
Results
The Genetic Algorithm identified several architectures that performed substantially above the six-class random-classification baseline of approximately 16.7%.
The strongest architecture identified in the experiments used:
- 1 hidden layer
- 32 hidden units
- ReLU activation
- 0.1 dropout
This configuration achieved approximately 42.62% validation accuracy in the corresponding evaluation.
The population-size experiments also showed that increasing the search population did not automatically produce better final validation performance.
A population of 10 produced the strongest search-time fitness among the tested configurations, while retraining selected architectures did not always reproduce the same performance observed during evolutionary search.
This exposed an important distinction between:
finding an architecture that performs well during a stochastic search procedure and demonstrating that the architecture performs reliably when evaluated again.
The experiment therefore did not establish a universally optimal neural-network architecture. Instead, it demonstrated both the potential and the variability of evolutionary architecture search.
Contributions
- Implemented a Genetic Algorithm for neural architecture search.
- Encoded network depth, hidden-layer size, activation function, and dropout as evolvable architectural variables.
- Applied evolutionary search to a six-class Farsi vowel classification problem.
- Integrated Genetic Algorithm operations with automated PyTorch model construction, training, and evaluation.
- Compared search behaviour across population sizes of 5, 10, and 20.
- Identified a candidate architecture achieving approximately 42.62% validation accuracy.
- Examined the difference between search-time fitness and retrained validation performance, highlighting the effect of stochasticity on architecture selection.
Limitations
The experiment searched a relatively constrained space of feed-forward neural-network architectures and should not be interpreted as a general benchmark of modern Neural Architecture Search methods.
Candidate fitness was also based on neural-network training, which introduces stochastic variation into the evaluation process. A configuration that achieved strong fitness during one evolutionary run did not necessarily reproduce the same performance when trained again.
The results therefore identify promising configurations within the tested search space rather than establishing a uniquely optimal architecture.
Impact
The project demonstrated that automated model selection introduces uncertainty of its own.
A search algorithm may identify a candidate with strong validation fitness, but that result depends on the search space, evaluation procedure, stochastic training process, and computational budget used to discover it.
The experiment provided practical experience in evolutionary optimisation and highlighted an important model-selection principle: the configuration that appears best during search is not automatically the configuration that will perform most reliably when evaluated again.
