Skip to main content
QUICK REVIEW

[Paper Review] SymJAX: symbolic CPU/GPU/TPU programming

Randall Balestriero|arXiv (Cornell University)|May 21, 2020
Music and Audio ProcessingComputer Science5 references4 citations
TL;DR

SymJAX is a symbolic programming framework built on JAX and XLA that enables efficient, optimized computation graphs for CPU, GPU, and TPU by fusing kernels, reducing memory operations, and supporting automatic differentiation. It provides a high-level, PyTorch-like API for deep learning with just-in-time compilation and broad hardware support, demonstrating performance gains through graph optimization and symbolic computation.

ABSTRACT

SymJAX is a symbolic programming version of JAX simplifying graph input/output/updates and providing additional functionalities for general machine learning and deep learning applications. From an user perspective SymJAX provides a la Theano experience with fast graph optimization/compilation and broad hardware support, along with Lasagne-like deep learning functionalities.

Motivation & Objective

  • To provide a symbolic programming interface for deep learning that simplifies graph construction, input/output handling, and parameter updates.
  • To optimize computational graphs by fusing multiple kernels into single operations, reducing memory transfers and boosting performance.
  • To support efficient, just-in-time compilation and automatic differentiation across CPU, GPU, and TPU hardware via XLA.
  • To offer a high-level, intuitive API resembling PyTorch while retaining the performance and compilation benefits of JAX.
  • To enable end-to-end training and inference pipelines with built-in support for optimizers, loss functions, and layer components.

Proposed method

  • Uses symbolic tensors (via JAX's XLA backend) to represent computations, enabling static graph construction and optimization.
  • Employs kernel fusion through XLA to merge operations, minimizing intermediate memory allocations and improving execution speed.
  • Integrates just-in-time (JIT) compilation via JAX's XLA compiler to accelerate computation graphs.
  • Supports automatic differentiation through SymJAX's gradients function, enabling backpropagation on symbolic expressions.
  • Provides a functional API via `sj.function` to compile and execute graphs with specified outputs and updates.
  • Offers modular neural network components (e.g., Conv2D, BatchNorm, ReLU) through `sj.layers` and `sj.optimizers` for model building.

Experimental results

Research questions

  • RQ1Can a symbolic programming interface built on JAX and XLA achieve high performance and ease of use comparable to PyTorch while supporting multiple accelerators?
  • RQ2How effective is kernel fusion in reducing memory operations and improving inference and training speed in deep learning workloads?
  • RQ3To what extent can symbolic computation with automatic differentiation be made user-friendly and composable for complex deep learning models?
  • RQ4How does the integration of XLA-based compilation and JIT compilation improve the performance of deep learning models across CPU, GPU, and TPU?
  • RQ5Can a high-level, PyTorch-like API be built on top of JAX with minimal performance overhead and full support for optimization and differentiation?

Key findings

  • SymJAX successfully compiles and optimizes a multivariate Gaussian PDF computation, achieving lazy evaluation and correct output with symbolic tensor operations.
  • In a stochastic gradient descent experiment, SymJAX correctly computes gradients and updates parameters, with loss decreasing from ~0.00847 to ~0.0065 over 10 iterations.
  • On CIFAR-10, SymJAX-trained models achieve a test loss of ~0.815 and test accuracy of ~72.1% after 100 epochs, demonstrating effective training with optimized computation.
  • The framework supports complex model architectures, including convolutional, batch normalization, pooling, and fully connected layers, with correct shape propagation and parameter tracking.
  • The use of `sj.function` enables efficient compilation and execution of graphs with updates, as shown in the training loop where loss and accuracy are tracked per epoch.
  • Kernel fusion and JIT compilation significantly reduce memory operations and improve performance, as evidenced by the efficient execution of the CIFAR-10 training pipeline.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.