Serving DeepSeek-R1's 671B Parameters Across a Multi-Node Nvidia H100 Cluster TL;DR 🧠 DeepSeek-R1 671B parameters exceed single-node 8xH100 node VRAM – let alone the additional memory for activations and KV cache. 🔗 Multi-node inference solves this by using 16 H100 GPUs across two nodes (1280GB total VRAM), leveraging expert parallelism to distribute the model efficiently. ⚡ During inference, large models rely on VRAM to store and read massive amounts of weights (e.g., 37GB for a single 37B active-parameter expert at fp8 precision for DeepSeek-R1). 🛠️ VRAM bandwidth (3.35 TB/s on H100 GPUs) is primary inference bottleneck for DeepSeek-R1 given that each forward pass transfers 37 GBs of data directly from VRAM for each expert 📊 Must parallelize model inference across nodes and GPUs for efficient performance across nodes 🖥️ Requires hardware-topology-aware design and efficient parallelism (expert parallelism) to increase inference performance. Problems & Solutions 🔧 Problem: DeepSeek-R1’s 671B parameters + KV cache/activations exceed the VRAM of a single 8xH100 node (640GB). 🛠️ Solution: Use two 8xH100 nodes (16 GPUs total) with 1280GB VRAM, connected via InfiniBand. 🌐 Problem: Inter-node communication (InfiniBand: 800GB/s) is slower than intra-node GPU communication (NVLink: 900GB/s) and much slower than VRAM bandwidth (3.35 TB/s) 📡 Solution: Reduce slow inter-node data transfer by leveraging expert parallelism, which reduces inter-node communication, utilizes faster VRAM bandwidth, and improves overall inference performance. Novel Insights and Learnings 1️⃣ Interconnects are not the bottleneck: Counter-intuitively, VRAM bandwidth (3.35TB/s) is the primary bottleneck due to the amount of data that is loaded from VRAM on each inference request 2️⃣ Expert parallelism maps experts to GPUs based on physical interconnects - reducing cross-node traffic, doing more work within each node (using more VRAM bandwidth), and improving overall inference performance. 3️⃣ While tensor parallelism puts an equal portion of each expert in each GPU, expert parallelism puts an equal number of whole experts in each GPU. Future Work 🧭 Scaling to 1024 GPUs: Testing 128-node clusters for trillion-parameter models. 🔄 Dynamic Parallelism: Switching between tensor and expert parallelism mid-inference for adaptive workloads. Key Visualizations 📊 Figures 1 & 2: DeepSeek-R1 671B parameters exceed single-node 8xH100 node VRAM – let alone the additional memory for activations and KV cache. 📡 Figure 3: DeepSeek-R1 runs on two 8xH100 nodes (1280GB total VRAM) connected via InfiniBand 🔗 Figure 4: Tensor Parallelism vs. Expert Parallelism - each GPU holds 16 experts, distributing the 256 experts across the 16 GPUs for efficient inference. 📰 Blog: How multi-node inference works for massive LLMs like DeepSeek-R1 (https://lnkd.in/gCPM58NB) by Philip Kiely and Philip Howes
Tips for Overcoming Memory Bottlenecks in GPU Computing
Explore top LinkedIn content from expert professionals.
-
-
Running PyTorch in production? Memory is most like an issue and also a silent bottleneck. I came across this blog that shows how they slashed inference latency and costs using lesser-known tricks. Here’s what stood out: 👉 Selective Gradient Checkpointing Checkpoint only memory-heavy layers → cuts peak memory by 40%. 👉 Dynamic Kernel Caching Cache common input shapes during warmup → avoids CUDA recompilation lag. 👉 Manual Precision Casting Control which tensors stay in FP32 vs. BF16 → stability + speed. 👉 Smart empty_cache() Scheduling Call it only during idle windows → avoids perf drops. 👉 Partial Quantization Quantize only safe layers like linear → preserve accuracy, save memory. 👉 Custom CUDA Streams Overlap compute and data loads → reduces GPU idle time. 👉 Shared Memory Tensors Zero-copy multiprocessing → boosts throughput for high RPS services. These aren’t just dev tips — they’re real production survival tactics. Full blog here - https://lnkd.in/gzJSccc8
-
When your LLM says “just one more parameter…” and your GPU goes 🔥 Imagine a tiny clown-car labelled “24 GB GPU” and an endless parade of language-model weights cramming inside. That’s basically what happens when you try to fine-tune a giant model on consumer hardware. 🚗 VRAM disappears fast when billions of model weights, extra optimizer states, saved activations, and token-by-token KV caches all pile up—each scaling with model size, batch size, and context length. The higher the precision (FP32 vs FP16 or Int8), the bigger the bite, so smart choices in precision, optimizers, and memory-saving tricks are essential to stay within your GPU’s limits. Why you keep hitting “CUDA-out-of-memory” - You’re running a 70 B parameter model on a single card. - Batch size set to “YOLO”. - You thought quantization was a myth. - You forgot activations double during training. - You assumed swap-to-CPU would be “fine”. (Spoiler: it isn’t.) Quick sanity savers ⛑️ - Gradient checkpointing → recompute, don’t store. - Low-rank adapters / LoRA → fine-tune millions, not billions. - Quantize for inference: Int8, 4-bit, even 2-bit if you’re spicy. - Pipeline / tensor parallelism → slice the model across multiple GPUs. - Know when to downsize — sometimes GPT-J gets the job done. Remember: AI isn’t “one-click”; it’s physics, algebra, and PCIe lanes. 😉 Follow LunarTech here on LinkedIn, YouTube and other platforms. 🎓 For AI & Data Science training: LunarTech Academy 🚀 For AI strategy & full-stack dev: LunarTech Enterprises #LunarTech #LLM #GPU #AIMemory #DeepLearning #ModelOptimization #DataScience #AIEngineering
Explore categories
- Hospitality & Tourism
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Career
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development