esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

Tensor vs Pipeline Parallelism

How tensor and pipeline parallelism split one large model across GPUs, and which one to use where, for your AI interview.

In short

Tensor parallelism splits each layer across GPUs that must swap results after every layer, so it needs a fast link and works best inside one server. Pipeline parallelism gives each GPU a block of whole layers, so it can run across servers, but GPUs wait in turn.

11 min readAdvancedOccasional · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Tensor parallelism cuts every layer of the model into slices, one per GPU, so all the GPUs work on each token together. They swap results after every layer, so they need a very fast link and work best inside one server. Pipeline parallelism gives each GPU a run of whole layers. It can cross servers, but one stage works while the others wait. NVIDIA's and vLLM's guides both suggest tensor inside each server and pipeline between servers.

What are tensor and pipeline parallelism, in plain words?

A large language model is a long stack of layers, and each layer holds big tables of numbers called weights. When the weights are too big for one GPU, you split the model across several GPUs. Tensor and pipeline parallelism are the two most common ways to cut the model itself, and they differ in what gets split.

Picture a claims office handling one large insurance file. In the first setup, every clerk works on a slice of every page and passes notes after each page. In the second, each clerk owns one stage, such as intake, review or payout, and the file moves down the line. The first needs the clerks in one room. The second copes with a team spread over several buildings.

Now the real case. A made-up insurer runs a claims assistant on its own model. The model needs more GPU memory than one 8-GPU server holds, so the team has to split it across two servers.

Key words

Layer
One step of the network's stack. A large model has many, run one after another.
Shard
One slice of a layer's weights, held by one GPU.
Stage
A run of whole layers, served by one GPU or one group of GPUs.
Node
One server box with several GPUs inside it.
Interconnect
The link GPUs use to pass results, such as NVLink inside a box or InfiniBand between boxes.

How does tensor parallelism split one layer?

Tensor parallelism cuts each layer's weights into shards, one per GPU. NVIDIA's training guide defines it as a partitioning method that spreads one layer's parameter tensor across GPUs. vLLM, a serving engine, uses Megatron-LM's tensor parallel algorithm for the same job.

  1. 1

    Shard the weights

    Each layer's big weight tables are cut into equal pieces, one per GPU.

  2. 2

    Compute together

    Every GPU works on its piece of the same token at the same moment.

  3. 3

    Combine the results

    The partial answers are added together, so each GPU holds the full result for the layer.

  4. 4

    Repeat for every layer

    The GPUs swap results again at every layer, so the link speed matters a lot.

The payoff is speed for one reply, because all the GPUs work on the same token together. The cost is the chatter. Smaller slices also mean smaller jobs on each GPU, and NVIDIA's guide notes that this adds overhead on the CPU.

Tip

Asked why it needs fast links, answer with the swap: after every layer, the GPUs must combine results before the next layer can start.

How does pipeline parallelism split the layers?

Pipeline parallelism gives each GPU a run of consecutive layers. A token moves through stage one, then stage two, and so on. The GPipe paper described it as pipelining sub-sequences of layers on separate accelerators. vLLM says it splits the model along layers and supports uneven splits, so the stages do not need equal sizes.

The weak point is idle time. A single request passes through the stages one after another, so with four stages only one GPU works at any moment, and the other three wait. The idle gap has a name, the pipeline bubble. NVIDIA's training guide shrinks it by dividing each GPU's work into several smaller subsets of layers.

The idle cost depends on the load. With one request in flight, most GPUs sit idle. With many requests in flight, each stage can work on a different request, so the GPUs stay busy. That is why pipeline parallelism suits high-throughput serving, while a single reply rarely gets faster.

Across servers, pipeline parallelism is the friendlier choice. NVIDIA's training guide says it can work across nodes, but it needs careful batch size tuning.

Tip

Asked about the bubble, say it in one line: the GPUs wait for each other, and more requests in flight keep them busy.

Which one should you pick, and when?

  • Tensor

    Inside one server

    Every layer is shared by the GPUs in one box, on a fast link. It can make one reply faster.

  • Pipeline

    Across servers

    Only each stage's output moves from server to server, so slower links work. GPUs wait in turn, so a single reply gets no faster.

  • Both

    Big model, several servers

    Tensor inside each server, pipeline between them. vLLM's guide recommends it when the model is too large for a single node.

vLLM's guide gives the same recipe. Set the tensor size to the GPUs per node, and the pipeline size to the number of nodes. It also gives a short list, one case per model size.

  • No split needed

    If the model fits on one GPU, skip distributed serving. vLLM says it is probably unnecessary.

  • Too big for one GPU, fits one node

    Use tensor parallelism inside the node. vLLM's example: tensor_parallel_size=4 on a 4-GPU node.

  • Combine when one node is small

    Tensor size is GPUs per node, pipeline size is the number of nodes.

  • No NVLink, use pipeline

    vLLM says pipeline gives higher throughput and lower communication overhead there.

