It sound a little bit like a task for a genetic algorithm. You start with a population of random genomes, where each genome encodes the architecture of a model, and through selection/mutation/reproduction you create new models. The fitness function has to depend on the test accuracy and probably on the network complexity so you networks don’t blow up.
I’m not knowledgeable enough to say if this truly a way to go in principle. Obviously, there are practical issues, particularly that each generation requires the training and testing of the whole current population of networks.