Google Dex language simplifies array math for machine learning

LLVM-powered experimental language for array processing aims for an important corner of the math library space

Google Dex language simplifies array math for machine learning
Getty Images

Engineers at Google have unveiled Dex, a prototype functional language designed for array processing. Array processing is a cornerstone of the math used in machine learning applications and other computationally intensive work.

The chief goal for the Dex language, according to a paper released by Google researchers, is to allow programmers to work efficiently and concisely with arrays using a compact, functional syntax.

Existing math-and-stats languages and libraries, such as MATLAB and NumPy, already have widely used array processing techniques and syntaxes, as do more general purpose languages such as Fortran and C. But the paper’s authors were unhappy with the “obfuscated” feel of the former and the “heaviness” of the latter.

Dex, patterned after the Haskell and ML family of languages, uses type information to make writing code for processing arrays both succinct and explicit. Introductory Dex examples show how the type system works with both regular values (integers and reals) and arrays. Other examples show how to express common problems such as estimating pi or plotting a Mandelbrot fractal.

Like Python or the R language, Dex can run prewritten programs from the CLI, interactively in a REPL, or by way of a notebook-style interface. The current prototype supports all three modes.

Dex uses the LLVM language-compiler framework, which powers many general-purpose languages like Rust and Swift. LLVM is also proving useful for constructing domain-specific languages, or DSLs—languages designed to ease the handling of a deliberately small set of tasks. Other LLVM-powered DSL projects for computational work include DLVM, a compiler for DSLs used in neural networks; and Triton, an intermediate language and compiler used for tiled neural networks.

Dex is still early-stage experimental and not officially supported by Google in any capacity. The largest still-missing piece is integration with other languages, where Dex could be used for offloading computationally intensive work (for instance, as libraries like Numba do for Python). The Dex project, which is licensed under the BSD 3-clause license, welcomes contributions and collaboration.