DeepEP, Part 4: V2.5 and the Model Around It

What the September 2026 release changes in expert layouts, scheduling and memory, measured with CUDA 13.4, and how it fits alongside DeepSeek's models and DeepGEMM

October 10, 2026 · Markdown · Whole series as Markdown

Series: Part 1 · Part 2 · Part 3 · Part 4

At the end of part 3, DeepEP had a new transport. V2 gave every token a fixed slot on each destination GPU, talked to the network through NCCL's device API instead of NVSHMEM, and folded the two kernel families of V1 into one ElasticBuffer with one dispatch and one combine. V2.5, released on September 29, 2026, keeps all of that. The kernels that move a token from one GPU to another are recognizably the ones from part 3.

What V2.5 changes is everything around those kernels. The EP interface becomes EPBuffer, and Engram lookups, pipeline transfers and collectives each get a buffer class of their own. A caller can now postpone the second half of a dispatch until it actually needs the result, reuse an expanded expert layout from an earlier call, and copy the weights of redundant experts between GPUs. And V1, together with its NVSHMEM dependency, is finally gone from the repository. So if the transport stayed the same, how much do the answers to our four questions change?

Quite a bit, as it turns out, because two of the questions (which layout the experts get, and what it costs) depend as much on the interface as on the kernels. I will go through the release with the same four questions as before: what is sent, how the receiver knows that data has arrived, which layout reaches the experts, and what it costs in memory, SMs and CPU time. After that, we will place V2.5 next to the DeepSeek models and DeepGEMM releases of the same period, and finish with my measurements on the B300 machine.

The source is DeepEP at 93eb6eb, the README update right after the V2.5 release commit def86514, and DeepGEMM at 057ca59 from September 30. V2.5 needs a newer CUDA than the earlier parts used, so I measured it in a separate container with CUDA 13.4, on the same machine with eight B300 GPUs and still without RDMA network cards. As in part 3, everything I measured runs inside one NVLink domain, and the multi-machine parts of this article come from reading the source.

1. From One Buffer to Four

1.1 Why Split the Buffer

In V2, one ElasticBuffer served four quite different kinds of transfer. Expert dispatch needs routing metadata and per-expert counts. An Engram lookup needs rows of a table at known addresses. A pipeline stage sends one activation tensor to its neighbor, and an all-gather needs every rank's shard of a result. Each of these has its own layout and its own notion of "done", and keeping them under one name made it hard to see which rules applied to which call.

V2.5 gives them separate classes: EPBuffer, EngramBuffer, PPBuffer and BucketBuffer. They share the allocation and lifecycle code in a small base class, BufferBase, but each operation keeps its own layout and completion rules. For example, an EP handle records where every expert output has to go back to during combine, while an Engram fetch returns one hook per layer that waits for that layer's rows. Figure 1 follows each kind of data to the computation that consumes it.

Four buffers and the computations that consume their data
Figure 1: EP delivers routed activations, Engram delivers table rows, PP delivers a stage's activations, and Bucket delivers collective results. They share allocation and lifecycle code, while each operation keeps its own layout and completion rules.

1.2 Planning Symmetric Memory

Remember from part 3 that DeepEP's buffers are NCCL windows: symmetric memory, registered once, in which an offset means the same thing on every GPU. That works for DeepEP's own buffers, but V2.5 adds operations whose inputs live in the caller's tensors, such as the weights of a redundant expert or the shards of a collective. Those tensors have to be inside a registered window too, at the same offset on every rank.

The new BufferAllocator solves this by planning first and allocating later. Each allocate call returns a placeholder tensor on PyTorch's meta device, which has a shape and a dtype but no storage, and records an aligned offset for it. When the buffer is constructed, it allocates and registers one block of memory and calls materialize, which swaps every placeholder for a view into that block with torch.utils.swap_tensors. So the caller's variables turn into views of registered memory without being reassigned:

# BufferAllocator usage, from the README at 93eb6eb
# (excerpt, not a standalone program)
plan = BufferAllocator()
x = plan.allocate((group.size(), 1024), torch.float32)   # a meta tensor
buffer = BucketBuffer(group, plan)    # allocates, registers, materializes
x[group.rank()].fill_(group.rank())   # x is now a view into the window
gathered_x = buffer.all_gather(x[group.rank()]).wait()

Since the offsets come from the order of the allocate calls, every rank has to make the same calls in the same order, which the README spells out as a requirement. Figure 2 shows the three steps.

Planning symmetric memory with BufferAllocator
Figure 2: `allocate` hands out meta tensors and records offsets, constructing the buffer allocates and registers one window per GPU with the same layout everywhere, and `materialize` turns the caller's tensors into views of that window.

The last step is the clever one. torch.utils.swap_tensors exchanges everything about two tensor objects, including their storage, so every reference to the placeholder x, in the caller's code or anywhere else, now sees the view into the window. The alternative, returning new tensors and asking the caller to rebind every name that pointed to the old ones, would be easy to get wrong.

1.3 New Build Requirements

The requirements went up as well. V2.5 needs Hopper or newer, CUDA 13.1 or newer, NCCL 2.32.3 or newer, PyTorch 2.10 or newer, and a C++20 compiler whose standard library has std::format. The kernels are now compiled at run time by DeepJIT, a JIT module that DeepSeek split out into its own repository, which means the CUDA toolkit and the host compiler have to stay installed next to the wheel. This is also why the CUDA 13.0 environment from parts 1 to 3 couldn't run V2.5 at all.

2. The Topology Comes From Memory Access

2.1 NVLink Domains Instead of Machines

In part 1, V1's normal kernels hard-coded the topology: 8 GPUs per machine, an 8-bit mask in SourceMeta, and RDMA always to the GPU with the same local index. V2 replaced this with NCCL's teams, and V2.5 makes the consequence explicit. Here is how it computes the sizes of the two levels:

// csrc/kernels/comm/context.cpp at 93eb6eb (one line broken in two)
const int num_ranks = ncclTeamWorld(comm).nRanks,
          num_nvl_ranks = ncclTeamLsa(comm).nRanks;
EP_HOST_ASSERT(num_ranks % num_nvl_ranks == 0);
return {num_ranks / num_nvl_ranks, num_nvl_ranks};

