Skip to main content
📖 The AI Tool Bible
Optuna preview image
Optuna logo

Optuna

✓ Editorially verified

Open-source Python framework for automated hyperparameter optimization across any ML stack.

Free· Free and open source (MIT)Fine-tuning8.1 / 10
Visit website →

In short

Optuna is an open-source Python library for hyperparameter optimization that uses define-by-run search spaces and modern samplers. It is best for ML engineers who need a flexible, framework-agnostic tuner without vendor lock-in.

Best for

Pick Optuna if you want a reproducible, code-first way to tune hyperparameters for any ML or LLM fine-tuning pipeline without locking into a vendor.

Skip if

Skip it if you want a one-click hosted AutoML product or a no-code interface for non-engineers.

Optuna is an open-source hyperparameter optimization framework built in Python and maintained by Preferred Networks. It uses define-by-run search spaces (so you can express conditionals and loops in standard Python), pairs that with modern samplers like TPE, CMA-ES and Gaussian-process Bayesian optimization, and prunes unpromising trials early to save compute. A study object tracks all trials, and results can be inspected through the bundled Optuna Dashboard with Jupyter Lab and VS Code extensions.

It's framework-agnostic: PyTorch, TensorFlow/Keras, scikit-learn, XGBoost, LightGBM and basically anything you can wrap in an objective function. Parallel and distributed search works without code changes, and OptunaHub lets the community publish custom samplers and pruners. Pricing is simple, it's free and MIT-licensed. The audience is ML engineers and researchers who want a serious tuner without committing to a closed AutoML platform.

Fine-tuning teams typically reach for Optuna when they need to sweep learning rates, LoRA ranks, batch sizes or architecture choices and want reproducible studies backed by a SQL or in-memory storage. It is a library, not a hosted service, so you bring your own compute and orchestration.

Editor's take

Optuna is the default we'd reach for when a fine-tuning run needs real hyperparameter search rather than a hand-tuned guess. The define-by-run API and pruning support make it noticeably more pleasant than older grid-search tooling, and the dashboard finally makes long studies readable.

— The AI Tool Bible editorial team

Pros

  • Define-by-run search spaces feel natural in Python
  • Strong sampler/pruner library including TPE, CMA-ES, GP-BO
  • Framework-agnostic across PyTorch, TF, sklearn, XGBoost
  • Parallel and distributed search with minimal code changes
  • Free, MIT-licensed, with active maintainers

Cons

  • ⚠️ Library only, no managed service or hosted dashboard
  • ⚠️ You handle orchestration, storage and compute yourself
  • ⚠️ Learning curve for advanced multi-objective and conditional studies

Use cases

hyperparameter-tuningml-experiment-trackingbayesian-optimizationautomlmodel-fine-tuning

Frequently asked

What machine learning frameworks does Optuna support?
Optuna is framework-agnostic and works with PyTorch, TensorFlow/Keras, scikit-learn, XGBoost, LightGBM, and any other model that can be wrapped in an objective function.
Is Optuna a hosted service or a local library?
Optuna is a library, not a hosted service. Users must provide their own compute, orchestration, and storage, though it supports parallel and distributed search.
What optimization methods does Optuna use?
It pairs define-by-run search spaces with modern samplers such as TPE, CMA-ES, and Gaussian-process Bayesian optimization, while pruning unpromising trials to save compute.
Who is the primary audience for Optuna?
It is designed for ML engineers and researchers who want a serious, reproducible tuner without committing to a closed AutoML platform or no-code interface.
How is Optuna licensed and priced?
Optuna is free and open source under the MIT license, maintained by Preferred Networks.

Explore related

Compare with similar tools

All in Fine-tuning