Deep learning has revolutionized machine learning. But designing the right neural network — layers, neurons, activation functions, optimizers — can feel like an endless experiment. Wouldn’t it be nice if someone did the heavy lifting for you?
That’s exactly what AutoML for deep learning aims to solve.
In this article, I’ll introduce you to two powerful yet approachable tools for automating deep learning: AutoKeras and Keras Tuner. We will deep dive into these libraries and do some hands-on model building.
Why automate deep learning?
Deep learning model design and hyperparameter tuning are resource-intensive. It’s easy to:
- Overfit by using too many parameters.
- Waste time testing architectures manually.
- Miss better-performing configurations.
AutoML tools remove much of the guesswork by automating architecture search and tuning.
How do these libraries work?
AutoKeras
AutoKeras leverages Neural Architecture Search (NAS) techniques behind the scenes. It uses a trial-and-error approach powered by Keras Tuner under the hood to test different configurations. Once a good candidate is found, it trains it to convergence and evaluates.
Keras Tuner
Keras Tuner is focused on hyperparameter optimization. You define the search space (e.g., number of layers, number of units, learning rates), and it uses optimization algorithms (random search, Bayesian optimization, Hyperband) to find the best configuration.
Installing required libraries
Installing these libraries is quite easy; we just need to use pip. We can run the command below in the Jupyter notebook to install both libraries.
pip install autokeras
pip install keras-tuner
AutoKeras: End-to-end automated deep learning
AutoKeras is a high-level library built on top of TensorFlow and Keras. It automates:
- Neural architecture search (NAS)
- Hyperparameter tuning
- Model training
With just a few lines of code, you can train deep learning models for images, text, tabular, and time-series data.
Creating the model
For this article, we will work on image classification. We will load the MNIST dataset using Tensorflow Datasets. This dataset is freely available on Tensorflow, you can check it out here, and then we will use the ImageClassifier of Autokeras.
import autokeras as ak
from tensorflow.keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
clf = ak.ImageClassifier(max_trials=3) # Try 3 different models
clf.fit(x_train, y_train, epochs=10)
accuracy = clf.evaluate(x_test, y_test)
print("Test accuracy:", accuracy)
We can see in the output screenshot that it took 42 minutes for trial 2, and it will continue till 3 trials and then show us the best model with parameters.
Keras Tuner: Flexible hyperparameter optimization
Keras Tuner, developed by the TensorFlow team, is a hyperparameter optimization library. Unlike AutoKeras, it doesn’t design architectures from scratch — instead, it tunes the hyperparameters of the architecture you define.
Creating the model
Unlike Auto Keras, here we will have to create the entire model. We will use the same Mnist Image Dataset and create a CNN image classifier model.
import tensorflow as tf
import keras_tuner as kt
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
def build_model(hp):
model = tf.keras.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(hp.Int('units', 32, 512, step=32), activation='relu'))
model.add(tf.keras.layers.Dense(10, activation='softmax'))
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
return model
tuner = kt.Hyperband(build_model, objective='val_accuracy', max_epochs=10)
tuner.search(x_train, y_train, epochs=10, validation_split=0.2)

So, in the output, we can clearly see that trial 21 completed in 22 seconds with a validation accuracy of ~97.29% and the model also keeps the best accuracy which is ~97.93%.
To find out the best model, we can run the commands given below.
models = tuner.get_best_models(num_models=2)
best_model = models[0]
best_model.summary()

We can also find out the Top 10 trials that Keras Tuner performed using the command below.
tuner.results_summary()

Real life use-case
An excellent example of how we can use both these libraries is A telecom company that wants to predict customer churn using structured customer data. Their data science team uses AutoKeras to quickly train a model on tabular features without writing complex architecture code. Later, they use Keras Tuner to fine-tune a custom neural network that includes domain knowledge features. This hybrid approach saves weeks of experimentation and improves model performance.
Conclusion
Both AutoKeras and Keras Tuner make deep learning more accessible and efficient.
Use AutoKeras when you want a quick, end-to-end model without worrying about architecture. Use Keras Tuner when you already have a good idea of your architecture but want to squeeze out the best performance through hyperparameter tuning.
Automating parts of deep learning frees you up to focus on understanding your data and interpreting results, which is where the real value lies.