Rent a GPU

Definition · multi-GPU inference and training

What is tensor parallelism?

Last updated: · 5 min read

Quick answer

What does tensor parallelism mean?

Tensor parallelism splits the weight matrices of every layer across several GPUs, so each card holds a slice and they compute each layer together. Their VRAM adds up: on RentGPUCrypto, four H100s give 320 GB for $1,774.08 a week, paid in Monero or other crypto, enough for models one card cannot hold.

In brief
  • Idea: cut each matrix multiplication into pieces, one per GPU, then combine the results after each layer.
  • Gain: a model larger than one card fits, and a single request runs on all cards at once.
  • Cost: the cards exchange data at every layer, so the link between them matters: NVLink on SXM hosts, PCIe elsewhere.
  • In vLLM: one flag, --tensor-parallel-size, set to the number of cards (2, 4 or 8).
  • Different from: pipeline parallelism (layers in sequence per card) and data parallelism (a full copy per card).

How does tensor parallelism compare with other ways to use several GPUs?

Tensor, pipeline and data parallelism compared for LLM inference and training
MethodWhat each GPU holdsMain useNeeds a fast link?
Tensor parallelismA slice of every layerServing one model bigger than one card, low latencyYes, traffic at every layer
Pipeline parallelismA run of whole layersVery large models across hostsLess, traffic between stages
Data parallelismA full copy of the modelTraining throughput, many requests at onceFor gradient sync in training
Expert parallelismSome experts of a MoE modelMixture-of-experts models like Qwen3 235B or DeepSeek-V3Yes, tokens routed between cards

How does tensor parallelism split a layer?

Each GPU gets a column or row slice of the layer's weight matrices and computes its share of the output. In a transformer's attention block, the heads are divided between cards; in the feed-forward block, the first matrix is split by columns and the second by rows, so each card works on its own slice and one all-reduce sums the results.

This scheme comes from the Megatron-LM paper by NVIDIA researchers. With two all-reduce steps per layer, the cards stay in step token by token. The weights are divided, so is the KV cache, and the memory of all cards works as one pool.

When do you need tensor parallelism?

When the model, at the precision you want, does not fit one card with headroom. According to RentGPUCrypto's VRAM calculator, Llama 3.3 70B needs 90 GB in 8-bit, which fits one H200 or splits across 4× RTX 4090 ($1.48/hr). In 16-bit it needs 169 GB, which means 2× H200.

If one card holds the model, a single card is simpler and avoids the link overhead. Tensor parallelism can still help latency on big models, since every card works on each token, but the first reason is memory. The VRAM explainer shows how to size it.

Yes: the all-reduce at every layer runs over the link between cards, so its speed limits throughput. A100, H100 and H200 cards on SXM hosts talk over NVLink: NVLink 900 GB/s on SXM hosts for the H100 and NVLink 600 GB/s on SXM hosts for the A100. RTX 4090, RTX 5090 and L40S cards have none (PCIe 4.0 x16, no NVLink) and exchange data over PCIe.

PCIe tensor parallelism still works well for inference at 2 or 4 cards, and is the cheap route for 4-bit 70B models. For 8-card serving of very large models, or for training, NVLink hosts pay off. The instance page shows whether a host is SXM or PCIe.

Serving a model across 4 GPUs with vLLM
# all GPUs of the instance must be visible
nvidia-smi -L

# one process, the model split across 4 cards
vllm serve meta-llama/Llama-3.3-70B-Instruct \
  --tensor-parallel-size 4 \
  --max-model-len 16384

# check the OpenAI-compatible endpoint
curl http://127.0.0.1:8000/v1/models

Which card counts can you use?

Powers of two that divide the model's attention heads: 2, 4 or 8, which is what RentGPUCrypto instances offer. Most open LLMs have head counts divisible by 8, so all three sizes work. vLLM checks this at start-up and stops with an error if the split is not possible.

For mixture-of-experts models such as Qwen3 235B-A22B or DeepSeek-V3 / R1 (671B), vLLM can add expert parallelism on top. The multi-GPU vLLM guide covers flags, NCCL settings and common errors. Multi-GPU sets are also sold as packs at the long-block rate.

What does a tensor-parallel set cost to rent?

The price is the per-card rate times the number of cards, and packs sell multi-card sets at the long-block rate. Two RTX 4090 cards for 30 days, 48 GB in total, cost $475.20. Two A100 80GB cards for a week cost $359.52, and eight H200 cards for a week, 1128 GB in total, cost $4,690.56.

By the hour, the sum is simple: four L40S cards draw four L40S GPU-hours per hour, at $0.99 each on a short block. Since the cards bill whether they are busy or waiting, the cheapest tensor-parallel set is the smallest one that holds the model with room for its KV cache. A 4-bit 70B model on two consumer cards often costs less per hour than one data-centre card, while a 16-bit model of the same size needs two H200s.

Tensor parallelism: common questions

Does tensor parallelism make generation faster?

It can lower latency per token on large models because every card works on each layer, but link overhead eats part of the gain. Its main purpose is fitting a model that one card cannot hold.

Can I use tensor parallelism across two instances?

Not across RentGPUCrypto instances: tensor parallelism needs the cards in one machine. Rent one instance with 2, 4 or 8 cards of the same model instead.

Does Ollama use tensor parallelism?

Ollama, built on llama.cpp, spreads layers across GPUs rather than splitting each layer. It works for fitting a model but is not tensor parallelism; vLLM and SGLang do true tensor parallelism.

Is tensor parallelism used for training too?

Yes, in frameworks like Megatron-LM and in PyTorch's tensor parallel APIs, often combined with data and pipeline parallelism. For fine-tuning with LoRA on one card, it is usually not needed.

Verdict
  • Tensor parallelism pools the VRAM of 2, 4 or 8 cards by splitting each layer between them.
  • Use it when the model does not fit one card; prefer NVLink SXM hosts for 8-card serving and training.
  • In vLLM it is one flag; on RentGPUCrypto it is one instance with several cards of one model.
Sources (4)
  1. Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism — Shoeybi et al., NVIDIA
  2. vLLM documentation: distributed inference and serving — vLLM project
  3. PyTorch tensor parallelism tutorial — PyTorch
  4. NVIDIA H100 Tensor Core GPU — NVIDIA

Four H100s for a week

$1,774.08 for 672 GPU-hours, 320 GB of VRAM in one instance.

RTX 4090 from $0.37/hr · no KYC

Rent a GPU