The first number is the number of NVLink domains, and the second the number of GPUs in one domain. Notice that neither of them counts GPUs per machine. The LSA team ("load/store accessible") from part 3 contains the GPUs that can reach each other's memory with ordinary loads and stores, and on a rack-scale system like GB200 NVL72, that is up to 72 GPUs spread over 18 machines. So an EP64 group could be eight domains of eight GPUs each, as on our B300 machines, or a single domain of 64 GPUs in one rack, and these are two quite different transport problems. Figure 3 shows the difference.

Equal expert-parallel sizes with different NVLink domains
Figure 3: In one load/store accessible domain, every payload can be stored through an NVLink pointer. Across domains, the hybrid path sends once to each destination domain over RDMA and forwards over NVLink there. Machine boundaries alone don't choose the path.

2.2 Direct and Hybrid

On top of the physical domains, EPBuffer has two logical modes, which part 3 mentioned briefly. With allow_hybrid_mode=True (the default), the logical levels follow the physical domains: a token is sent once to each destination domain, to the GPU on the same rail, and forwarded over NVLink to the expert owners there. With allow_hybrid_mode=False, all ranks form one flat group, and every expert owner is a direct destination. Direct mode still works across domains, since the transport picks an NVLink pointer for each destination that has one and a GIN put for the rest. So "direct" describes where the token is sent, not how many machines there are.

Which one is better depends on how many expert owners of a token share a remote domain. Let's take two experts of the same token. If they are on the same remote GPU, both modes send the token once, since dispatch deduplicates destination GPUs. If they are on two different GPUs of the same remote domain, direct mode sends two copies over RDMA, while hybrid mode sends one over RDMA and forwards it twice over NVLink on the far side. And if they are in two different domains, hybrid saves nothing and still pays for the forwarding step. Figure 4 shows the three cases.

Direct and hybrid mode for two experts of one token
Figure 4: The transfers that direct and hybrid mode make for a token with two experts on remote GPUs. Hybrid mode sends once to the GPU on the source's rail in each destination domain and forwards from there over NVLink.

Reading the figure row by row, hybrid mode never sends more over RDMA than direct mode, since a token can't reach more domains than GPUs, but it always pays for the NVLink forwarding. So it wins only in the middle row, and only when the network is the slower of the two links. Section 5 puts numbers on how often the middle row happens with uniform routing.

The two modes also use the network differently. For direct mode, get_theoretical_num_qps uses at most 9 queue pairs, with a comment saying that fewer queue pairs mean less doorbell ringing. For hybrid mode, it gives every channel its own queue pair, 16 per SM plus one for the notify warps, since each channel is a warp that sends its own stream of tokens and tails, and part 3 explained why a signal must be sent through the same GIN context as the data it refers to.

The README also changed its advice on adaptive routing. In part 2, we saw V1's README recommend it only for heavily loaded networks. V2.5's README now recommends turning it on "under all network load conditions", even though it adds some latency. My reading is that this follows from part 3: V2's progress signals across the network are atomic adds of differences, which give the same result in any order, and no credit is sent back.

On the B300 machine, I set EP_DISABLE_GIN=1, which skips the RDMA initialization entirely, since there are no network cards to initialize. All eight GPUs are in one LSA team, so every destination is reached through a pointer anyway.

3. Arrival, Expansion and the Expert GEMM

3.1 One Received Token, Several Expert Rows

The dispatch kernel itself works as in part 3. Notify warps count tokens per destination GPU and per local expert, dispatch warps load each token and its metadata into shared memory and store it into a fixed slot on every destination GPU, and a copy epilogue turns the slots into the output tensors. In hybrid mode, forward warps pass the tokens on inside the destination domain. To send the outputs back later, the handle keeps the source indices, the slots and the forwarding links.

The output layout is where we need to be careful with counting. A token that selects three experts on GPU 5 arrives at GPU 5 once, but a grouped expert GEMM needs it three times, once in each expert's segment. Dispatch sends the single copy, and the copy epilogue makes the other two locally. So there are three different counts in play: the rows that were received, the expert rows that the GEMM computes, and the rows that are allocated.

With do_expand=False, the output has one row per received token, together with its local expert indices and router weights, and the caller arranges the rows for its expert kernel itself. With do_expand=True, the epilogue builds the expert segments directly, each aligned to expert_alignment rows, and records in the handle where each token's copies went, so that combine can find them again.

Let's take a small example. If three local experts receive 3, 0 and 5 tokens and the GEMM needs segments aligned to 4 rows, the segments take 4, 0 and 8 rows, which makes 8 useful rows out of 12. But neither number says how many tokens were sent over NVLink, since two of the 8 rows might be copies of the same received token. Figure 5 shows the three counts side by side.

One received token, several expert rows and alignment padding
Figure 5: The received-token layout has one row per token and destination GPU. Expansion copies a token once per local expert, and alignment adds unused rows. The metadata links the expanded rows back to their source token.

3.2 When the Counts Stay on the GPU

As in V2, do_cpu_sync=True makes the CPU wait for the exact counts, so that the outputs can be allocated with exactly the right size, which is what prefill and training usually want. With do_cpu_sync=False, the outputs are allocated for the worst case, and the real counts stay on the GPU, in handle.psum_num_recv_tokens_per_expert. That is what a CUDA graph needs, but it also means that the next kernel must read the expert ranges from that tensor instead of treating every allocated row as a token.

The worst case for the expanded layout is large. The source sizes it as every rank sending its maximum number of tokens, each with min(top-k, local experts) copies, plus room for the alignment of every expert. For the V3 shape on 8 GPUs with 4,096 tokens per rank, that is 8 x 4,096 x 8 = 262,144 rows, or 1.75 GiB for the FP8 values alone. With 128 tokens per rank, it is 8,192 rows and 56 MiB. So the no-sync mode is meant for decoding, where the maximum batch is small, and prefill keeps paying for the CPU wait in exchange for exactly sized outputs.

Two kinds of empty rows are easy to mix up here. Alignment gaps sit between the segments of populated experts, and unused capacity is the large tail of a worst-case allocation. V2.5's new do_zero_padding=True fills the alignment gaps with zeros. A forward GEMM doesn't care what is in a padding row, since each output row depends only on its own input row, but a kernel that sums over the rows does, such as the weight-gradient GEMM in training, which would add whatever garbage a gap contains into the gradient. That is presumably why the README's example, which covers training as well as inference, turns it on. It doesn't touch the unused capacity, and the README says explicitly that zeroing does not make that capacity valid data. Figure 6 shows both in the worst-case allocation from above.

