nevergrad
A Python toolbox for performing gradient-free optimization
What it is and what it does
Nevergrad is a Python optimization library designed for problems where gradients are unavailable or expensive to compute. It implements multiple gradient-free algorithms (including evolutionary strategies, Bayesian optimization, and CMA-ES variants) and lets you specify complex search spaces with bounded continuous variables, discrete choices, and mixtures of both through its Instrumentation API. You define a function to minimize, describe the parameter space, set a budget, and the optimizer explores and returns the best point found.
The library is maintained by Facebook Research and actively developed. It's commonly used for hyperparameter tuning in machine learning, algorithm configuration, and any black-box optimization task where you can evaluate a function but cannot compute gradients. Dependencies include numpy for numerics, cma for covariance-matrix adaptation, and bayesian-optimization for probabilistic search strategies.
Use it for:
- Tuning hyperparameters (learning rate, batch size, architecture choice) for neural networks without access to gradient information.
- Optimizing simulator or expensive-to-evaluate function outputs where finite differences are impractical.
- Finding optimal configurations for complex systems with mixed continuous and categorical parameters.
- Benchmarking and comparing multiple gradient-free algorithms on the same optimization problem.
- Automating parameter search for legacy code or proprietary black-box functions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Nevergrad is a gradient-free optimization library that finds optimal parameter values for functions without requiring derivatives, supporting continuous, discrete, and mixed variable spaces.
Yes. Nevergrad is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It's well-suited if you need gradient-free optimization with support for mixed variable types. Install it if you're doing hyperparameter tuning, black-box optimization, or algorithm configuration without access to gradients.
Install
nevergrad on PyPI
pip
pip install nevergraduv
uv add nevergradpoetry
poetry add nevergradInstalling nevergrad
Before you install
Low install friction; pure Python wheel with six runtime dependencies (numpy, cma, bayesian-optimization, typing-extensions, pandas, directsearch). Repository is active with recent commits and no known vulnerabilities.
License in practice
MIT license is permissive; you can use, modify, and distribute nevergrad with minimal restrictions in commercial and open-source projects.
Quickstart
pip install nevergrad
import nevergrad as ng
def square(x):
return sum((x - .5)**2)
optimizer = ng.optimizers.NGOpt(parametrization=2, budget=100)
recommendation = optimizer.minimize(square)
print(recommendation.value)
Requires Python 3.6 or later; numpy and other dependencies must be installed.
Verify before relying
- Whether the library scales well to high-dimensional optimization problems or very large budgets.
- Performance comparison with other gradient-free optimizers on standard benchmarks.
- Specific convergence guarantees or theoretical properties of the NGOpt algorithm.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — numpy, cma, bayesian-optimization, typing-extensions, pandas, directsearch |
| Maintenance | actively maintained — 478 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 482,272/month — #6,423 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nevergrad-1.0.12-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
torch-optimizerProvides a collection of alternative…
permissive · top 15,000 on PyPI
directsearchSolves unconstrained and linearly constrained…
copyleft · top 15,000 on PyPI
cmaesProvides CMA-ES (Covariance Matrix Adaptation…
permissive · top 5,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI
onnxoptimizerApplies graph-level optimizations to ONNX…
permissive · top 15,000 on PyPI
ropt-dakotaProvides Dakota optimization algorithms as a…
copyleft · top 15,000 on PyPI
deapDEAP is an evolutionary computation framework…
copyleft · top 15,000 on PyPI
optaxOptax provides composable building blocks for…
permissive · top 5,000 on PyPI
recboleRecBole provides a unified framework for…
permissive · top 15,000 on PyPI
cmaCMA-ES is a derivative-free numerical…
permissive · top 5,000 on PyPI