CLOUD CONCEPT

Model Parallelism

Model parallelism divides a single machine learning model across multiple compute devices so they cooperate to train it or serve predictions.

Cloud Concepts Hub →

What is Model Parallelism

Instead of placing a complete model on every accelerator, model parallelism distributes its layers, tensors, or other components across devices. It enables large foundation models to run when one device lacks sufficient memory, but introduces communication overhead and requires coordinated resource allocation.

Model parallelism distributes the computation and parameters of one model across multiple devices, usually GPUs or other accelerators. The devices work together on the same model execution rather than independently hosting complete copies. This is particularly important for foundation model deployment, where model weights, temporary tensors, and attention caches can exceed the memory available on one accelerator.

Two common approaches are tensor parallelism and pipeline parallelism. Tensor parallelism splits operations within layers across devices, such as distributing a large matrix multiplication and combining its partial results. Pipeline parallelism assigns different groups of layers to different devices and passes intermediate activations between them. Pipeline stages can process different microbatches concurrently, but uneven stage workloads and pipeline bubbles can leave devices idle. A deployment can combine both approaches when the model architecture and serving framework support them.

For cloud hosting, first estimate the memory needed by the entire serving workload. A model with 70 billion parameters stored at two bytes per parameter requires approximately 140 GB just for weights, before runtime overhead, activations, and the key-value cache used during autoregressive generation. Two GPUs with 80 GB each might accommodate those weights, but the remaining memory may be insufficient for the desired context length and concurrent requests. Aggregate GPU memory is not a single automatically shared pool: the runtime must explicitly partition the model, and each device must have enough memory for its assigned workload.

Next, select an accelerator topology and a compatible inference engine. A multi-GPU instance with high-bandwidth device interconnects is often a simpler starting point than splitting a latency-sensitive model across hosts. Cross-host deployment additionally requires supported distributed serving, coordinated processes, and adequate network bandwidth. Configure the parallelism degree, such as the number of devices participating in tensor parallel execution, according to the model architecture, accelerator count, and framework constraints. Merely choosing a machine with several GPUs does not automatically distribute the model.

Model parallelism trades memory capacity and potentially faster computation for communication and synchronization costs. Tensor-parallel execution commonly exchanges intermediate results throughout the forward pass, making interconnect performance important. Increasing the number of devices can therefore increase cost without improving response latency. Benchmark time to first token, time per output token, throughput, accelerator utilization, and memory consumption using realistic prompt lengths and concurrency. Longer contexts and larger batches can substantially increase cache memory requirements even when model weights remain unchanged.

Distinguish partitioning one model from scaling complete model replicas. Adding endpoint instances normally increases the number of independent replicas; it does not automatically combine their accelerator memory into one larger model host. If one replica needs four GPUs, scaling to three replicas generally requires three complete four-GPU allocations. Health checks, startup coordination, and recovery must also account for the fact that a failed participating process can make its whole model replica unavailable.

For deployment decisions, use model parallelism when model capacity or measured performance justifies it. Quantization may reduce memory requirements enough to use fewer devices, while request batching and replica scaling address different throughput needs. These techniques can be combined, but none eliminates the need to validate model quality, memory headroom, latency objectives, and cost per completed request.

Key aspects of Model Parallelism

Effective model parallelism combines explicit model partitioning, sufficient per-device memory, fast communication, and replica-level operational planning.

One model distributed across devices

Each participating device holds or computes part of one model rather than necessarily storing a complete copy. This enables execution beyond the memory capacity of a single accelerator.

Multiple partitioning strategies

Tensor parallelism divides operations within layers, while pipeline parallelism places different layer groups on different devices. Choose a strategy supported by the model architecture and serving runtime rather than assuming all models partition equally well.

Topology-aware resource allocation

Communication bandwidth and latency between devices can determine whether additional accelerators improve performance. Prefer tightly connected devices for communication-heavy partitions and validate cross-host designs with representative benchmarks.

Whole-workload memory planning

Budget for weights, runtime workspaces, activations, and attention caches rather than weights alone. Validate memory consumption per device because an uneven partition can exhaust one accelerator while others retain free capacity.

Distinct partitioning and replica scaling

The model-parallel group defines the resources required for one model replica. Increasing serving capacity usually means adding complete groups, not adding isolated devices to an already running replica.

Coordinated execution and recovery

Participating processes exchange intermediate results and depend on one another to complete requests. Deployment startup, health checks, and failure recovery must treat the distributed model replica as a coordinated unit.

Cloud services for Model Parallelism

Amazon EC2 supplies the accelerator capacity and interconnect options underlying many model-parallel deployments. Amazon SageMaker AI provides managed hosting where compatible inference engines partition models across the allocated devices. Amazon EKS offers a Kubernetes-based alternative when teams need more control over scheduling and serving components. These are alternative operational approaches, not services that must all be combined. In each approach, the model-serving runtime performs the actual partitioning, while infrastructure configuration supplies enough devices, memory, and communication bandwidth for every complete replica.

Amazon SageMaker image Amazon SageMaker

SageMaker AI can host large models on supported multi-accelerator instances using compatible inference containers and engines. Configure the engine's parallelism settings explicitly, and distinguish the devices used by each replica from the endpoint's replica count; multi-node partitioning requires a specifically supported deployment configuration.

Open Amazon SageMaker →
Amazon EC2 image Amazon EC2

EC2 provides accelerator instances for self-managed model-parallel inference and training. Select GPU memory and interconnect topology to match the partitioning strategy; for supported multi-node configurations, Elastic Fabric Adapter can improve communication when used with a compatible software stack.

Open Amazon EC2 →