Two ways to cut the model

Big model

Too big for one GPU

Tensor path

Cut every layer

Each GPU holds a slice

Pipeline path

Cut into stages

Each GPU holds whole layers

Needs a fast link

GPUs swap after each layer

GPUs wait in turn

One stage works, others idle

Both, in the right place

Tensor in a server, pipeline across

  1. 1The first path cuts every layer into slices.
  2. 2The second path hands out whole layers, stage by stage.
  3. 3Every layer then needs the GPUs to swap results.
  4. 4Each stage waits for the one before it.
  5. 5Keep the swaps inside one server, on the fast link.
  6. 6Let the stage handoffs cross servers, on the slower link.
Tensor parallelism cuts every layer, and pipeline parallelism cuts the stack into stages. Tensor's swaps need a fast link, so they stay inside one server. Pipeline's handoffs can cross slower links, but the GPUs wait in turn.
  • “Tensor parallelism works best within a single node (high bandwidth)”

    NVIDIA, training guide

  • “Efficient tensor parallelism requires fast internode communication, preferably through high-speed network adapters such as InfiniBand.”

    vLLM, serving guide

  • “devices spending significant time waiting on other devices to make progress”

    Megatron-LM team, training paper

What does a two-server setup look like?

Take the made-up insurer again. Its model is split over two servers with 8 GPUs each. Server one holds the first half of the layers, and tensor parallelism spreads those layers across its 8 GPUs. Server two holds the second half, split the same way. Only the handoff between the servers crosses the network.

Two servers, one model

Server 1, 8 GPUs

First half of layers

Tensor on the fast link inside the box

Server 2, 8 GPUs

Second half of layers

Tensor on the fast link inside the box

Reply sent out

Returned to the claims team

  1. 1The one handoff crosses the slower network between the two servers.
  2. 2Server 2 finishes the layers and sends the reply back.
Each server runs tensor parallelism inside its box, on the fast link. The single pipeline handoff between the servers is the only traffic on the slower network.

The numbers that matter are the link speed, the size of the handoff and the idle time at the handoff. Measure those on real traffic before you commit to a split.

How would you split a model across a new 16-GPU cluster?

  1. 1

    Check the fit first

    Load the weights and see whether one GPU holds them. If one GPU is enough, stop there.

  2. 2

    Fill each server first

    Set the tensor size to the GPUs in one server. Tensor needs the fast link, so it stays inside.

  3. 3

    Add pipeline across servers

    Set the pipeline size to the number of servers. Each extra stage adds a handoff and possible idle time.

  4. 4

    Measure, then tune

    Watch latency, GPU use and idle time under real load, and change one setting at a time.

What does the interviewer want to hear?

A strong answer covers

  • Tensor splits each layer. Pipeline splits the stack of layers into stages.
  • Tensor needs a very fast link, so it stays inside one server.
  • Pipeline crosses servers, but its stages wait in turn: the bubble.
  • Big models often use both: tensor inside, pipeline across.
  • The right split depends on the links, batch size and latency target.
  • Measured numbers from your own hardware and traffic.

Common traps

  • Trap"Tensor parallelism is always faster, so use it everywhere."

    BetterIt is fastest on a fast link. On a slow link its swaps cost more than the pipeline handoffs.

  • Trap"More pipeline stages always mean a faster model."

    BetterEach stage adds a handoff and idle gaps. More stages help only when the model needs the memory.

  • Trap"Add GPUs across the slowest link and it gets faster."

    BetterExtra GPUs on a slow link add swaps. Choose the split the links can carry.

Can you spot the right setup?

Pick the setup

A made-up team has two 8-GPU servers joined by plain Ethernet, and one model that needs both. Which setup suits it?

Quick check

Your server's GPUs have no NVLink, so the cards talk over a slower link. Which split do you lean on?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q317The latency vs throughput trade-off?10 min
  2. Q319What is PagedAttention / vLLM?12 min
  3. Q320Serving engines (vLLM, SGLang, TensorRT-LLM, llama.cpp)?11 min
  4. Q327GPU basics: why does memory bandwidth limit decoding?11 min
  5. Q328Does a 70B model fit on one 80GB GPU?10 min

Last updated on 27 November 2026

Serving a model too big for one GPU?

I design and build AI products and agents, and the system behind them. Book a short call and tell me the model, the hardware and the latency you need.