Section: Research Program
Automatic Differentiation
Participants : Laurent Hascoet, Valérie Pascual, Ala Taftaf.
-
Glossary
- automatic differentiation
(AD) Automatic transformation of a program, that returns a new program that computes some derivatives of the given initial program, i.e. some combination of the partial derivatives of the program's outputs with respect to its inputs.
- adjoint
Mathematical manipulation of the Partial Derivative Equations that define a problem, obtaining new differential equations that define the gradient of the original problem's solution.
- checkpointing
General trade-off technique, used in adjoint-mode AD, that trades duplicate execution of a part of the program to save some memory space that was used to save intermediate results.
Automatic or Algorithmic Differentiation (AD) differentiates programs. An AD tool takes as input a source program that, given a vector argument , computes some vector result . The AD tool generates a new source program that, given the argument , computes some derivatives of . The resulting reuses the control of .
For any given control, is equivalent to a sequence of instructions, which is identified with a composition of vector functions. Thus, if
where each is the elementary function implemented by instruction . AD applies the chain rule to obtain derivatives of . Calling the values of all variables after instruction , i.e. and , the chain rule gives the Jacobian of
which can be mechanically written as a sequence of instructions . Combining the with the control of yields . This is therefore a piecewise differentiation, which can be generalized to higher level derivatives, Taylor series, etc.
In practice, many applications only need cheaper projections of such as:
-
Sensitivities, defined for a given direction in the input space as:
Sensitivities are easily computed from right to left, interleaved with the original program instructions. This is the tangent mode of AD.
-
Adjoints, defined after transposition (), for a given weighting of the outputs as:
Adjoints are most efficiently computed from right to left, because matrixvector products are cheaper than matrixmatrix products. This is the adjoint mode of AD, most effective for optimization, data assimilation [31] , adjoint problems [25] , or inverse problems.
Adjoint-mode AD turns out to make a very efficient program, at least theoretically [28] . The computation time required for the gradient is only a small multiple of the run-time of . It is independent from the number of parameters . In contrast, computing the same gradient with the tangent mode would require running the tangent differentiated program times.
However, the are required in the inverse of their computation order. If the original program overwrites a part of , the differentiated program must restore before it is used by . Therefore, the central research problem of adjoint-mode AD is to make the available in reverse order at the cheapest cost, using strategies that combine storage, repeated forward computation from available previous values, or even inverted computation from available later values.
Another research issue is to make the AD model cope with the constant evolution of modern language constructs. From the old days of Fortran77, novelties include pointers and dynamic allocation, modularity, structured data types, objects, vectorial notation and parallel communication. We keep extending our models and tools to handle new constructs.