nemo_automodel.components.speculative.dspark.remote
nemo_automodel.components.speculative.dspark.remote
Train-inference disaggregation for DSpark: a remote target server and its client.
The frozen DSpark target runs in its own process, on other GPUs or nodes, and
serves the two hidden-state tensors the draft trains on. The transport is the
EAGLE-3 one, unchanged (nemo_automodel.components.speculative.eagle.remote):
HTTP is the control plane and NCCL or the binary wire format is the data plane.
Only the payload differs. The server captures target_hidden_states and
target_last_hidden_states with HFDSparkTargetModel, the same code the
colocated path runs, and both data planes transfer them losslessly, so a remote
batch equals the colocated one for the same target forward.
Module Contents
Classes
API
Target properties the draft is built against.
The server reports them and the training client compares them with the values it derived from its own config, so a server running a different target, depth, or capture layers fails at setup instead of training on mismatched features.
Build the info from the target’s text config and the captured layers.
Return the names of the fields whose values differ from other.
Bases: TargetModelServer
Request-handling logic for a remote DSpark target.
Parameters:
The frozen target wrapped for DSpark capture.
The config holding the target text stack’s
num_hidden_layers, hidden_size and vocab_size.
TCP rendezvous port for the NCCL data plane.
Bind/advertise address (rendezvous master for NCCL).
Capture the DSpark features for one decoded request.
Parameters:
Request tensors on the server device: input_ids,
attention_mask and loss_mask, each of shape [batch, sequence].
Returns: dict[str, torch.Tensor]
target_hidden_states of shape [batch, sequence, len(target_layer_ids)
Return the served DSparkTargetInfo as JSON.
Return the target lm_head weight (used once to seed the draft head).
Add the output-embedding endpoint the DSpark draft head is seeded from.
DSpark target backend that runs the frozen target on remote servers.
It exposes the surface train_dspark calls on HFDSparkTargetModel
(generate_batch, get_input_embeddings, get_output_embeddings).
Requests go to the servers round-robin, one at a time per server.
Parameters:
One http://host:port URL per target server.
Device the returned features are moved to.
Per-request HTTP timeout in seconds.
Retries for idempotent requests on connection errors.
Whether to use the NCCL data plane when available. A server pairs NCCL with one client only, so pass False when several training ranks share a server.
Raise if any server serves a target that differs from expected.
Parameters:
The target properties derived from the training config.
Raises:
ValueError: If a server is not a DSpark target server, or reports different properties (naming the server and the mismatched fields).
Disconnect from every server; a server shuts down when a client disconnects.
Run the remote target once and return the DSpark features.
Parameters:
Long tensor of shape [batch, sequence] containing target tokens.
Binary tensor of shape [batch, sequence], with one for valid tokens and zero for padding.
Tensor of shape [batch, sequence] selecting supervised tokens.
Returns: DSparkTargetBatch
DSparkTargetBatch with target_hidden_states of shape [batch, sequence,
Fetch the target input-embedding weight, of shape [vocab, hidden] on CPU, as .weight.
Fetch the target lm_head weight, of shape [vocab, hidden] on CPU, as .weight.