Differentiable programming enables programs to optimize themselves and is a part of Facebook AI’s broader efforts to build additional advanced machine learning programming tools. Facebook AI is developing an automatic differentiation system for the Kotlin programming language.
The researchers have stated that this work will further explore Software 2.0, where software writes itself effectively. The developers are now allowed to create robust programs by enabling intuitive and performant differentiable programming in Kotlin. These programs are flexible, taking advantage of problem structure while maintaining type safety and keeping debugging simple.
Kotlin is a statically-typed, general-purpose programming language having type inference for JVM, Android, and web development. It was developed by JetBrains, a Czech software company, and was first released in 2011. Google has made Kotlin its preferred programming language for Android app developers.
Differential Programming and Automatic Differentiation
Most code is either written using restrictive machine learning libraries or explicitly programmed using traditional coding paradigms. No true compatibility between these two methods is a significant barrier in achieving Software 2.0. This issue is addressed by differential programming.
Most of the differentiable programming frameworks construct a graph that consists of the program’s control flow and data structures. Arbitrary user and library code are incorporated into further comprehensive models. The developers and professionals can leverage grades to optimize parameterized programs not written with ML libraries automatically.
The automatic differentiation (AD) occurs at compile-time, maintaining program structure such as control flow and function calls. It enables compiler optimizations that would be infeasible with AD at runtime.
The Facebook AI team has built a framework for determining custom differentiable data types and leveraging it to provide a differentiable Tensor class. This framework is built to extend the Kotlin compiler, making differentiability a first-class feature of the Kotlin language. The team states that this will enable users to differentiate through traditional ML models expressed in Kotlin and through arbitrary Kotlin code.
Convolutions and many other deep learning operators involve complex manipulations of multi-dimensional arrays called tensors. Different shape tensors are easily confused without static shape information, leading to runtime errors challenging to debug.
The tensor typing system provides developers with compile-time shape inference and checking. Tensor typing also allows for better code documentation and clarity. Developers can use type annotations as documentation to document the types of tensor inputs that are acceptable and expected. Type aliases and generics can be utilized further to expand code comprehensibility, sharing, and reuse.
The team states that to promote differentiable programming efforts further, Facebook AI will release a user library that takes the most advantage of the AD and tensor typing systems. It also allows engineering professionals and developers to transition from any ML framework onto the Kotlin system easily.