2 min readfrom Machine Learning

28 TPS on Qwen2.5-7B across two separate cloud regions over public WAN using speculative decoding + CUDA Graphs [P]

Our take

Recent benchmarking demonstrates transformative gains in distributed LLM inference using ShardFlow, a new framework designed to split HuggingFace transformers across multiple GPUs. Utilizing speculative decoding and CUDA Graphs, we achieved a peak of 28.10 tokens per second (TPS) on Qwen2.5-7B across two geographically separated GCP regions (Iowa & Oregon) connected via a public WAN – a setup exhibiting approximately 86ms round-trip latency. This highlights a key insight: speculative decoding minimizes latency impact, shifting costs from per-token to per-round.

The recent demonstration of ShardFlow, a distributed LLM inference framework achieving 28.10 TPS on Qwen2.5-7B across two geographically separated nodes, highlights a crucial shift in how we approach large language model deployment. This isn't just about raw speed; it's about unlocking inference capabilities in environments previously deemed impractical. The core innovation lies in its utilization of neural speculative decoding to mitigate the impact of high-latency WAN connections. As explored in Same effective batch does not mean same training time with gradient accumulation, tested on LoRA on T4 and L4, optimizing for efficient resource utilization is paramount, and ShardFlow’s approach directly addresses a significant bottleneck in distributed inference. This kind of work builds upon the growing trend of distributed computation, demonstrated earlier by community members offering free compute resources as detailed in I have a mid-sized GPU cluster and was thinking about giving free compute — suggesting a broader movement toward democratizing access to powerful AI tools.

The key insight, as the author points out, is that speculative decoding reframes latency. Instead of incurring a cost per token transmitted across the network, the cost becomes tied to "rounds" of speculation. This is a significant conceptual leap, especially given the reported 86ms RTT in their benchmark setup. The dramatic performance increase achieved by optimizing CUDA Graph usage – dropping draft latency from 112ms to 25ms – is a testament to the power of low-level optimization. The fact that draft generation was previously launching 1500 CUDA kernels per round from a Python loop underscores the importance of moving beyond naive implementations and leveraging optimized hardware acceleration. The other optimizations, like zero-copy Rust TCP relay and static caching, further demonstrate the meticulous engineering required to achieve such impressive results. The 20.31 TPS average, while lower than the peak, still represents a substantial improvement over the 4.92 TPS baseline, proving the viability of this distributed architecture.

Beyond the specific numbers, ShardFlow’s architecture offers a compelling vision for the future of LLM inference. It addresses a critical challenge: the increasing size and complexity of LLMs often necessitate powerful hardware, which isn't always readily available or cost-effective. By distributing the model across multiple, less-powerful GPUs and intelligently managing network latency, ShardFlow enables inference on a wider range of infrastructure. This opens up possibilities for deploying LLMs in edge computing environments, serving users in regions with limited bandwidth, and scaling inference capacity without requiring massive, centralized GPU clusters. Furthermore, the modular design of ShardFlow, utilizing technologies like meta-device model slicing to avoid loading large models into CPU RAM, showcases a forward-thinking approach to resource management that aligns with the growing need for efficient and scalable AI solutions.

Looking ahead, the success of ShardFlow raises a key question: how far can we push the boundaries of distributed inference? As LLMs continue to grow in size, the challenges of latency and bandwidth will only become more acute. This work suggests that innovative approaches like speculative decoding and aggressive hardware optimization will be essential for unlocking the full potential of these models, and for making AI more accessible and performant across diverse environments. The ability to transform computationally intensive tasks into manageable, distributed workloads represents a significant step towards realizing a truly democratized and scalable AI ecosystem.

been building ShardFlow for the past few months, a distributed LLM inference

framework that splits any HuggingFace transformer across N GPU machines and uses

neural speculative decoding to deal with WAN latency.

the setup for the benchmark: two T4 nodes in separate GCP regions (Iowa + Oregon)

talking through an AWS EC2 TCP relay in Ohio. ~86ms RTT on public internet.

the key insight with speculative decoding here is that WAN latency stops being a

per-token cost and becomes a per-round cost. with K=8 drafting you're committing

4.07 tokens per round trip instead of 1. at 86ms RTT that's a big deal.

numbers on Qwen2.5-7B:

non-speculative baseline: 4.92 TPS

neural drafter (eager): 14.3 TPS peak

+ CUDA Graphs on drafter: 28.10 TPS peak / 20.31 TPS avg

also ran Qwen2.5-14B with NF4 4-bit quant, same two nodes: 14.43 TPS avg.

the v2.1 fix that surprised me most: draft generation was launching ~1500 CUDA

kernels per round from a Python loop. each kernel 2-5us, Python launch overhead

8-10us. GPU sitting idle 65% of the time. capturing the full 0.5B forward pass

as a CUDA Graph and replaying with one driver call dropped draft latency from

112ms to 25ms.

other things in the stack: zero-copy Rust TCP relay, StaticCache + in-place KV

rewind for graph compatibility, meta-device model slicing to avoid loading 15GB

into CPU RAM.

repo: https://github.com/rautaditya2606/Shardflow

happy to answer questions on the speculative decoding implementation or the CUDA

graphs stuff specifically.

submitted by /u/katua_bkl
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article