Multi-Node DeepSeek-V4-Flash (283B MoE)¶
Full source in examples/deepseek_v4_flash.rs. Run a local 4-device CPU smoke test with JACOBI_BACKEND=cpu cargo run --release --example deepseek_v4_flash -- --small --fp8 --efficient-train.
What This Shows¶
- Topology-aware 2D multi-node parallelism (
Mesh::hybrid_dp_ep(),DP=2 x EP=8) across 2 nodes / 16x H200 GPUs over ConnectX-7 GPUDirect RDMA with token-authenticated coordinator (JACOBI_COORDINATOR_TOKEN) - Live next-token cross-entropy training on Hugging Face
PleIAs/SYNTHviahub::load_dataset(or--tokens-filefor up to 1B+ pre-tokenized tokens) - 282.64B-parameter architecture (
43layers,256routed FP8 experts at32experts/GPU with top-6 routing, plus shared expert) - Low-rank MQA (
64query heads,1KV head,D=512,64-dim partialRoPE) accelerated by GQA/MQA-collapsed tilednn::flash_attentionandnn::sage_attentionduring batched Rollout - Manifold-Constrained Hyper-Connections (
mHC,4residual streams with hoisted batched 20-iteration Sinkhorn doubly stochastic mixing) EfficientAdamW::value_and_grad_hybridreducing per-GPU optimizer state by99.0%(1.59 GB/GPUvs160.97 GB/GPUfor full AdamW underFp8UpdateMode::StochasticRounding) and syncing compact rank-32 gradient factors across nodes over RDMA
2D Hybrid Mesh (DP x EP) and Gradient Sync¶
When launched across multiple nodes (JACOBI_NUM_PROCESSES > 1), Mesh::hybrid_dp_ep() keeps high-bandwidth Expert Parallel AllToAll inside each 8-GPU NVLink node ("ep") and runs Data Parallel gradient reduction across nodes ("dp"). Coordinator authentication via JACOBI_COORDINATOR_TOKEN is required by default.
let mesh = Mesh::hybrid_dp_ep()?;
let eff_step = shard_map(
mesh.clone(),
vec![PartitionSpec::replicated()],
vec![PartitionSpec::replicated()],
move |(mut shard, mut opt, ids): (DeepSeekV4Shard, EfficientAdamW<DeepSeekV4Shard>, Tensor)| {
let (loss, grads) = opt.value_and_grad_hybrid(
|p: DeepSeekV4Shard| p.forward_loss(&cfg_t, ep_size, &ids),
&shard,
&["ep", "dp"],
|name| {
if !name.starts_with("w_") {
vec!["ep", "dp"]
} else {
vec!["dp"]
}
},
);
opt.step(&mut shard, &grads);
(shard, opt, loss)
},
);
Running on Single Node or Multi-Node RDMA Clusters¶
# Local 4-device CPU smoke test (4 layers, 16 experts, FP8 + EfficientAdamW)
JACOBI_BACKEND=cpu cargo run --release --example deepseek_v4_flash -- --small --fp8 --efficient-train
# Node 0 (coordinator, rank 0) — 16x H200 training on PleIAs/SYNTH
JACOBI_NUM_PROCESSES=2 JACOBI_PROCESS_ID=0 JACOBI_COORDINATOR_ADDR=10.0.2.6:29500 \
JACOBI_COORDINATOR_TOKEN=your-cluster-secret NCCL_SOCKET_IFNAME=enp0s28 \
JACOBI_MOE_CF=1.00 JACOBI_FMHA_Q_TILE=512 JACOBI_LM_CHUNK=4096 \
cargo run --release --example deepseek_v4_flash -- \
--fp8 --skip-fwd --efficient-train --rank 32 --update-gap 50 --scale 2.5 \
--fp8-mode sr --batch 5 --seq 4096 --runs 15 --lr 3e-4 --warmup 3
# Node 1 (worker, rank 1) — identical command with JACOBI_PROCESS_ID=1
JACOBI_NUM_PROCESSES=2 JACOBI_PROCESS_ID=1 JACOBI_COORDINATOR_ADDR=10.0.2.6:29500 \
JACOBI_COORDINATOR_TOKEN=your-cluster-secret NCCL_SOCKET_IFNAME=enp0s28 \
JACOBI_MOE_CF=1.00 JACOBI_FMHA_Q_TILE=512 JACOBI_LM_CHUNK=4096 \
cargo run --release --example deepseek_v4_flash -- \
--fp8 --skip-fwd --efficient-train --rank 32 --update-gap 50 --scale 2.5 \
--fp8-mode sr --batch 5 --seq 4096 --runs 15 --lr 3e-4 --warmup 3
# Batched Rollout across 16x H200 (128 4K prompts x 16 GRPO rollouts = 2,048 x 1,024 tokens)
# Run on both nodes with --rollout --batch 8 --group 16 --prompt-len 4096 --rollout-len 1024 --window 512
See the Distributed Training guide for NCCL, RoCE/InfiniBand, and PJRT coordinator details.
16x H200 141GB Benchmark Results (4K Context, FP8, DP=2 x EP=8, PleIAs/SYNTH)¶
Measured on random-weight architecture replicas (no HuggingFace weight-parity check). Cluster Peak HBM is reported as device-0 peak HBM x 16.
| Mode | Global Batch | Capacity Factor | Peak HBM (Per GPU / Cluster) | Throughput | 15-Step CE Loss | Cost / 1T |
|---|---|---|---|---|---|---|
| Forward (4k) | 64 | 1.25 | 46.49 GB / 743.84 GB | 217,233.5 tok/s | N/A | N/A |
| Train (rank-32 EfficientAdamW, SR, 4k) | 80 | 1.00 | 132.19 GB / 2,115.04 GB | 52,965.7 tok/s | 12.57 -> 10.62 | $293.7k |
| Train (rank-32 EfficientAdamW, SR, 4k) | 64 | 1.00 | 123.39 GB / 1,974.24 GB | 51,830.4 tok/s | 12.61 -> 10.68 | $300.1k |
| Train (Full AdamW, EP=16, 4k) | 16 (min) | 1.00 | OOM (>141 GB / >2,256 GB) | OOM | N/A | N/A |
| Rollout (Sage + SW-512, 4k->1k, 128x16) | 2,048 | 1.00 | 49.80 GB / 796.80 GB | 42,923.5 tok/s | N/A | N/A |
| Rollout (Sage + SW-512, 4k->1k, 128x1) | 128 | 1.00 | 49.80 GB / 796.80 GB | 2,995.0 tok/s | N/A | N/A |
Full AdamW vs Rank-32 EfficientAdamW (16-Layer / 106B Slice, 16x H200, DP=2 x EP=8)¶
Full 43-layer DeepSeek-V4-Flash requires 160.97 GB/GPU for full AdamW state alone (exceeding 141 GB H200 HBM). On a 16-layer (105.83B) slice where both fit on 16x H200 at batch=64, seq=4096:
| Optimizer | Optimizer State / GPU | Peak HBM / GPU | Throughput | 15-Step CE Loss |
|---|---|---|---|---|
Full AdamW (FP8 SR) |
62.56 GB | 120.00 GB | 57,865.1 tok/s | 12.59 -> 8.15 |
Rank-32 EfficientAdamW (gap=50, scale=2.5, FP8 SR) |
0.60 GB (99.0% saved) |
58.88 GB | 140,017.7 tok/s (2.42x) |
12.59 -> 7.76 |