Introduction

PyPI version GitHub Actions Workflow Status codecov pages-build-deployment GitHub commit activity GitHub top language GitHub language count Python version license Code style: black

BOAT is a compositional OperAtion-level Toolbox for gradient-based BLO. Unlike existing libraries that typically encapsulate fixed solver routines, BOAT factorizes the BLO workflow into atomic, reusable primitives. Through a unified constraint reconstruction perspective, it empowers researchers to automatically compose solvers via simple configuration.

  • PyTorch-based: An efficient and widely-used version.

  • Jittor-based: An accelerated version for high-performance tasks.

  • MindSpore-based: Incorporating the latest first-order optimization strategies to support emerging application scenarios.

BOAT is designed to offer robust computational support for a broad spectrum of BLO research and applications, enabling innovation and efficiency in machine learning and computer vision.

πŸ”‘ Key Features

  • 🧩 First-Order Operation Specialization: Specifically optimized for First-Order (FO) BLO methods, enabling fast prototyping on Ascend hardware.

  • πŸš€ Heterogeneous Hardware Support: Native compatibility with Huawei Ascend (NPU), GPU, and CPU backends.

  • 🏭 Generative Solver Construction: Supports dynamic serialization of operations. Users can switch between different FO strategies (e.g., VFO, MESO) simply by changing configurations.

  • πŸ›  Configuration-Driven: Define complex optimization strategies via simple JSON configurations (boat_config & loss_config), decoupling algorithmic logic from model definitions.

  • βœ… Comprehensive Testing: Achieves 99% code coverage through rigorous testing, ensuring software robustness.

πŸš€ Why BOAT?

Existing automatic differentiation (AD) tools primarily focus on specific optimization strategies, such as explicit or implicit methods, and are often targeted at meta-learning or specific application scenarios, lacking support for algorithm customization.

In contrast, BOAT expands the landscape of Bi-Level Optimization (BLO) applications by supporting a broader range of problem-adaptive operations. It bridges the gap between theoretical research and practical deployment, offering unparalleled flexibility to design, customize, and accelerate BLO techniques.

🌍 Applications

BOAT covers a wide spectrum of BLO applications, categorized by the optimization target:

  • Data-Centric: Data Hyper-Cleaning, Synthetic Data Reweighting, Diffusion Model Guidance.

  • Model-Centric: Neural Architecture Search (NAS), LLM Prompt Optimization, Parameter Efficient Fine-Tuning (PEFT).

  • Strategy-Centric: Meta-Learning, Hyperparameter Optimization (HO), Reinforcement Learning from Human Feedback (RLHF).

πŸ“œ License

MIT License

Copyright (c) 2024 Yaohua Liu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the β€œSoftware”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED β€œAS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.