Coarse Grain Automatic Differentiation: A Practical Approach to Fast and Exact Computation of First and Second Order Derivatives in Software
27 Pages Posted: 9 Feb 2017 Last revised: 27 Nov 2017
Date Written: November 23, 2017
The evaluations done by a program at runtime can be modeled by computational Directed Acyclic Graphs (DAGs) at various abstraction levels.
Applying the multivariate chain rule on those computational DAGs enables the automation of total derivatives computation, which is exploited at a fine-grain level by Automatic Differentiation (AD).
Coarse Grain Automatic Differentiation (CGAD) is a framework that exploits this principle at a higher level, leveraging on software domain model.
All nodes in the computational DAG are responsible for computing local partial derivatives with respect to their direct dependencies while the CGAD framework is responsible for composing them into first and second order total derivatives.
This separation of concerns between local and global computations offers several key software engineering advantages:
It eases integration, makes the system decoupled and inherently extensible and allows hybrid differentiation (i.e. connecting derivatives from different sources using different calculation methods and different languages in the same evaluation).
Additionally, the nodes can take advantage of local symbolic differentiation to significantly speed up total derivatives computation, compared to traditional differentiation approaches.
As a concrete application of this methodology to a financial software context, we present a Java implementation that computes the premiums and 82 first and second order total derivatives of 2000 call options in 262 milliseconds, with a time ratio of 1:2.2 compared to premiums alone.
Keywords: CGAD, AD, automatic differentiation, coarse grain, chain rule, abstraction level, modularity, hybrid, parallel, bauer, computational, graph, DAG, derivative
JEL Classification: C02, C63
Suggested Citation: Suggested Citation