Alignment gaps and unused capacity
Figure 6: The expanded output of a dispatch with `do_cpu_sync=False`, sized for the worst case. Alignment gaps sit between the expert segments and are zeroed by `do_zero_padding=True`; the unused capacity after the last segment is never valid data.

With uniform routing, a GPU receives about 32,768 expert rows on average (8 GPUs x 4,096 tokens x 8 experts, spread over 8 GPUs), so about seven eighths of the worst-case allocation is unused capacity, and only the counts on the GPU tell the next kernel where it begins.

The expanded tensor is also still the flat, contiguous layout, with all segments one after another. DeepGEMM's masked GEMM from part 1 wants a three-dimensional [experts, max rows, hidden] slab instead, so a framework that uses it has to copy the segments over, as SGLang does with its expand_to_masked_slab kernel (part 3, section 8). And a dispatch that can be captured in a graph doesn't make the whole MoE layer capturable: every kernel after it has to work with fixed allocations and device-side counts as well.

Notice that these choices are independent of direct versus hybrid. Either mode can expand or not, and either can keep the counts on the GPU. In V1, the choice of kernel family decided both the transport and the layout; in V2.5, they are separate arguments.

3.3 Reusing a Layout

A cached handle lets dispatch skip the work whose answer is already known: the counting, the slot assignment and the prefix sums. V2.0 already had this for the plain layout, and V2.5 extends it to the expanded one, which is what a training backward pass needs, since it sends gradients along exactly the routes of the forward pass. It is not a cache for consecutive decoding steps, though, because a new batch of tokens comes with new router choices and needs a new dispatch.

The handle keeps a reference to topk_idx, and here V2.5 does something nice: it checks that nobody has changed that tensor in the meantime, using the version counter that PyTorch increments on every in-place write:

# deep_ep/buffers/ep.py at 93eb6eb, EPHandle
# (cut down; excerpt, not a standalone program)
self._topk_idx = topk_idx
self._topk_idx_version = (None if topk_idx.is_inference()
                          else topk_idx._version)

@property
def topk_idx(self) -> torch.Tensor:
    assert (self._topk_idx_version is None or
            self._topk_idx._version == self._topk_idx_version), \
        '`topk_idx` must not be modified while the EP handle is in use'
    return self._topk_idx

(Some lines are wrapped.) Inference tensors have no version counter, so the check is skipped for them, and a CUDA graph that writes the next batch's routing into the same tensor with a kernel would not be caught either. So the rule from the docstring still holds: don't modify topk_idx until every use of the handle has finished.

One more detail of the plain layout caught a bug in my own measurement harness. A row in the non-expanded output keeps all top-k router weights of its token, including the weights of experts that live on other GPUs, whose local indices are marked as -1. My first identity-expert reference summed all weights on every receiver, so it counted each weight once per destination GPU and made combine look wrong. The fix is to mask the weights wherever the local expert index is negative, which is what a real expert computation does anyway.

4. Waiting for an Epilogue

4.1 What the Deferred Epilogue Defers

V2 could already run dispatch asynchronously and hand back an event. V2.5 adds defer_epilogue=True, which only works together with async_with_compute_stream=True. To see what it does, we need to look at what a dispatch call consists of on the C++ side. The second half of the call is written as a closure, so that it can either run right away or be handed to the caller:

// csrc/buffers/ep.hpp at 93eb6eb, EPBuffer::dispatch (cut down)
launch_dispatch(..., num_sms, ..., comm_stream);   // the protocol kernel

auto epilogue = [=, this](const at::cuda::CUDAStream& stream, ...) {
    if (do_cpu_sync) {
        pybind11::gil_scoped_release release;
        // ... spin on the host-mapped counts, as in part 1
    } else {
        // ... sizes for the worst case
    }
    auto recv_x = torch::empty({num_allocated_tokens, hidden}, ...);
    // ... allocate the other outputs
    launch_dispatch_copy_epilogue(..., jit->device.get_num_sms(), ...,
                                  stream);          // all SMs
    return result;
};

if (defer_epilogue)    // hand the closure to Python, run it at the wait
    return pybind11::make_tuple(pybind11::none(), event, epilogue_hook);
auto result = epilogue(comm_stream, ...);           // run it now

So the epilogue contains three things: the CPU wait for the counts (if requested), the allocation of the outputs, and the copy-epilogue kernel, which runs on all of the GPU's SMs and not on the communication budget. Without deferral, all three happen inside the dispatch call, on the communication stream. With deferral, dispatch returns as soon as the protocol kernel is launched, and the closure runs when the caller waits on the event, on whatever stream is current at that moment.

