Editor’s introduction
The study assessed several centralized parallel stochastic gradient descent (SGD) algorithms on the UPMEM PIM system, measuring performance, accuracy, and scalability during ML training on large datasets. It found that the PIM system can match or exceed CPU and GPU performance for memory-bound workloads when operations are natively supported. These findings suggest that optimization algorithms must be tailored to PIM hardware characteristics to achieve optimal performance. The research emphasizes the need for algorithm-hardware co-design in future PIM systems to address scalability and efficiency challenges in distributed machine learning training.
Introduction
Stochastic Gradient Descent (SGD) is perhaps the most important and commonly deployed optimization algorithm for modern Machine Learning (ML) training. SGD is the main building block of most centralized and decentralized optimization algorithms that have been introduced to accommodate the continuously increasing demand for scalability and high-performance training of ML models on large-scale datasets.
Training ML models on growing datasets is a time-consuming task that demands both high computational power and memory bandwidth. The low data reuse during ML training on large-scale datasets leads to poor data locality. As a result, processor-centric architectures (e.g., CPU, GPU) commonly used by the ML community repeatedly need to move training samples between the processor and off-chip memory. This not only degrades performance but is also a major source of the overall system’s energy consumption. This phenomenon is referred to as the data movement bottleneck, which is common in data-intensive workloads. ML training is a prominent example of such workloads.
Processing-In-Memory (PIM) is a promising way to alleviate the data movement bottleneck by placing the computation mechanisms inside or near memory units. PIM, an idea proposed several decades ago, is a memory-centric computation paradigm that has recently gained traction in both academia and industry; some commercial PIM systems and prototypes have recently been developed by industry.
Several prior works explore the effectiveness of using PIM for fundamentally improving ML training performance and energy efficiency. However, none of these prior works provide a comprehensive evaluation on real-world general-purpose PIM architectures. To our knowledge, there is only one prior work on training and evaluating ML models on a real-world PIM system using Gradient Descent (GD). Unfortunately, GD-based algorithms are not widely used in modern ML. SGD is a simplification of GD: in each iteration, only stochastic gradients instead of the full gradient need to be computed. Since stochastic gradients are, in general, significantly more efficient to compute compared to full gradients, SGD alleviates the computational bottleneck of computing the full gradient by approximating the expected gradient with an unbiased estimate. Variants of SGD such as mini-batch SGD allow for parallelization by batching (in each iteration) the training samples whose gradients can be computed independently. We focus on popular SGD-based algorithms due to their effectiveness, simplicity, and generalization performance (i.e., test performance on unseen data).
Models, ML Training, Regularization & Algorithms
Models. Two of the most commonly trained linear binary classification models for convex optimization tasks are: 1) Logistic Regression (LR) with Binary Cross Entropy Loss (BCE), and 2) Support Vector Machines (SVM) with Hinge Loss. Each model consists of a linear layer and a bias.
Algorithms. Stochastic Gradient Descent (SGD) is perhaps the most important and commonly deployed optimization algorithm for modern Machine Learning (ML) training. In each iteration, SGD computes a stochastic gradient and updates the model. SGD is a simplification of GD: in each iteration, only stochastic gradients instead of the full gradient need to be computed. Since stochastic gradients are, in general, significantly more efficient to compute compared to full gradients, SGD alleviates the computational bottleneck of computing the full gradient by approximating the expected gradient with an unbiased estimate. Variants of SGD such as mini-batch SGD allow for parallelization by batching the training samples in each iteration whose gradients can be computed independently.
We provide background on three widely used centralized optimization algorithms for training both LR and SVM: 1) mini-batch Stochastic Gradient Descent with Model Averaging (MA-SGD), 2) mini-batch Stochastic Gradient Descent Gradient Averaging (GA-SGD), and 3) distributed Alternating Direction Method of Multipliers (ADMM). These algorithms are based on a parameter server, i.e., a central node responsible for synchronization and updating the global model, and several workers among which the training dataset is evenly partitioned.
In MA-SGD, every worker trains a local model using the mini-batch SGD optimization algorithm independently and in parallel. Each worker processes several mini-batches, updating its local model before synchronization on the parameter server where the models are averaged. Then, the averaged model, i.e., the global model, is broadcast back to the workers, and each worker continues training with mini-batch SGD starting from the global model. There exists a one-shot averaging variant of the MA-SGD algorithm, where models are averaged after each worker has processed its entire partition of the training data. Although one-shot averaging reduces communication, it has been shown that increasing the model averaging frequency leads to a higher convergence rate.
UPMEM PIM System Architecture
The MRAM implements a standard JEDEC DDR4 DRAM interface that can be accessed by the host CPU. The DPU has an SRAM Instruction Memory, a 64KB SRAM Working Memory (WRAM), and an in-order fine-grained multi-threaded pipeline with 11 stages and supports 24 hardware threads. It implements a 32-bit RISC-based Instruction Set Architecture (ISA) with native support for 32-bit integer additions/subtractions and 8-bit integer multiplications. Other more complex arithmetic operations (e.g., integer divisions and floating-point operations) are emulated through software. The DPU does not have a cache but uses the WRAM as a scratchpad memory.
Each DPU has exclusive access to its MRAM (with respect to other DPUs) through a high-bandwidth (up to 0.7GB/s per DPU) internal data bus. There are no direct communication channels among DPUs within an UPMEM PIM chip. All inter-DPU communications are done through the host CPU (i.e., the host CPU first gathers data from the DPUs’ MRAM into the system’s main memory and then distributes the data from the main memory to the DPUs’ MRAM).
PIM Programming and Execution Model. DPU programs are written in the C programming language with the UPMEM SDK and runtime libraries. The execution model of a DPU is based on the Single-Program Multiple-Data (SPMD) paradigm. Each DPU runs multiple (up to 24) software threads, called tasklets, which execute the same code but operate on different data. Each tasklet has its own control flow, independent from other tasklets. Tasklets are assigned to DPUs statically by the programmer during compile-time. Tasklets assigned to the same DPU share MRAM and WRAM.
Motivation
Stochastic Gradient Descent (SGD) is one of the most important optimization algorithms and the basis of many distributed optimization algorithms. However, SGD is memory-bound, which poses a fundamental challenge for processor-centric architectures (e.g., CPU, GPU). SGD’s memory-boundedness is attributed to large training dataset size, leading to decreased cache efficiency and low data reuse of training samples during ML training, which results in performance degradation. The increasing discrepancy in performance between fast processors and slow memory units exacerbates this problem. PIM is a promising way to alleviate the data movement bottleneck and is a promising paradigm to efficiently execute ML training workloads.
There are several prior proposals on PIM acceleration for ML training. However, none of these prior works provide a comprehensive evaluation on real-world general-purpose PIM systems. To our knowledge, there is only one prior work on training and evaluating ML models on a real-world PIM system (i.e., UPMEM) using Gradient Descent (GD). In this work, we examine popular SGD-based algorithms due to their better effectiveness, simplicity, and generalization performance. We specifically address the resemblance of the UPMEM PIM system to a distributed system with the host CPU as the central node, i.e., the parameter server.
UPMEM PIM System Implementation
Data Partitioning. For both MA-SGD and ADMM, each DPU’s partition consists of multiple mini-batches of the entire training data. For GA-SGD, each partition consists of a fraction of all the mini-batches of the training data (i.e., different DPUs get different fractions of the same mini-batches).
Synchronization. For MA-SGD, each DPU only processes one mini-batch from its assigned training data partition and updates its local model before synchronization (i.e., model averaging) on the host. Doing so leverages the fact that increasing model averaging frequency leads to a higher convergence rate at the cost of higher communication overhead. For GA-SGD, each DPU computes intermediate gradients from its assigned fraction of one mini-batch before synchronization (i.e., gradient averaging) on the host. A larger batch size leads to a higher number of samples to be processed by the DPU before synchronization (i.e., less communication overhead) with the host CPU. For ADMM, each DPU processes all assigned mini-batches and updates its local model for every mini-batch. ADMM only synchronizes the local models on the host once after the DPUs finish processing all their assigned training data, making it attractive for distributed ML due to the low communication overhead compared to MA-SGD and GA-SGD.
Baseline Implementations
CPU Baseline Implementation. We implement our CPU baselines using PyTorch. We implement three distributed optimization algorithms, MA-SGD, GA-SGD, and ADMM, to train LR and SVM models, using the optimizers and communication libraries provided by PyTorch. We consider each CPU thread as a worker in the distributed optimization algorithms.
GPU Baseline Implementation. We implement our GPU baselines using PyTorch. We only implement mini-batch SGD on the GPU because PyTorch does not provide a way to limit the amount of GPU resources the kernels use, causing model averaging to be serialized on a single GPU. For fair comparison, we do not use a cluster of GPUs for our baseline because the UPMEM PIM system is a single-server node.22 2 A multi-GPU system can be compared with a multi-UPMEM PIM system, which we leave for future work.
Experiment Implementation Details
Data Format. Quantization is a popular approach used in the ML community to enable fixed-point operations. We conduct ML training on the real-world UPMEM PIM system on quantized training data and models. Both data and models are represented using a 32-bit fixed-point format because the UPMEM PIM system does not natively support floating-point operations. We use the FP32 floating-point format for our CPU and GPU baselines because 1) CPUs and GPUs natively support it and 2) it provides higher accuracy.
Initialization. For both the UPMEM PIM system implementation and the CPU/GPU baselines, the training data and model weights initially reside in main memory. For the UPMEM PIM system and GPU experiments, the initialization phase includes transferring the data from the main memory to the PIM DRAM bank and the GPU global memory.
Evaluation
PIM Performance Breakdown. To understand key characteristics of distributed ML on the UPMEM PIM system using 2048 DPUs, we break the training time of one global epoch down into 1) communication and synchronization between PIM and the parameter server (Comm./Sync. Para. Server, i.e., the fraction of training time for communicating gradients and models, and worker synchronization; see §3 for details), 2) PIM computation time (PIM Comp., i.e., the fraction of training time to execute arithmetic operations by UPMEM PIM processing units), and 3) PIM data movement time (i.e., the fraction of training time for data movement between MRAM and WRAM).
Algorithm Selection. To show that it is important to carefully choose the distributed optimization algorithm that best fits the UPMEM PIM system, we compare the total training time and the test accuracy (AUC score; see §4.4) to perform ML training on the dataset YFCC100M-HNfc6 (Criteo) for several combinations of models (i.e., LR, SVM), algorithms (i.e., MA-SGD, GA-SGD, ADMM, mini-batch SGD), and architectures (i.e., UPMEM PIM system, CPU baseline system, and GPU baseline system).
Batch Size. We study the impact of the batch size on performance in terms of total training time and the test accuracy (AUC score) to perform ML training on the dataset YFCC100M-HNfc6 (Criteo). We analyze several batch sizes on the UPMEM PIM system and the CPU baseline system. We only implement mini-batch SGD on the GPU because PyTorch does not provide a way to limit the amount of GPU resources the kernels use, causing model averaging to be serialized on a single GPU (see §4.2).
Evaluation of YFCC100M-HNfc6
Only for GA-SGD, for both the UPMEM PIM system and the CPU baseline system, we observe a significant reduction in total training time as we increase the batch size, while jointly, the test accuracy only slightly degrades. This behavior is explained by the reduction of communication for larger batch sizes since each DPU/CPU thread can process more samples before gradients need to be collected and the model is updated. GA-SGD’s test accuracy is less sensitive to increasing batch size because GA-SGD has only one model (see Obsv. 5.1 for more details).
Implications for PIM Hardware Design
Our evaluation (§5) demonstrates that a real-world PIM system (i.e., UPMEM) can be a viable alternative to state-of-the-art processor-centric architectures (e.g., CPU, GPU) for memory-bound ML training workloads involving large-scale datasets if 1) the optimization algorithms are carefully chosen to fit the PIM architecture, and 2) the arithmetic operations and data types are natively supported by the PIM hardware.
From our observations and analyses, we argue the most fundamental architectural design changes that future PIM architectures (including both UPMEM and other devices that do not have on-chip interconnect between PIM processing units like Samsung HBM-PIM, SK Hynix AiM ) should make to enable fast and efficient large-scale ML training is to enable more efficient communication among PIM processing units (e.g., DPUs in UPMEM) by adding interconnects and/or shared memory. Extending the UPMEM PIM system with on-chip interconnects (i.e., direct inter-DPU communication) enables the implementation of decentralized optimization algorithms (e.g., ). For instance, decentralized parallel SGD algorithms are a promising solution to overcome scalability challenges of the real-world PIM system because of their two major advantages over its centralized counterparts: 1) decentralized optimization algorithms significantly reduce communication on the busiest node, and 2) decentralized parallel SGD theoretically provides approximately linear speedup in terms of computational complexity as we scale the number of nodes. Without such on-chip interconnects, the advantages of using decentralized optimization algorithms to accelerate large-scale ML training workloads cannot be leveraged and distributed ML workloads are significantly limited because of the high synchronization and communication overheads of centralized optimization algorithms, as our Takeaways 5.1 and 5.2 show.
For training workloads with even larger data and model sizes (e.g., training modern large language models with transformers on internet-scale text corpora ), we propose to further reduce the synchronization and communication overheads of PIM architectures by enabling the separate allocation of the training data from the model into memory units. This is because the model is frequently accessed and updated during ML training. In contrast, the training data is less frequently accessed as it is common to train such models only for a few epochs to reduce cost.
We posit that a shift towards an algorithm-hardware codesign perspective is necessary in the context of ML training using PIM due to the high complexity of the design space, including algorithms, models, training, distributed system topology, and hardware design. With this paper, we hope to spark a data-driven discussion and further research that can truly unleash the full potential of PIM on ML training workloads.
Related Work
To our knowledge, this paper is the first to implement and rigorously evaluate distributed Stochastic Gradient Descent (SGD) algorithms on a real-world PIM system. We describe other related works on the UPMEM PIM system, PIM for ML training and inference, and distributed optimization algorithms.
UPMEM PIM System. Several prior works characterize and overview the UPMEM PIM architecture. Other works explore a variety of algorithms and applications on the UPMEM PIM system, such as compilers and programming models, libraries, simulation frameworks, bioinformatics, security, analytics and databases, and ML training and inference. No prior work examines distributed SGD algorithms commonly used for data-intensive ML training workloads on the UPMEM PIM system.
PIM for ML Training and Inference. There are several works on PIM acceleration for ML training. However, none of these works use real-world PIM systems. Another body of work focuses on accelerating ML inference using PIM, showing the effectiveness of PIM at mitigating the data movement bottleneck in ML inference.
Distributed Optimization Algorithms. Various works focus on algorithmically alleviating the communication overhead of centralized optimization algorithms since the parameter server has been identified to be the key bottleneck in distributed ML. Other works develop decentralized optimization algorithms to minimize communication among many nodes. We believe that such algorithmic optimization combined with enhanced PIM hardware (see §6) can fundamentally improve ML training performance on large-scale datasets.
Conclusion
We evaluate and train ML models on large-scale datasets with centralized optimization algorithms on a real-world PIM system (i.e., UPMEM). We show that it is important to carefully choose the distributed optimization algorithm that fits the real-world PIM system and analyze tradeoffs. We demonstrate that commercial general-purpose PIM systems can be a viable alternative to processor-centric CPU and GPU architectures for many ML training workloads on large-scale datasets. Our results demonstrate the necessity of adapting PIM architectures to enable decentralized parallel SGD algorithms to overcome scalability challenges for many distributed ML training workloads.


