keras-tuner
A Hyperparameter Tuning Library for Keras
What it is and what it does
KerasTuner is a hyperparameter optimization framework designed to automate the search for optimal model configurations in Keras. It provides a define-by-run syntax where you write a function that builds your model and uses the `hp` argument to declare which hyperparameters to tune, then delegates the search to one of several built-in algorithms: Bayesian Optimization, Hyperband, or Random Search. The framework handles the trial management, evaluation, and model selection, returning the best-performing model based on your chosen objective metric.
The package integrates with keras as its primary dependency and relies on packaging, requests, kt-legacy, grpcio, and protobuf for configuration management, API communication, and serialization. KerasTuner is intended for researchers and practitioners who need to systematically explore hyperparameter spaces without manually implementing search logic, and it is designed to be extensible for experimenting with custom search algorithms.
Use it for:
- Automatically find optimal layer sizes, learning rates, and activation functions for a model without manual trial-and-error.
- Compare multiple search algorithms (Bayesian, Hyperband, Random) on the same model to identify which converges fastest.
- Scale hyperparameter search across distributed systems using the framework's built-in support for parallel trials.
- Experiment with new search algorithms by extending KerasTuner's base classes for research or domain-specific optimization.
- Reduce model development time by systematically tuning a large number of hyperparameters in a single reproducible workflow.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
KerasTuner automates hyperparameter optimization for Keras models using built-in search algorithms (Bayesian Optimization, Hyperband, Random Search) and a define-by-run configuration syntax.
Yes, with conditions. KerasTuner is a permissively licensed tool for automating hyperparameter search in Keras models, with low install friction and no known vulnerabilities. However, its maintenance status is aging (276 days since last release), so verify compatibility with your keras version and check for any recent issues before committing to production workflows. It is well-suited for research, prototyping, and systematic tuning tasks.
Install
keras-tuner on PyPI
pip
pip install keras-tuneruv
uv add keras-tunerpoetry
poetry add keras-tunerInstalling keras-tuner
Before you install
Low install friction with a pure-Python wheel. The package depends on keras, packaging, requests, kt-legacy, grpcio, and protobuf. Maintenance status is aging—last release was 276 days ago, though the repository remains active with a recent commit on 2025-12-01.
License in practice
Licensed under Apache License 2.0 (permissive), so you can use, modify, and distribute the package freely in commercial and private projects without restriction.
Quickstart
pip install keras-tuner
import keras_tuner
from keras import Sequential, layers
def build_model(hp):
model = Sequential()
model.add(layers.Dense(hp.Choice('units', [8, 16, 32]), activation='relu'))
model.add(layers.Dense(1, activation='relu'))
model.compile(loss='mse')
return model
tuner = keras_tuner.RandomSearch(build_model, objective='val_loss', max_trials=5)
tuner.search(x_train, y_train, epochs=5, validation_data=(x_val, y_val))
best_model = tuner.get_best_models()[0]
Requires Python 3.8+ and a compatible version of keras.
Verify before relying
- Whether aging maintenance status (276 days since last release) affects stability or feature completeness.
- Performance characteristics and scalability limits for large hyperparameter search spaces.
- Specific keras and protobuf version compatibility requirements.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — keras, packaging, requests, kt-legacy, grpcio, protobuf |
| Maintenance | aging — 276 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 180,913/month — #10,137 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: keras_tuner-1.4.8-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ConfigSpaceConfigSpace defines and manipulates…
permissive · top 15,000 on PyPI
optunaOptuna is a hyperparameter optimization…
permissive · top 5,000 on PyPI
sweepsGenerates hyperparameter sweep suggestions…
permissive · top 15,000 on PyPI
pyannote-pipelineDefines and optimizes tunable hyperparameter…
unclear · top 5,000 on PyPI
hyperoptHyperopt performs serial and parallel…
permissive · top 5,000 on PyPI
FLAMLFLAML automates machine learning workflows by…
permissive · top 15,000 on PyPI
keras-hubKerasHub provides Keras 3 implementations of…
permissive · top 15,000 on PyPI
ax-platformAx is a platform for adaptive experimentation…
permissive · top 15,000 on PyPI
bayesian-optimizationBayesian optimization using Gaussian processes…
permissive · top 15,000 on PyPI
tensorflow-model-optimizationProvides quantization, pruning, and clustering…
permissive · top 15,000 on PyPI