TL;DR
The authors introduce a new Bundle Adjustment (BA) library that brings high-performance, sparse optimization directly into PyTorch’s "eager mode." By combining a sparsity-aware auto-differentiation design with GPU-accelerated sparse operations, they achieve up to a 23× speedup over traditional C++ libraries like Ceres while requiring 80% less user code.
What Problem Does This Paper Address?
Bundle Adjustment (BA) is the "bread and butter" of 3D vision, used to refine camera poses and 3D points in applications like SLAM and Augmented Reality. As deep learning becomes central to perception, researchers increasingly need to integrate BA directly into neural network training pipelines.
However, a major friction point exists: traditional BA powerhouses (GTSAM, Ceres, g2o) are written in C++ and rely on static graphs. Integrating them with PyTorch is clunky, often requiring slow data transfers between CPU and GPU and complex "boilerplate" code. While some Python-based libraries exist, they often sacrifice the "eager mode" flexibility—the ability to execute code line-by-line and debug dynamically—that made PyTorch popular in the first place. The core challenge is that PyTorch’s standard auto-differentiation (AutoDiff) is designed for dense matrices; applying it to the massive, sparse matrices found in BA problems would instantly crash a GPU's memory.
Methods
The paper proposes an eager-mode BA library that is both flexible and fast. Its architecture rests on three pillars:
- Sparsity-Aware AutoDiff: The library uses a Directed Acyclic Graph (DAG) to automatically trace data flow during the forward pass. It distinguishes between "indexing operations" (which define where non-zero blocks go in a matrix) and "arithmetic operations" (which calculate the values). This allows it to compute only the necessary parts of the Jacobian, avoiding the memory explosion of dense computations.
- GPU-Accelerated Sparse Algebra: Since PyTorch has limited native support for certain sparse operations, the authors implemented custom CUDA and Triton kernels for Block Sparse Row (BSR) matrix multiplication and diagonal scaling.
- Efficient Solvers: The library includes both a Sparse Direct Solver (Cholesky) for small-to-medium problems and a Preconditioned Conjugate Gradient (PCG) solver for massive ones. They even use "CUDA graphs" to record and replay GPU operations, stripping away the overhead of the Python interpreter during iterative optimization.
Datasets
The framework was evaluated on a wide variety of standard benchmarks:
- BAL (Bundle Adjustment in the Large): The gold standard for BA performance.
- 1DSfM: Large-scale structure-from-motion data from internet photo collections.
- CO3D v2: A massive dataset of multi-view object videos.
- KITTI360 & ETH3D-SLAM: Used to test integration with self-supervised feature matching pipelines.
Key Insights and Ideas
- Eager Mode is Not a Performance Death Sentence: The most surprising finding is that a Python-based eager-mode library can actually outperform highly optimized C++ libraries. By keeping data on the GPU and using specialized sparse kernels, the "Python tax" becomes negligible compared to the gains in parallelization.
- 80% Less Coding: The "Ours" data point in Figure 1 shows a dramatic shift toward the "Lower is Better" corner. This suggests that the library significantly lowers the barrier to entry for researchers who want to experiment with custom loss functions or dynamic optimization logic without writing thousands of lines of C++.
- Generalization to PGO: The authors showed their BA framework generalizes seamlessly to Pose Graph Optimization (PGO), achieving an 8.8× speedup over Ceres on synthetic datasets. This proves their approach is a general-purpose solution for sparse non-linear least squares.
Key Results
- Massive Speedups: On the BAL dataset, the library achieved average speedups of 18.5×, 22×, and 23× compared to GTSAM, g2o, and Ceres, respectively.
- Exponential Scalability: As the number of optimizable parameters grows, the performance gap widens. For the largest problems, the speedup reached over 160× compared to traditional CPU-based solvers.
- Plug-and-Play Integration: When swapped into state-of-the-art deep learning SfM pipelines (like VGGT), it reduced optimization time from 1.8s to 0.7s while maintaining identical accuracy.
Limitations and Future Work
While the results are impressive, the authors note a few areas for improvement:
- GPU Dependency: The current implementation is heavily optimized for GPUs. On systems without a powerful GPU, traditional CPU-based libraries might still be competitive.
- Memory Overhead: Python’s dynamic memory management and garbage collection result in higher memory overhead than statically compiled C++ code.
- Expanding the Toolkit: The authors plan to expand support to other frameworks like JAX and add more optimization templates, such as Dogleg or L-BFGS, to support a broader range of robotics tasks like motion planning.
Summary updated