numpywren: Serverless Linear Algebra at Scale
Abstract Large-scale linear algebra is a cornerstone of modern scientific computing and machine learning, yet executing these operations at scale remains challenging due to the complexities of managing High-Performance Computing (HPC) clusters. This paper introduces numpywren, a system designed to perform massive-scale linear algebra using serverless computing. By decoupling compute from storage and utilizing a novel domain-specific language, LAmbdaPACK, numpywren provides an elastic, fault-tolerant, and cost-effective alternative to traditional static clusters. Our evaluation shows that numpywren achieves performance within 33% of industry-standard libraries like ScaLAPACK while significantly reducing management overhead.
1. Introduction
Traditional large-scale linear algebra relies on HPC clusters or manually configured cloud Virtual Machines (VMs). These environments are often difficult to access or require complex provisioning. A key challenge in linear algebra algorithms, such as Cholesky decomposition, is "oscillating parallelism." These workloads typically begin with a high degree of parallelism that sharply decreases as the computation progresses. In a static cluster, users must choose between over-provisioning for the peak (wasting resources) or under-provisioning (increasing completion time).
2. System Architecture
The numpywren system architecture is built on the principle of decoupling compute from storage. It treats serverless functions (e.g., AWS Lambda) as stateless executors and distributed object stores (e.g., Amazon S3) as a high-bandwidth substitute for distributed memory.
The system consists of several key components:
- Executors: Thousands of short-lived serverless functions that perform the actual computation.
- Object Store: Used to store matrix tiles. While S3 has higher latency than RAM, its massive aggregate bandwidth is sufficient for large-scale matrix operations where $O(n^3)$ computation dominates $O(n^2)$ communication.
- Task Queue and Runtime State: A centralized queue (e.g., AWS SQS) manages task distribution, while a state store (e.g., Redis) tracks the progress of the computation.
3. LAmbdaPACK: Decentralized Dependency Analysis
To avoid the "DAG explosion" problem—where a single master node becomes a bottleneck trying to manage millions of tasks—the authors developed LAmbdaPACK. This domain-specific language (DSL) enables decentralized dependency analysis. Instead of a global scheduler, each worker uses symbolic index expressions to locally compute its own downstream dependencies. This allows a task graph with millions of nodes to be represented in just a few kilobytes, enabling every worker to carry the entire program logic without significant memory overhead.
4. Key Results and Performance
Numpywren was evaluated against fundamental algorithms including GEMM, QR, SVD, and Cholesky decomposition on matrices up to 1M x 1M.
- Performance: For Cholesky decomposition, numpywren's completion time was within 33% to 36% of ScaLAPACK.
- Efficiency: Due to serverless elasticity, numpywren used up to 33% fewer CPU-hours than ScaLAPACK by scaling down resources as parallelism decreased.
- Scalability and Resilience: The system successfully processed a 1Mx1M matrix, a task that often exceeds the memory limits of traditional data-parallel systems like Dask. Furthermore, the stateless nature of executors provides inherent fault tolerance; failed tasks are simply re-queued.
5. Conclusion and Future Work
Numpywren demonstrates that serverless computing is a viable and efficient platform for large-scale linear algebra. While certain algorithms like QR decomposition face challenges due to communication latency (performing 7x slower than ScaLAPACK), the overall benefits in ease of use and cost-efficiency are significant. Future improvements could involve better support for data locality and collective communication primitives within serverless environments.
Summary updated