Hardware-Aware Compression with Random Operation Access Specific Tile (ROAST) Hashing

Aditya Desai, Keren Zhou, Anshumali Shrivastava

TL;DR

ROAST (Random Operation Access Specific Tile) is a hardware-aware model compression technique that reduces memory footprints by 10–100× during both training and inference. By utilizing tile-based hashing and global weight sharing, it achieves up to 50× speedups over previous parameter-sharing methods while maintaining high accuracy on tasks like text and image classification.

What Problem Does This Paper Address?

Deep learning models are exploding in size. State-of-the-art (SOTA) architectures like BERT or industrial recommendation systems can range from hundreds of millions to trillions of parameters, requiring massive distributed hardware setups and incurring enormous costs.

While model compression is a popular research area, existing methods have significant gaps:

  • Pruning: Often only reduces memory for inference; the full model is still needed during the memory-intensive training phase.
  • Quantization: Generally hits a "compression ceiling" around 32×.
  • Parameter Sharing (e.g., HashedNet): While it reduces memory during training, it is notoriously "cache-inefficient." It uses random memory lookups that cause "cache trashing," making it significantly slower than standard uncompressed operations.
Comparison of compression techniques

The authors of this paper sought a "holy grail" of compression: a method that is model-agnostic, reduces memory during training, provides arbitrary control over memory size, and—crucially—is fast on actual hardware.

Methods

The core innovation is ROAST Hashing. Instead of hashing individual weights to a shared array (which causes random memory access), ROAST hashes tiles or chunks of weights.

ROAST tile-based hashing mechanism
  1. Tile-Based Hashing: By aligning the memory access pattern of the algorithm (like matrix multiplication) with the parameter access pattern, ROAST ensures that data is fetched in "coalesced" blocks. This plays nicely with GPU cache hierarchies, drastically reducing latency.
  2. Global Memory Sharing (GMS): Unlike previous methods that gave each layer its own independent pool of shared parameters (Local Memory Sharing), ROAST uses a single global array for the entire model.
  3. Scaling Factors: To handle the fact that different layers need different weight initializations (e.g., Xavier initialization), ROAST applies a module-specific scaling factor ($\lambda$) to the recovered weights.
  4. Custom Kernels: The authors implemented ROAST using Triton, a language for writing highly efficient GPU kernels, allowing them to bypass the limitations of standard deep learning libraries that don't support custom tile-loading.

Datasets

The researchers evaluated ROAST across several standard benchmarks:

  • NLP (Text Classification): amazon-polarity (3.6M samples) and yelp-polarity (560K samples) using BERT architectures.
  • Computer Vision (Image Classification): CIFAR-10 using a ResNet-9 architecture.
  • ImageNet: Preliminary results on ImageNet with ResNet-50.

Key Insights and Ideas

  • Cache Locality is King: The paper demonstrates that the bottleneck in parameter-sharing isn't the computation, but the memory movement. By moving from element-wise hashing to block-based hashing, they transformed a "slow" theoretical idea into a "fast" practical tool.
  • The Power of Global Sharing: The authors provide a theoretical proof showing that Global Memory Sharing (GMS) is superior to Local Memory Sharing (LMS). Sharing weights across the entire model reduces the variance of the weight approximations, leading to more stable training and better final accuracy.
  • Training-Time Savings: Because ROAST never instantiates the full weight matrix, it allows researchers to train massive models on hardware that would otherwise be too small (e.g., fitting a model that usually requires 8 GPUs onto a single GPU).

Key Results

  • Speed: ROAST is up to 25× faster to train and 50× faster for inference than HashedNet for large matrix multiplications.
  • Memory Reduction:
    • They trained a BERT model with 100× less memory without losing quality on text classification tasks.
  • A ResNet-9 model was trained with 10× less memory on CIFAR-10 while maintaining target accuracy.
  • Efficiency: The ROAST matrix multiplication kernel is only ~1.34× slower than the gold-standard, highly optimized cuBLAS library used by PyTorch, which is a remarkable feat for a custom compressed kernel.
  • Convergence: Models using Global Memory Sharing (GMS) converged faster and to higher accuracies than those using local sharing.

Limitations and Future Work

  • Architecture Scope: The current evaluation focuses primarily on encoder-based architectures (Transformers and ResNets). The authors note that more evaluation is needed on encoder-decoder models (like T5 or BART).
  • FLOPs vs. Memory: While ROAST drastically reduces the memory footprint, it does not necessarily reduce the number of floating-point operations (FLOPs). In fact, the hashing adds a slight computational overhead. Future work could explore combining ROAST with methods that also reduce total computation.
  • Optimization: While the Triton implementation is efficient, the authors believe further low-level hardware optimization could close the remaining 1.34× performance gap with standard uncompressed libraries.

Summary updated

BibTeX
@inproceedings{desai2023hardware,
  author = {Aditya Desai and Keren Zhou and Anshumali Shrivastava},
  title = {{Hardware-Aware Compression with Random Operation Access Specific Tile (ROAST) Hashing}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=kvvHeldUfw},
}
Figure