Differentiable programming is a programming paradigm in which a numeric computer program can be differentiated throughout via automatic differentiation.[1][2][3][4] This allows for gradient based optimization of parameters in the program, often via gradient descent. Differentiable programming has found use in a wide variety of areas, particularly scientific computing and artificial intelligence.[4]
Approaches
Most differentiable programming frameworks work by constructing a graph containing the control flow and data structures in the program.[5] Earlier attempts generally fall into two groups:
Static, compiled graph based approaches such as TensorFlow,[note 1]Theano, and MXNet. They tend to allow for good compiler optimization and easier scaling to large systems, but their static nature limits interactivity and the types of programs that can be created easily (e.g. those involving loops or recursion), as well as making it harder for users to reason effectively about their programs.[5][6][7]
Operator overloading, dynamic graph based approaches such as PyTorch and AutoGrad. Their dynamic and interactive nature lets most programs be written and reasoned about more easily. However, they lead to interpreter overhead (particularly when composing many small operations), poorer scalability, and struggle to gain benefit from compiler optimization.[6][7][4]
Both of these early approaches are only able to differentiate code written in a suitable manner for the framework, limiting their interoperability with other programs.
A more recent package for the Julia programming language – Zygote – resolves the issues that earlier attempts faced by treating the language's syntax as the graph. The intermediate representation of arbitrary code can then be differentiated directly, optimized, and compiled.[5][8]
A programming language "currently under development and is not yet ready for use" called Myia[6] allows defining a model using a subset of Python, which is compiled to Myia.
Applications
Differentiable programming has been applied in areas such as combining deep learning with physics engines in robotics, solving electronic structure problems with differentiable density functional theory, differentiable ray tracing, image processing, and probabilistic programming.[9][10][11][12][13][4]
^ abcdInnes, Mike; Edelman, Alan; Fischer, Keno; Rackauckas, Chris; Saba, Elliot; Viral B Shah; Tebbutt, Will (2019), ∂P: A Differentiable Programming System to Bridge Machine Learning and Scientific Computing, arXiv:
^Degrave, Jonas; Hermans, Michiel; Dambre, Joni; wyffels, Francis (2016-11-05). "A Differentiable Physics Engine for Deep Learning in Robotics". arXiv: [cs.NE].