Abstract
We introduce a Python open-source library for $\mathcal{X}$-armed bandit and online blackbox optimization named PyXAB. PyXAB contains the implementations for more than 10 $\mathcal{X}$-armed bandit algorithms, such as HOO, StoSOO, HCT, and the most recent works GPO and VHCT. PyXAB also provides the most commonly-used synthetic objectives to evaluate the performance of different algorithms and the various choices of the hierarchical partitions on the parameter space. The online documentation for PyXAB includes clear instructions for installation, straight-forward examples, detailed feature descriptions, and a complete reference of the API. PyXAB is released under the MIT license in order to encourage both academic and industrial usage. The library can be directly installed from PyPI with its source code available at https://github.com/WilliamLwj/PyXAB
Addressing the Implementation Gap
In machine learning, optimizing "blackbox" functions—where internal mechanics are unknown and only outputs are observable—is a frequent necessity, particularly for hyperparameter tuning and neural architecture search. $\mathcal{X}$-armed bandits (or Lipschitz bandits) offer a powerful solution by hierarchically partitioning the search space into nodes, treating each as an "arm" in a multi-armed bandit framework.
Despite their theoretical appeal, these algorithms are notoriously difficult to implement. They require sophisticated management of tree structures, node sampling, and the delicate balance between exploration and exploitation. Prior to PyXAB, the field was characterized by "code silos," where implementations were either proprietary, scattered across incompatible languages like MATLAB and C, or entirely unavailable in Python.
Modular Architecture
PyXAB introduces a modular architecture that follows the standard learning paradigm of $\mathcal{X}$-armed bandits. This design allows researchers to easily swap components and benchmark different strategies.
The library is built around four core components:
- Algorithm: A unified API where every algorithm implements
pull()to select the next evaluation point andreceive_reward()to update the internal model. - Partition: Manages the hierarchical splitting of the parameter space (e.g.,
BinaryPartition,DimensionBinaryPartition). - Node: The base class for storing domain information. Specialized logic, such as the $b_{h,i}$-values in StoSOO, can be implemented by overwriting node behavior.
- Objective: A standardized interface for defining the optimization target.
Benchmarking and Key Results
PyXAB includes built-in synthetic benchmarks like Garland, DoubleSine, and Himmelblau. These functions represent various optimization landscapes, from multiple local optima to specific smoothness properties, providing a rigorous testing ground for new algorithms.
Key achievements of the library include:
- Comprehensive Coverage: Implementation of over 10 algorithms, many of which (like HCT, GPO, and VHCT) previously lacked accessible Python versions.
- Engineering Excellence: The library maintains over 95% test coverage and follows PEP8 standards using the
blackformatter. - Accessibility: A complete optimization loop can be implemented in approximately 10 lines of Python code, democratizing access to complex optimization techniques that previously took days to implement from scratch.
Future Directions
While PyXAB provides a robust foundation, future work will focus on expanding into real-world benchmarks for deep learning frameworks and developing specialized partitions to better handle the "curse of dimensionality" in high-dimensional spaces. Released under the MIT license, PyXAB is designed to grow through community contributions.
Summary updated