Introducing ‘DiffTaichi’ — A Differentiable Programming Language Tailored for Physical Simulation Synced Follow Jan 13 · 3 min read

In November 2019 researchers from MIT’s Computer Science and Artificial Intelligence Laboratory and the UC Berkeley introduced Taichi, a new data-oriented programming language embedded in C++14 and designed for efficiently authoring, accessing, and maintenance of high-performance sparse data structures. In December the same researchers teamed up with Adobe Research to propose DiffTaichi, a new differentiable programming language based on Taichi and specially tailored for building high-performance differentiable physical simulators.

The DiffTaichi automatic differentiation system is designed to accommodate key language features required in physical simulation but often missing in existing differentiable programming tools — such as megakernels, imperative parallel programming and flexible indexing. The researchers say a differentiable elastic object simulator written in DiffTaichi is 4.2× shorter than a hand-engineered CUDA version, yet runs just as fast; and is a whopping 188× faster than a TensorFlow implementation.

DiffTaichi enables researchers to quickly implement and automatically differentiate on 10 open-sourced physical simulators, applying various effects on either simple or complex scenes, including those containing multiple objects.

The differentiable water renderer for example comprises a differentiable water simulation, differentiable water rendering and a (differentiable) convolutional neural network. Researchers illustrated their system’s effectiveness through adversarial optimization: the water renderer fooled the VGG-16 network into misidentifying photos of squirrels as goldfish.

Water renderer center activation (left) and an activation (right) that fooled VGG into misclassifying a squirrel as a goldfish

Differentiable Billiard Simulator — Gradient descent iteration 0 and gradient descent iteration 100

Differentiable Elastic Object Simulator — Gradient descent iteration 0 and gradient descent iteration 80

Differentiable Elastic Object Simulator (3D) — Gradient descent iteration 40

Differentiable Liquid Simulator (3D) — Gradient descent iteration 450

Differentiable Height Field Water Simulator — Gradient descent iteration 180

Differentiable Rigid Body Simulator — 2048 time steps. Gradient descent iteration 20

Differentiable Mass-Spring Simulator — 682 time steps. Gradient descent iteration 20

Differentiable Incompressible Fluid Simulation — 100 time steps. Gradient descent iteration 200

Differentiable Volume Renderer — 3 target images (left); optimized images of the middle bunny after iterations 2, 50, 100 (right).

Differentiable Electric Field Simulation — The eight electrodes (yellow) adjust their charge strength to repulse the red ball so it follows the blue dot.

The researchers hope DiffTaichi’s impressive performance will encourage machine learning and robotics researchers to apply the new programming language in future studies on differentiable physical simulation.

The paper DiffTaichi: Differentiable Programming for Physical Simulation is on arXiv. The project code is available on GitHub.