Saved in:
Bibliographic Details
Main Authors: Liang, Chen, Wang, Qian, Xu, Andy, Rakita, Daniel
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2504.15976
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912341095874560
author Liang, Chen
Wang, Qian
Xu, Andy
Rakita, Daniel
author_facet Liang, Chen
Wang, Qian
Xu, Andy
Rakita, Daniel
contents The Rust programming language is an attractive choice for robotics and related fields, offering highly efficient and memory-safe code. However, a key limitation preventing its broader adoption in these domains is the lack of high-quality, well-supported Automatic Differentiation (AD)-a fundamental technique that enables convenient derivative computation by systematically accumulating data during function evaluation. In this work, we introduce ad-trait, a new Rust-based AD library. Our implementation overloads Rust's standard floating-point type with a flexible trait that can efficiently accumulate necessary information for derivative computation. The library supports both forward-mode and reverse-mode automatic differentiation, making it the first operator-overloading AD implementation in Rust to offer both options. Additionally, ad-trait leverages Rust's performance-oriented features, such as Single Instruction, Multiple Data acceleration in forward-mode AD, to enhance efficiency. Through benchmarking experiments, we show that our library is among the fastest AD implementations across several programming languages for computing derivatives. Moreover, it is already integrated into a Rust-based robotics library, where we showcase its ability to facilitate fast optimization procedures. We conclude with a discussion of the limitations and broader implications of our work.
format Preprint
id arxiv_https___arxiv_org_abs_2504_15976
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle ad-trait: A Fast and Flexible Automatic Differentiation Library in Rust
Liang, Chen
Wang, Qian
Xu, Andy
Rakita, Daniel
Robotics
The Rust programming language is an attractive choice for robotics and related fields, offering highly efficient and memory-safe code. However, a key limitation preventing its broader adoption in these domains is the lack of high-quality, well-supported Automatic Differentiation (AD)-a fundamental technique that enables convenient derivative computation by systematically accumulating data during function evaluation. In this work, we introduce ad-trait, a new Rust-based AD library. Our implementation overloads Rust's standard floating-point type with a flexible trait that can efficiently accumulate necessary information for derivative computation. The library supports both forward-mode and reverse-mode automatic differentiation, making it the first operator-overloading AD implementation in Rust to offer both options. Additionally, ad-trait leverages Rust's performance-oriented features, such as Single Instruction, Multiple Data acceleration in forward-mode AD, to enhance efficiency. Through benchmarking experiments, we show that our library is among the fastest AD implementations across several programming languages for computing derivatives. Moreover, it is already integrated into a Rust-based robotics library, where we showcase its ability to facilitate fast optimization procedures. We conclude with a discussion of the limitations and broader implications of our work.
title ad-trait: A Fast and Flexible Automatic Differentiation Library in Rust
topic Robotics
url https://arxiv.org/abs/2504.15976