Distributed & multi-GPU
The same inference engine drives four ways to scale — a wider resident window, more throughput, or a model bigger than any single card. Each is a flag on dlm serve.
Stream a window through VRAM
--stream holds only a bounded window of layers in memory and materializes the rest on demand from the checkpoint on disk — so a model can exceed the resident budget. Output is bit-for-bit identical to a fully-resident run.
dlm serve --model-path /path/to/model --stream --resident-layers 29The window defaults to the VRAM plan’s layers_to_load; --resident-layers N overrides it. See Architecture & math for how the plan is computed.
Multi-GPU pipeline parallelism
Split the model’s layers into contiguous per-GPU stages. Each layer runs on the GPU that owns it, and only the hidden residual crosses the inter-GPU boundary. A split run is bit-for-bit identical to a single device.
dlm serve --model-path /path/to/model --multi-gpu-ids 0,1,2 --device gpuComputeKernel wrapper, so the batched and speculative server drives a multi-GPU model unchanged. Requires a cuda-kernels build.Speculative decoding
A cheap draft model proposes tokens the target verifies in bulk. With greedy sampling the output is provably identical to plain decoding, and per-request acceptance is reported in the OpenAI usage block. Without a draft model, n-gram lookup over the request’s own context is on by default on the GPU (--speculative auto).
dlm serve --model-path /path/to/target --draft-model-path /path/to/draftDistributed master-worker
Partition layers into shards across worker nodes. A coordinator streams the hidden state through them as length-prefixed Protobuf over plain TCP; heartbeats track liveness and an unreachable worker falls back to local CPU-RAM execution, so a forward pass still completes.
Start each worker, then point a master at them:
dlm serve --model-path /path/to/model --distributed-mode worker --host 0.0.0.0 --port 7001dlm serve --model-path /path/to/model --distributed-mode master --worker-nodes host-a:7001,host-b:7001POST /v1/chat/completions endpoint, coordinating the shards for you. This path is non-streaming and greedy — one request at a time, since the coordinator owns a single KV history. Use standalone or multi-GPU serving when you need batching or streaming.The coordinator can also be driven directly from the library — partition the layers and route the forward pass through the workers yourself:
$ rust
// Split a model across two worker nodes.
let shards = dlm::distributed::partition_layers(num_layers, 2);
let mut coord = dlm::distributed::Coordinator::new(
cfg, layers, embed, norm, head, vocab, routes)?;
let tokens = coord.generate(&prompt, 32)?; // == local greedy
See the Rust library reference for the coordinator API, and Performance tuning for when each mode pays off.