[Paper Review] Betty: An Automatic Differentiation Library for Multilevel Optimization
Betty is a novel automatic differentiation library for multilevel optimization (MLO) that introduces a dataflow graph abstraction to enable efficient, scalable computation of gradients via chain-ruled composition of best-response Jacobians. It reduces computational complexity from 𝒪(d³) to 𝒪(d²), supports mixed-precision and data-parallel training, and enables end-to-end implementation of complex MLO pipelines with up to 11% higher test accuracy, 14% lower GPU memory usage, and 20% faster training than prior systems.
Gradient-based multilevel optimization (MLO) has gained attention as a framework for studying numerous problems, ranging from hyperparameter optimization and meta-learning to neural architecture search and reinforcement learning. However, gradients in MLO, which are obtained by composing best-response Jacobians via the chain rule, are notoriously difficult to implement and memory/compute intensive. We take an initial step towards closing this gap by introducing Betty, a software library for large-scale MLO. At its core, we devise a novel dataflow graph for MLO, which allows us to (1) develop efficient automatic differentiation for MLO that reduces the computational complexity from O(d^3) to O(d^2), (2) incorporate systems support such as mixed-precision and data-parallel training for scalability, and (3) facilitate implementation of MLO programs of arbitrary complexity while allowing a modular interface for diverse algorithmic and systems design choices. We empirically demonstrate that Betty can be used to implement an array of MLO programs, while also observing up to 11% increase in test accuracy, 14% decrease in GPU memory usage, and 20% decrease in training wall time over existing implementations on multiple benchmarks. We also showcase that Betty enables scaling MLO to models with hundreds of millions of parameters. We open-source the code at https://github.com/leopard-ai/betty.
Motivation & Objective
- To address the major bottlenecks in implementing and scaling gradient-based multilevel optimization (MLO), including complex manual gradient composition and high memory/compute costs.
- To bridge the gap between theoretical MLO research and practical software systems by enabling efficient, modular, and scalable MLO implementation.
- To support arbitrary MLO program structures beyond bilevel optimization, including trilevel and deeper hierarchies.
- To provide systems-level features such as mixed-precision and data-parallel training to reduce memory and computation overhead.
- To enable large-scale MLO applications with hundreds of millions of parameters, previously infeasible with existing libraries.
Proposed method
- Introduces a novel dataflow graph representation of MLO problems, where optimization problems are structured as hierarchical nodes with directed dependencies.
- Employs reverse traversal of the dataflow graph to compute gradients via iterative multiplication of best-response Jacobians, applying the chain rule efficiently.
- Reduces computational complexity of automatic differentiation from 𝒪(d³) to 𝒪(d²) by avoiding redundant Hessian computations and optimizing Jacobian composition.
- Designs a modular software stack in Betty that decouples algorithmic choices (e.g., AID, ITD) from systems optimizations (e.g., mixed-precision, data parallelism).
- Abstracts the one-step gradient descent update into a 'step' function per problem, enabling composable and reusable MLO program construction.
- Integrates with JAX and PyTorch ecosystems to support modern deep learning systems, including automatic differentiation and distributed training.
Experimental results
Research questions
- RQ1Can a dataflow graph abstraction be used to systematically and efficiently compute gradients in multilevel optimization via chain-ruled Jacobian composition?
- RQ2How can automatic differentiation in MLO be optimized to reduce computational complexity from 𝒪(d³) to 𝒪(d²)?
- RQ3Can a software library be designed to support arbitrary MLO program structures beyond bilevel optimization while maintaining modularity and performance?
- RQ4To what extent can systems-level optimizations like mixed-precision and data-parallel training improve scalability and reduce memory usage in MLO?
- RQ5Can the proposed library enable training of MLO models with hundreds of millions of parameters, previously unattainable with existing tools?
Key findings
- Betty reduces the computational complexity of automatic differentiation in MLO from 𝒪(d³) to 𝒪(d²) by efficiently composing best-response Jacobians through reverse traversal of a dataflow graph.
- The library enables up to 11% higher test accuracy on benchmark tasks compared to existing implementations, demonstrating improved optimization stability and convergence.
- Betty reduces GPU memory usage by up to 14% and training wall time by up to 20% on multiple benchmarks, due to optimized gradient computation and systems-level features.
- The library successfully scales MLO to models with hundreds of millions of parameters, enabling previously infeasible large-scale training scenarios.
- Betty supports modular integration of diverse best-response Jacobian algorithms and systems optimizations, such as mixed-precision and data-parallel training, without requiring low-level code changes.
- The open-source release of Betty under Apache-2.0 license includes full implementations of all experiments and example MLO programs, ensuring reproducibility and community extensibility.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.