TorchOpt: An Efficient Library for Differentiable Optimization

Jie Ren, Xidong Feng, Bo Liu, Xuehai Pan, Yao Fu +2 more
11/13/2022
cs.MScs.AIcs.DC

Official code: metaopt/torchopt (639 stars, Python, Apache-2.0, PyTorch, last commit 2026-11-02).

Abstract

Recent years have witnessed the booming of various differentiable optimization algorithms. These algorithms exhibit different execution patterns, and their execution needs massive computational resources that go beyond a single CPU and GPU.

Show full abstract

Existing differentiable optimization libraries, however, cannot support efficient algorithm development and multi-CPU/GPU execution, making the development of differentiable optimization algorithms often cumbersome and expensive. This paper introduces TorchOpt, a PyTorch-based efficient library for differentiable optimization. TorchOpt provides a unified and expressive differentiable optimization programming abstraction. This abstraction allows users to efficiently declare and analyze various differentiable optimization programs with explicit gradients, implicit gradients, and zero-order gradients. TorchOpt further provides a high-performance distributed execution runtime. This runtime can fully parallelize computation-intensive differentiation operations (e.g. tensor tree flattening) on CPUs / GPUs and automatically distribute computation to distributed devices. Experimental results show that TorchOpt achieves $5.2\times$ training time speedup on an 8-GPU server. TorchOpt is available at: https://github.com/metaopt/torchopt/.

View on arXivView PDF

Code Implementations(1)

metaopt/torchoptOfficial100%
PyTorchApache-2.0

TorchOpt is an efficient library for differentiable optimization built upon PyTorch.

63946Python, C++Apr 8, 20224 weeks agoApache-2.0
automatic-differentiationbilevel-optimizationdeep-learningdifferentiable-optimizationdifferentiable-programming+8 more

Similar Papers

Cite this paper

@article{ren2022torchopt,
  title  = {TorchOpt: An Efficient Library for Differentiable Optimization},
  author = {Jie Ren and Xidong Feng and Bo Liu and Xuehai Pan and Yao Fu and Luo Mai and Yaodong Yang},
  year   = {2022},
  eprint = {2211.06934},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.06934}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2211.06934.svg)](https://codeofpaper.com/paper/2211.06934)

Discussion