That helps in two ways. First, the CPU is free to enqueue other work before it blocks on the counts, which matters most with do_cpu_sync=True, where an immediate epilogue would stall the Python thread right after the launch. (The wait also releases Python's GIL, so that other threads, for example one that transfers KV cache, can keep running.) Second, the all-SM copy kernel no longer runs between the dispatch kernel and the independent work, where it would compete with that work for SMs. On the Python side, it looks like this:

# DeepEP V2.5 interface example; excerpt, not a standalone program.
event = buffer.dispatch(
    x, topk_idx=topk_idx, topk_weights=topk_weights,
    num_experts=num_experts, do_expand=True,
    do_cpu_sync=False, async_with_compute_stream=True,
    defer_epilogue=True,
)
# The framework can schedule independent work here.
recv_x, recv_idx, recv_weights, handle = event.current_stream_wait()

current_stream_wait() makes the current stream wait for the communication event, then calls the registered hook, which runs the epilogue and returns the outputs. For combine, the same option defers the reduce epilogue that adds the partial sums and writes the final output, so attention or another micro-batch can run before it.

The hook runs only once. EventOverlap sets hook_after_wait back to None after calling it, so a second wait returns None instead of running the epilogue again. A framework has to keep the result of the first wait.

Figure 7 compares this with V1's receive hook from part 1.

V1 network waiting and V2.5 deferred epilogues
Figure 7: V1's receive hook leaves the RDMA transfer to the network card between two short kernels. V2.5's protocol kernel occupies its SMs until the data has arrived, and what moves to the consumer is the epilogue that produces the result.

4.2 What Overlap Still Needs

As we can see in Figure 7, the two hooks are not the same thing. V1's low-latency kernels could post their RDMA writes and leave, so the network card moved the data while the SMs did something else. V2.5's dispatch and combine kernels hold their SMs until the protocol has finished, and the README says plainly that "zero-SM RDMA EP is not supported". Deferring the epilogue moves the wait and the copy to the point where the result is consumed, but it can't create SMs for the overlapping work. If the communication kernel and the GEMM together need more SMs than the GPU has, or if the next kernel needs the received tokens right away, the deferral buys nothing.

So whether a framework gains from it can only be measured as a whole schedule: two micro-batches with and without deferred epilogues, with the same GEMMs, the same routing and the same graph setup. My measurements in section 9 time the communication alone, so they say how long the operations take, but not how much of that time a schedule can hide.

5. An SM Budget From Routing

5.1 Counting Destinations Before Counting Bytes

V2.5 keeps V2's idea of computing the number of SMs from a model of the traffic instead of a tuning table, so let's first recall how many destinations a token has. If the router picks k distinct experts uniformly from E experts, spread evenly over P ranks, then each rank owns E/P experts, and the chance that a token misses a given rank entirely is the number of ways to pick all k experts from the other ranks' experts, divided by the number of ways to pick them from all experts. One minus that, times P, is the expected number of destination ranks. Here it is with exact combinations, which is the same formula as V2's get_expected_topk from part 3:

from math import comb

def expected_destinations(experts, topk, groups):
    assert experts % groups == 0
    other = experts - experts // groups
    misses = comb(other, topk) / comb(experts, topk)
    return groups * (1 - misses)

for ranks in (8, 32, 64):
    print(ranks, round(expected_destinations(256, 8, ranks), 3))
# 8: 5.295; 32: 7.267; 64: 7.676

For EP64 as eight domains of eight GPUs, the same formula with 8 groups gives 5.295 destination domains, against 7.676 destination GPUs. So with uniform routing, hybrid mode cuts the copies that a token's GPU sends from about 7.7 (one per destination GPU) to about 5.3 (one per destination domain), before we subtract the local ones, and then forwards them to the individual GPUs inside each domain. That is a smaller saving than V1's one-group-per-machine example in part 1, where the group limit kept every token on at most 4 machines.

Part of each count is local, too. A token that selects experts on its own GPU sends nothing over NVLink for them, so with symmetric routing, only a fraction (P - 1)/P of the destination ranks are remote, and the same goes for domains. If you forget this correction and divide all delivered bytes by the time, you can end up with a "bandwidth" higher than the link can carry. Figure 8 shows both counts as the group grows.

Expected rank and domain destinations for uniform routing
Figure 8: Expected destinations for V3's 256 experts and top-8 selection, with eight ranks per domain. The rank count approaches eight as the group grows, while the domain count grows more slowly. The calculation assumes even expert placement and uniform routing, not V3's group-limited router.

The source of get_theoretical_num_sms warns that its model doesn't apply to V3's group-limited routing, and redundant experts change the picture again, since they change which GPU owns which expert copy. As we saw at the end of part 1, EP320 can't be treated as 256 experts spread evenly over 320 GPUs. A real deployment has to run this kind of calculation with its own placement and its own router.

5.2 What the Budget Includes

V2's estimate in part 3 only looked at dispatch. V2.5's version adds two terms for combine, uses slightly lower per-SM bandwidths (180 GB/s for reads and 45 GB/s for writes, both marked in the source as defaults to be replaced by per-architecture values), adds a 30% margin instead of 25%, and rounds up to a multiple of 4. For a single NVLink domain, the whole model fits in a few lines:

from math import comb, ceil

def v25_num_sms(ranks, nvlink_gbs, experts=256, top_k=8,
                sm_read=180, sm_write=45):
    """V2.5's SM estimate for one NVLink domain (no RDMA)."""
    other = experts - experts // ranks
    k = ranks * (1 - comb(other, top_k) / comb(experts, top_k))
    read, write = 1 / k, 1.0         # SM bytes per received byte
    nvl = 1 - 1 / ranks              # NVLink bytes per received byte
    scale = nvlink_gbs / nvl
    need = max(scale * read / sm_read,             # dispatch
               scale * write / sm_write,
               scale * (write - nvl) / sm_read,    # combine
               scale * (read + nvl) / sm_write)
    n = max(4, ceil(need * 1.3))
    return (n + 3) // 4 * 4

b300 = 18 * 53.125 * 0.9             # 18 links, 90% of their sum
for ranks in (4, 8):
    print(f"EP{ranks}: {v25_num_sms(ranks, b300)} SMs")
# EP4: 36 SMs
# EP8: 32 SMs

These are exactly the automatic budgets that V2.5 chose on the B300 machine for EP4 and EP8. The scale is the rate at which received data arrives when NVLink is fully busy, and each term asks how many SMs it takes to read or write the corresponding bytes at that rate. In dispatch, an SM reads each token once (1 / k per received copy) and writes every copy. In combine, the roles swap: the expert side stores the partial sums back over NVLink and writes the final outputs, so the NVLink bytes now count as writes. On this machine, that last term is the largest one for both group sizes (23.3 SMs before the margin for EP8), which means the combine sets the budget. The real function also caps the result at the number of SMs on the device. Figure 9 shows all four terms for both group sizes.

The four terms of the SM model
Figure 9: The number of SMs that each term of V2.5's model needs to keep up with NVLink on the B300 machine, before the 30% margin. The combine's write term is the largest for both EP4 and EP8.

The two write terms are more than ten times as large as the read terms. One reason is that the model gives an SM only a quarter of the bandwidth for writes that it gives for reads (45 against 180 GB/s). The other is that every received byte has to be written, while a token is read only once for all of its copies. The combine's write term is a little larger than the dispatch's, because the model counts both the final outputs (1 / k per received byte) and the partial sums stored over NVLink (nvl) as writes, which adds up to 1.06 for EP8 against 1.0. The margin and the rounding then turn 26.2 and 23.3 SMs into 36 and 32.

With prefer_overlap_with_compute=False, the function returns at least 64 SMs, since then there is no GEMM that needs the rest. Which setting is right can't be answered by timing the communication alone: an isolated dispatch may finish sooner with 64 SMs, while the layer as a whole may finish sooner with 32, because the expert GEMM running next to it keeps more SMs.

The model also has some blind spots that are worth knowing about. It doesn't look at the current batch size or at launch latency, so it recommends the same 32 SMs for 16 and for 4,096 tokens per rank, and the source lists expansion and the multiple-reduction option as TODOs. For a decoding batch, where launch overhead dominates, I would measure a few budgets at the real batch size instead of trusting the formula.

5.3 Reduction Order and Determinism

As in V2, combine can add up a token's expert outputs inside a domain before sending one partial sum back, which saves network traffic when several of its experts share a domain. allow_multiple_reduction=True allows this. Since the partial sums are stored in BF16 before they are sent, a token's output is rounded once per level, so changing the reduction tree can change the result slightly even when every transfer is correct. A numerical reference for testing has to round at the same points, which is separate from the error of the FP8 input or the FP4 weights.

V2.5 also changed how deterministic=True works. In V2.0 (part 3), a prologue kernel assigned every token its slot from prefix sums in token order before the dispatch kernel ran. In V2.5, the dispatch runs with the usual atomicAdd slots, and afterwards EPHandle.deterministic_sort sorts the received rows by their source token's global index with a few PyTorch operations (torch.sort and a permutation), so the output order no longer depends on which warp won which atomic. In expanded mode, it sorts within each expert's segment and updates the handle's slot pointers to match. That makes the dispatch output reproducible for a given batch, but the GEMMs and reductions downstream can still depend on the batch shape, so it doesn't make a model's outputs batch-invariant by itself.

6. Redundant Experts Need More Than a Router Map

An expert that receives twice as many tokens as its neighbors can hold up the whole layer, since every GPU waits for the slowest one. A common fix is to place a second copy of that expert on a less busy GPU and send some of its tokens there. The model still has the same logical experts, but the runtime now has more physical expert slots than experts, as we saw with V3's EP320 in part 1. The README credits two projects that explore this, Moonshot's MoonEP and UltraEP.

V2.5 adds the data movement for those slots. lb_prefetch_weights copies expert weights from their owner GPUs into redundant slots on other GPUs before the expert computation runs, and lb_reduce_grads does the reverse in the backward pass. Both work only within one NVLink domain, and every rank of the domain has to call them, even a rank without redundant slots, since they start and end with a barrier.

The plan is a redundancy_mapping tensor of shape [GPUs in the domain, redundant slots per GPU], identical on every rank. Entry [r, c] names the expert that goes into slot c on GPU r, as owner_rank * local_experts + local_index, or -1 for an empty slot, and a GPU may not hold a replica of its own expert. The redundant slots have to live in a separate registered region (planned with a BufferAllocator), while the original weights can stay in ordinary CUDA tensors.

The prefetch kernel moves each expert in chunks: a warp loads a chunk of the owner's weights into shared memory with TMA and stores it into the peer's redundant slot with a TMA store over NVLink. The API takes a list of tensors, so the packed FP8 or FP4 weights and their scale tensors can be copied in one call, and that matters, since a replica with new weights and old scales would compute garbage. Each pair of tensors needs the same number of bytes per expert, a multiple of 32.

The gradient reduction is the more interesting kernel. Each redundant copy accumulates gradients from the tokens that were routed to it, and those have to be added into the owner's gradients before the optimizer step. The owner loads a chunk of a replica's gradients from the peer into shared memory and then writes it into its own gradient tensor with tma_store_reduce_add_f32, a TMA store that adds to the destination instead of overwriting it. The addition happens in the memory system, not in the SM's registers, and the API takes FP32 gradients only. The owner's own contribution must already be in its gradient tensor (or zeros, if it had none), since the reduction adds to it. Figure 10 puts the two kernels side by side.

Prefetching weights and reducing gradients
Figure 10: The two load-balancing kernels for one redundant copy. In the forward pass, the owner's warps push the weights through shared memory into the peer's slot. In the backward pass, the owner pulls the replica's gradients and adds them into its own tensor with a TMA reduce-add.

Notice that the owner does the work in both directions: it pushes the weights out, and it pulls the gradients in. So the additions happen in the owner's own memory, which is where the optimizer step reads the result.

What these functions don't do is decide anything. They don't detect which expert is hot, choose a placement, rewrite the router's owner map, or decide when it is safe to switch. The framework has to pick a boundary between batches, copy a consistent version of the weights, switch the routing only after the copy has finished, and, in training, reduce the replica gradients before the optimizer touches the weights. It also has to decide whether a placement is worth it: copying an expert's weights costs something once, and it only pays off if the imbalance it removes lasts for enough later batches. My benchmark only covers dispatch and combine, so I can't say where that break-even point is.

7. The Model and Kernel Timeline

Parts 2 and 3 already placed several DeepSeek models next to the library releases. In this section, I want to put all of them on one timeline, from V3 to V4.1, and say for each one what the connection to DeepEP and DeepGEMM actually is. Sometimes a paper names a kernel, sometimes a model card names a format, and sometimes the only connection is that two things happened in the same month, which tells us much less.

7.1 V3 and the Original Split

The DeepSeek-V3 report describes H800 machines with eight GPUs connected by NVLink and InfiniBand between machines. Training ran as EP64 across eight machines. Prefill ran as EP32 on four machines, with redundant experts to spread the heavy ones, and decode as EP320 on forty machines, with the shared expert treated as a routed expert that every token selects. These two deployments explain V1's two kernel families from part 1 quite directly: prefill has large batches that can afford a count exchange and benefit from NVLink forwarding, while decode needs small fixed allocations and low latency, and the two GEMM layouts follow from the same split.

The 2025 updates of the model family kept this MoE shape. For example, the R1-0528 configuration still has hidden size 7,168, 256 routed experts, top-8 selection and an expert intermediate size of 2,048. A new reasoning model on the same shape doesn't need a new communication library, and nothing in the configuration says which one DeepSeek used to serve it.

7.2 Blackwell Changes the Scale Format Before V2

The first DeepGEMM release supported only Hopper (SM90), with FP32 scale factors. On July 20, 2025, DeepGEMM added Blackwell (SM100) kernels, and its README now describes two formats at the dispatch/GEMM boundary: FP32 scales on SM90 and packed UE8M0 scales on SM100, four exponent-only bytes per 32-bit integer, both in a transposed, TMA-aligned layout. Part 2 showed that DeepEP added UE8M0 handling to V1 in June 2025, and that V3.1's model card in August named UE8M0 scales for weights and activations and pointed to DeepGEMM. So the scale format changed during V1, long before the V2 rewrite.

This matters because moving FP8 values quickly is not enough if the scales that come with them need a transpose, a padding copy or a conversion before the tensor cores can use them. It also means that Blackwell support did not start with V2 in April 2026. V1 compiled and ran on Blackwell long before that, but, as part 1 showed, its register copies and ring buffers were designed for H800's much slower NVLink, so running on Blackwell and making good use of it are different things.

A note on names: our B300 GPUs report compute capability 10.3. They are Blackwell GPUs, and DeepGEMM's SM100 kernels run on them, but "measured on SM100" would hide which GPU the numbers come from, so I always say B300. The numbers in this series don't transfer to H800, B200 or a rack-scale NVLink system.

7.3 V3.2 Adds an Attention Consumer

On September 28, 2025, DeepGEMM added the scoring kernels for the lightning indexer, and V3.2-Exp launched the next day with DeepSeek Sparse Attention, on top of V3.1-Terminus. The final V3.2 followed on December 1, and its technical report explains how the indexer scores earlier token positions so that attention only has to look at the selected ones.

The indexer and the MoE router both pick a top-k, but of different things: the indexer picks token positions and the router picks experts. So the index count in a V3.2 checkpoint is not the num_topk of an EP buffer, which stays at 8 for this shape. V3.2 gave DeepGEMM a new consumer of low-precision matrix products, but the expert-parallel library at the time was still V1.

7.4 V4 and the Fused MoE

DeepGEMM's April 2026 update added FP8-by-FP4 GEMMs and Mega MoE (announced in the README on April 16, merged on April 17), V4 Preview launched on April 24, and DeepEP V2 followed on April 30. The V4 report names Mega MoE, DeepGEMM PR 304, as its fused MoE implementation, and describes FP4 quantization-aware training for the expert weights and for the QK path of the indexer: FP32 master weights during training, with the FP4 quantization simulated in the forward pass, and native FP4 expert weights for inference and rollouts. That is a direct connection between the model and DeepGEMM. Between Mega MoE and V2, the only connection I can see is the timing, so I wouldn't say that one caused the other.

The V4 configurations also show that one model family can have quite different communication shapes. V4-Flash has hidden size 4,096, 256 routed experts, top-6 selection and intermediate size 2,048, while V4-Pro has hidden size 7,168, 384 routed experts, top-6 selection and intermediate size 3,072. Both store their experts in FP4, with FP8 quantization settings and UE8M0 scales.

FP4 weights don't make the communication cheaper, though, since what dispatch and combine send are activations, not weights. Let's compare the activation bytes with the arithmetic of one expert. Ignoring the nonlinearity, the three projections of an expert with hidden size H and intermediate size I cost about 6 * H * I FLOPs per (token, expert) pair (2 FLOPs per multiply-add, three H-by-I matrices). An FP8 token on the way in and a BF16 output on the way back are 3 * H bytes, before metadata and deduplication, so the ratio is about 2 * I FLOPs per byte:

hidden, intermediate = 7168, 2048  # V3 expert shape
expert_flops = 6 * hidden * intermediate
activation_bytes = hidden + 2 * hidden
print(expert_flops // activation_bytes)  # 4096 FLOPs/byte
# V4.1's intermediate size 2304 gives 4608 FLOPs/byte.

Notice that the hidden size cancels out, so only the expert's intermediate size matters, and it barely changed between V3 and V4.1. This is an idealized ratio per copy. A GPU that owns several of a token's experts receives one copy and returns one partial sum for all of them, which raises the ratio, while small expert batches leave the GEMM underutilized, which effectively lowers it. That is why the batch sizes and the expert placement belong in a benchmark description, next to the precision.

7.5 V4.1 Expands the Boundary Again

V4.1-Flash launched on September 10, 2026, the same day as a DeepGEMM update with Mega Gate, Mega mHC, a sparse indexer and DeepJIT, and DeepEP V2.5 followed on September 29. The V4.1 report names DeepGEMM's fused kernels in its inference system, and it also describes a causal encoder-decoder architecture, attention reuse across layers, and Engram tables whose addresses are known in advance, so that their rows can be prefetched from host memory over RDMA in the background.

That is several kinds of communication in one model: routed expert activations need EP, table rows need a lookup from storage, and pipeline stages pass activations along. V2.5's separate buffer classes line up with those quite well. The report doesn't say which implementation runs in DeepSeek's deployment, though, so I read this as a match in structure, not as evidence that EngramBuffer is what serves V4.1.

The V4.1-Flash configuration gives us the second MoE shape for the measurements: hidden size 5,120, 384 routed experts, top-6 selection and intermediate size 2,304, with FP4 experts, FP8 quantization and UE8M0 scales. Each of those settings describes a different tensor. The KV cache in the report uses yet another 4-bit format, and none of these decide what format the activations have when they enter EPBuffer.dispatch. My benchmark uses BF16 inputs or FP8 inputs with FP32 scales per 128 channels at this shape. It doesn't convert to packed UE8M0, and it leaves out the router, the expert GEMMs, Engram and attention, so it measures the communication at V4.1's shape and nothing more.

Figure 11 puts the model launches and the library releases on separate tracks.

Model releases alongside DeepEP and DeepGEMM updates
Figure 11: Blackwell scale and layout support arrives during V1, before V2's transport rewrite. V4 and V4.1 name DeepGEMM kernels in their reports, while DeepEP's release dates sit near the model launches without a stated connection.

As we can see in Figure 11, the scale format went through three steps in 2025: DeepEP's UE8M0 handling in June, DeepGEMM's SM100 kernels in July, and V3.1's model card in August. The V4 connection is a different kind, since the report names a specific fused kernel. And DeepEP's own releases have no stated connection to any model, which is why I keep the tracks apart.

8. What the Other Buffers Add

The three other buffer classes get one section here, since my measurements don't cover them.

EngramBuffer fetches rows of lookup tables that can live in GPU or CPU memory on other machines. fetch(indices) takes the row indices of several layers at once, as a [layers, tokens, entries per token] tensor, issues all the RDMA reads, and returns one hook per layer, so each layer waits only for its own rows. This works because an Engram row's address depends only on the token IDs, which are known before the first transformer layer runs. An expert activation can't be sent that early, since its destination depends on the router's output in the same layer. The README notes that Engram needs an NCCL build with ncclGinOptFlagsWarpGet, and since the reads go over RDMA, I couldn't run it on this machine.

PPBuffer sends and receives activation tensors between neighboring pipeline stages, in a group that has to be RDMA-only. Its send and recv take their own num_sms, and if you leave it at None, they use all SMs. So configuring EPBuffer to leave SMs free says nothing about what a pipeline transfer will take.

BucketBuffer offers batched all-gather, reduce-scatter and all-reduce, which V2.0 only had in part (part 3 found only the all-gather). The all-gather runs on the copy engines without SMs, while reduce-scatter and all-reduce need SMs for the additions and, inside an NVLink domain, NCCL's multimem support. A session() lets you pass ordinary tensors by staging them into the bucket's storage and copying the results back, and those copies cost time too. At this commit, the constructor also asserts that both an NVLink and an RDMA bandwidth can be detected, even for a group that only uses one of them, so I couldn't construct a BucketBuffer on this machine at all.

9. Measurements in the CUDA 13.4 Container

9.1 What Was Timed

The container has CUDA toolkit 13.4.92, PyTorch 2.14.1+cu130 and NCCL 2.32.3. (The +cu130 suffix describes how PyTorch was built; DeepJIT compiles the kernels with the 13.4 toolkit.) The installed deep_ep reports version 2.5.0, and the benchmark calls the upstream EPBuffer directly, from the source pinned at 93eb6eb.

I measured EP4 and EP8, always inside the one NVLink domain of the machine. EP4 covers 128 and 4,096 tokens per rank, and EP8 adds 16 and 512. Each runs the V3 and V4.1 shapes, with BF16 or FP8 dispatch and with expanded or plain outputs. The router picks distinct experts uniformly at random with equal weights, which gives the right dimensions with a controlled workload; a real router produces a different distribution.

Before any timing, each configuration checks the received rows against the original inputs, using the source-token metadata and routing counts gathered independently. Then an identity expert applies the local router weights, and combine is checked against the input. For FP8, the reference is the quantized and dequantized input, so that the quantization error isn't blamed on combine. Across the 96 configurations of the EP4 and EP8 runs, dispatch matches its reference exactly, and the largest absolute difference after combine is 0.015625, within BF16 rounding. A fresh dispatch after the graph replays checks that the buffer can be reused.

An identity expert keeps the round trip easy to check, but it can't catch a mix-up between two experts that get the same input. So a separate EP8 test uses non-uniform router weights and a different diagonal transform for every expert, and its sixteen configurations pass against the independent reference (data/weighted.log and methodology.md have the details). Another small two-GPU BF16 test exercises the new interfaces from sections 3 and 4: deferred dispatch and combine, the one-time hook, cached expanded dispatch, and zeroed alignment gaps, each in deterministic and non-deterministic mode. All checks pass (data/contracts.log). None of this tests RDMA, expert migration or gradients.

For timing, I used FlashInfer's bench_gpu_time_with_cupti, with CUDA graphs and a cold L2 cache on every rank. After the utility's own warm-up, each operation gets five dry runs and then thirty measured runs for each of two routing seeds. The timer spans from the start of the first kernel to the end of the last one, so it includes the protocol kernel and its epilogue. For each run I take the slowest rank, compute the median per seed, and report the median of the two seed medians. The cold L2 cache matters, because the graph replays the same inputs over and over, and without flushing, the tokens would still be in L2 from the previous run.

The first sample of a record is always much slower: in 272 of the 288 records it is more than ten times the median. I kept those samples in the data and in the medians. My guess is that the profiler's start-up and launch skew between the ranks cause it, since the harness doesn't synchronize the ranks again after CUPTI starts, but I didn't verify that. With only two seeds, the percentile bands in the charts describe these replays, not the tail latency of a server.

Input generation, FP8 casting, the reference checks, JIT compilation and everything on the CPU happen outside the timed region. So these are GPU operation times, which are not the same as end-to-end serving latency, and also not the same as the summed kernel durations in parts 1 to 3, which leave out the gaps between kernels and used a different software stack and no cache flushing. I kept the older numbers in their parts, but I don't compute speedups across the two methods.

9.2 Payload Size and Expansion

At EP8 with 4,096 tokens per rank and the automatic 32 SMs, the V3 shape takes 526.4 us for a plain BF16 dispatch and 280.1 us for FP8. Combine sends BF16 in both cases and takes about 499 to 500 us. So FP8 almost halves the dispatch, but since the combine format doesn't change, the round trip only gets about a quarter faster, from about 1,026 to 779 us.

The V4.1 shape has a smaller hidden size (5,120 instead of 7,168) and selects 6 experts instead of 8, so it moves less data per token. With the same setup, its FP8 dispatch takes 172.3 us and its combine 308.9 us. That says nothing about which model is faster overall, since the two differ in their layers, attention, memory lookups and compute.

Expansion adds local copies after the data has arrived, and on the way back, combine has to find and add up each token's expert rows. For the large V3 FP8 case, the expanded dispatch takes 301.4 us and combine 540.6 us, and for V4.1, 185.9 and 322.8 us. Figure 12 shows all batch sizes, including the small ones, where fixed overheads dominate.

Operation latency across batch sizes and output layouts
Figure 12: EP8 at the automatic 32-SM budget, FP8 dispatch with FP32 scales per 128 channels and BF16 combine, expert alignment 1. Lines are the median of two per-seed medians, and the shaded bands span the per-seed 10th to 90th percentiles. Each point uses thirty cold-L2 CUDA-graph samples per seed, timed with CUPTI on the slowest rank. Commands and raw samples are in `data/commands.txt`, `ep8.jsonl` and `methodology.md`.

As shown in Figure 12, the small batches behave differently. At 16 tokens per rank, V3's FP8 dispatch takes about 27.6 us, against 23.7 us for BF16, so sending half the bytes made it slower. I suspect the extra work for the scales costs more than the bytes it saves at that size, but I didn't isolate the cause, and two seeds are not enough for a confidence interval. Either way, it is a good reason to measure the real decoding batch instead of extrapolating the large-batch ratio.

EP4 is a different workload, even at the same number of tokens per rank. Each GPU holds twice as many experts, so more of a token's experts share a destination, and the whole group has half as many tokens. At 4,096 tokens per rank, V3's plain FP8 dispatch takes 176.2 us and combine 309.9 us, and V4.1 takes 120.1 and 209.3 us. The automatic budget is also 36 SMs here instead of 32, so comparing EP4 with EP8 mixes the group size, the payload and the deduplication, and doesn't tell us how well the library scales.

The raw records also contain a payload rate: the average number of distinct rows received per rank, times the bytes per row, divided by the slowest rank's time. For an FP8 dispatch of the V3 shape, a row is 7,168 bytes of values plus 224 bytes of scales, and for the BF16 combine it is 14,336 bytes. This rate counts the rows that a GPU sends to itself and leaves out metadata, signals, padding and the epilogue's copies, so it is a measure of useful payload per second, not of NVLink bandwidth.

The registered EP buffer at 4,096 tokens per rank takes 450 MiB per rank for the FP8 V3 case and 242 MiB for FP8 V4.1 (452 and 324 MiB with BF16 dispatch). The reported buffer.num_bytes leaves out the separate GPU and host workspaces, the output tensors (which, as section 3.2 showed, can be much larger in the no-sync expanded mode), the cached JIT kernels, and of course the model's weights and KV cache.

9.3 How Many SMs to Give Communication

For the SM sweep, I used FP8 dispatch and BF16 combine with budgets of 8, 24 and 64 SMs, at 128 and 4,096 tokens per rank. For the large V3 case with plain outputs, dispatch goes from 409.0 us with 8 SMs to 312.2 us with 24 and 283.2 us with 64, and combine from 851.4 us to 540.0 and 495.7 us. The automatic 32 SMs give 280.1 and 498.6 us, which is as fast as 64 SMs. The few microseconds between the two come from separate runs, so I wouldn't call either one faster.

Operation time as the communication SM budget changes
Figure 13: EP8, 4,096 tokens per rank, plain outputs. Each point is the median of two per-seed medians of thirty cold-L2 CUDA-graph samples, timed with CUPTI on the slowest rank. `data/commands.txt` has the full invocation and `sms.jsonl` every sample.

As shown in Figure 13, the V4.1 shape behaves the same way: its large dispatch goes from 251.5 us with 8 SMs to 190.0 and 174.0 us with 24 and 64, and its combine from 523.8 to 335.0 and 303.6 us. At 128 tokens, though, dispatch takes 27.4 us with 24 SMs and 29.4 us with 64, so more SMs didn't help at all. That fits the model's blind spot from section 5.2: at small batches, the time goes into fixed costs that more SMs can't shorten.

No GEMM runs next to these operations, so the sweep only shows what the communication costs by itself. An expert kernel next to a 64-SM dispatch has 32 fewer SMs than one next to a 32-SM dispatch, and only a measurement of the whole layer, with two micro-batches or a pipeline schedule, can say which budget makes the layer faster.

10. Using V2.5 in a Serving Framework

To close, here is what I would check when moving a framework to V2.5, in the order I would check it.

First, the interface. V2's ElasticBuffer and V2.5's EPBuffer are different classes, and with deferred epilogues, dispatch returns either a tuple or an EventOverlap, depending on an argument. A framework written for V2 needs an adapter that understands the new handles, outputs and completion rules, and having a V2.5 wheel installed doesn't mean that adapter exists. That is also why my benchmark calls deep_ep.EPBuffer directly: the container has a development sgl-deep-ep wrapper for SGLang, but nothing in this article tests SGLang's integration, its correctness or its throughput.

Second, the topology and the owner map. How many GPUs share one LSA domain, which remote GPUs are reachable over a rail, and how many destination GPUs and domains does the real router produce per token, with the replicas included? Only with those numbers can we decide between direct and hybrid mode, and estimate whether deduplication saves enough RDMA traffic to be worth the forwarding.

Third, the layout through the whole layer. Keep the received rows, the expanded rows and the allocated capacity apart, check the GEMM's alignment and scale format, and find every transpose, padding copy or FP8 cast between dispatch and the tensor cores. Those can be fused into other kernels, but they don't disappear when we compare buffer interfaces.

Finally, place each wait where its data is first used, and measure what overlaps with it. A deferred epilogue only helps if there is independent work to run before the result is needed, and enough SMs for that work. For a small decoding batch, launch and synchronization costs matter more than the bytes, while for a large prefill batch, the buffer sizes and the SM budget are what show up in the total.

11. Summary

To summarize, V2.5 keeps V2's transport and changes how the caller controls it:

  1. What is sent. As in V2, each token is sent once per destination GPU, or in hybrid mode once per destination domain and then forwarded over NVLink. The activation format (BF16 or FP8 with FP32 or UE8M0 scales) is independent of how the expert weights or the KV cache are stored.
  2. How the receiver knows. NCCL's teams decide which destinations get an NVLink store and which a GIN put, so the topology comes from memory access instead of a fixed machine size. A deferred event lets the caller place the count wait and the epilogue at the point where the result is used.
  3. The layout. The caller chooses between one row per received token and aligned expert segments, and between counts on the CPU and counts on the GPU, independently of the transport mode. Expanded layouts can now be cached for the backward pass, and alignment gaps can be zeroed.
  4. The cost. The SM model now covers combine as well and picks 32 SMs for EP8 on B300, which is as fast as 64 in isolation. The protocol kernels still occupy their SMs, the worst-case outputs of the no-sync mode can be large, and the copy epilogue runs on all SMs wherever it is placed.

Around these four answers, V2.5 adds what a deployment of a model like V4.1 needs besides expert parallelism: weight and gradient transfers for redundant experts, table lookups for Engram, pipeline transfers and collectives, each with its own buffer. Which of them pay off depends on the placement, the routing and the workload of a real deployment, which my measurements here don't cover.

The measurement bundle contains the harnesses, raw samples, commands, verification logs and review notes.

Sources