Repository navigation
DGX Spark: two-node clustering, pipeline training, and single-Spark guidance - #10280
danielhanchen wants to merge 116 commits into
Conversation
…uidance Adds first class support for one DGX Spark and for two cabled over their ConnectX-7 200GbE link, plus the diagnostics needed to tell a healthy pair from a broken one. New `unsloth spark` commands: up, status, setup, peers, env, serve, train, doctor, provision, plan, kernels, merge, estimate. Measured on two Sparks (GB10, aarch64, sm_121a, CUDA 13): - Inference, tensor parallel across the pair: 2.09x, median TPOT 332.7ms to 162.4ms. Tensor parallel is the only axis that makes a single request faster. - Training, layer split with torch.distributed.pipelining: 1.96x (DualPipeV, 4204 tok/s) against 2149 tok/s on one Spark, which is 99% of the 2M/(M+1) bubble ceiling at M=32. - Llama-3.3-70B trains across the pair at 68.6 GiB per node. It does not fit on one, so this is capacity rather than speed. - NVFP4 kernel selection on a single Spark: 6.2x prefill (flashinfer_cutlass at 309 TF/s against Marlin's 50 TF/s at M=4096). Two things the tooling states plainly rather than letting users assume: - Pipeline parallel cannot speed up decode. Bytes moved per token are unchanged, so TPOT stays flat; measured 1.08x in vLLM's own implementation. `spark plan` says so and points at tensor parallel instead. - A model that fits on one Spark is slower layer split across two (0.92x), because ggml walks the split graph device by device. Splitting buys capacity, never speed. Usable memory is 121.69 GiB per node, not 128, and `spark estimate` checks a run fits before it starts rather than after an OOM. `doctor` detects two hardware faults with opposite remedies: a dead compute engine (cuInit=100 with working nvidia-smi) needs a plain reboot, while a degraded interconnect (NCCL at 3 GB/s while RDMA reads 24) needs a full power cycle. `--parity-only` catches cross node capability divergence, which is what made a two-node job hang for 1800 seconds when nvcc was missing from the peer's non-interactive ssh PATH. Everything is gated on actually being a DGX Spark. The loader notice costs a non Spark host two string comparisons and no I/O, the Studio run hint is wrapped so it can never break `unsloth run`, and spark_cluster is stdlib only at module scope. Nothing changes on NVIDIA, AMD or CPU hosts across Windows, Linux, WSL or macOS. Tests: 33 hardware-independent tests in unsloth_cli/tests/test_spark_offbox.py. Full unsloth_cli suite goes from 1139 passed to 1172 passed with the same 35 pre-existing failures in test_inference_chat.py, so no regressions.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ith tests
Three changes from a pre-merge audit that simulated the full platform matrix.
notify_device_map_cannot_span_sparks runs inside FastLanguageModel.from_pretrained
and FastModel.from_pretrained, so it executes for every Unsloth user on every OS
and every accelerator. Its probes caught OSError, but nothing caught anything
else, so a non-OSError escaping a sysfs read would propagate out of from_pretrained
and fail a load that had nothing to do with a Spark. Wrapped in a blanket guard: a
cosmetic notice must never be able to do that. The cheap gates still run first, so
the try costs nothing on the common path.
install.sh's gate now reads ${OS:-} and ${_ARCH:-} rather than $OS and $_ARCH.
Both are set unconditionally long before the gate runs, so this is not a live bug,
but install.sh is the entry point for every user on every platform and if anyone
ever adds set -u above that line an unbound variable would abort the whole install
instead of skipping a hint. Fails closed either way.
Adds 41 tests covering the notice across [Windows, Linux, WSL, macOS] x
[NVIDIA, AMD, CPU-only]: it must stay silent off a cabled Spark, and it must not
propagate OSError, PermissionError, IsADirectoryError, ValueError or RuntimeError
from its probes, nor a failure from torch.cuda.device_count(). The ValueError and
RuntimeError cases fail without the guard above, so the tests pin the fix rather
than describing it. They also stub the filesystem, not just platform, so they pass
when CI runs on an actual DGX Spark.
Verified: 1955-check platform simulation of the notice, 121-check simulation of
all 17 spark/doctor subcommands across 7 platforms (all exit cleanly, no traceback,
and the CLI still imports neither torch nor numpy), 79-check simulation of the
Studio run hint against a spark_cluster whose every helper raises or returns junk,
and a 36-check simulation of the install.sh gate across every (OS, arch) pair,
strace-confirmed to open no files on a simulated Mac.
unsloth_cli suite: 1172 passed with the same 35 pre-existing test_inference_chat
failures as origin/main. test_spark_offbox: 74 passed with torch present.
|
Pushed two fixes and 41 tests from a pre-merge audit. The question I was trying to answer was narrow: this PR adds a hardware path, so does it change anything for the overwhelming majority of users who will never own a DGX Spark? The one real defect
Its probes caught Now wrapped in a blanket guard. The cheap gates still run first, so the This was found by simulation, not by reading, and the new tests fail without the fix: The one hardening
What was simulatedEverything below ran on a real DGX Spark, which is the awkward case: the machine answers yes to the detection probes, so the simulations have to stub the filesystem as well as
Specifically confirmed:
Backwards compatibilityI checked whether the CLI still works if Test countsSame 35 pre-existing |
Found by installing the PR from scratch into a non-default UNSLOTH_STUDIO_HOME and provisioning a second Spark from it. Both bugs are invisible with the default layout, which is why the tests did not catch them. 1. UNSLOTH_STUDIO_HOME moved the venv but four call sites still assumed ~/.unsloth/studio/unsloth_studio: PROVISION_PATHS, the two-node torchrun launch, the parity/SMI probes, and the peer-venv presence check. The worst of these is provision, which copied the default path, skipped or copied a stale venv, and then printed "Peer now matches this node". That hands the user the exact 601 s `DistStoreError: 1/2 clients joined` the command exists to prevent, while reporting success. `doctor` failed more quietly: the probe ran without a venv, torchrun was absent, and it reported "could not measure NCCL bandwidth" on a healthy pair. Resolved through `provision_paths()` and `venv_activate()` rather than hardcoded. `venv_activate()` deliberately keeps the literal `$HOME/...` form in the default case so it expands on the PEER, which stays correct when the nodes have different usernames or home directories; only a custom UNSLOTH_STUDIO_HOME forces an absolute path, and that is right because provision copies to that same absolute path. 2. rsync creates only the last component of the destination, so provisioning a peer that lacks the parent directory failed with `mkdir "<dest>" failed: No such file or directory`. This is not an edge case: it is the normal state of a brand-new second Spark, which has no ~/.unsloth/studio yet, so the primary use case was broken with the default layout too. Fixed with `--rsync-path='mkdir -p "<parent>" && rsync'`, with `~` rewritten to "$HOME" because a quoted tilde does not expand and it must expand on the peer. Verified on two Sparks with a fresh install at a custom UNSLOTH_STUDIO_HOME: provision copies the right venv and now succeeds; the peer's torchrun resolves into it with torch 2.11.0+cu130 and CUDA available; a real two-node NCCL all-reduce runs, world=2, 64 MiB in 5.31 ms; and doctor's parity divergences drop from 2 to 1 because the peer finally sources the same venv. Default behaviour is unchanged and pinned by a test asserting the resolved path still equals ~/.unsloth/studio/unsloth_studio when neither variable is set. Tests: 1176 passed (up from 1172) with the same 35 pre-existing test_inference_chat failures; test_spark_offbox 78 passed with torch present.
|
Two bugs found by installing this PR from scratch into a non-default 1.
|
The planner shipped one number for splitting a model that already fits on one node: 0.92x, a loss, always. That is still correct for a llama.cpp whose RPC backend predates ggml-org/llama.cpp#18626 ("rpc: implement event and async backend APIs", merged 2026-08-26), which is what the fork currently builds. Without that commit the RPC backend advertises neither async nor events, ggml_backend_sched refuses to pipeline across RPC devices, and the two halves run strictly one after the other. With it the answer stops being a constant, because what overlaps is prefill. Measured end to end on two Sparks, Qwen3-27B Q4_K_XL, same binary in both arms so the only variable is whether the model is split: prompt tokens | c=1 c=4 c=8 128 | 0.94x 0.95x 0.95x 256 | 0.98x 1.00x 1.00x <- break-even 512 | 0.96x 1.05x 1.07x 1024 | 1.02x 1.12x 1.17x 2048 | 1.07x 1.23x 1.29x 4096 | 1.11x 1.35x 1.45x Decode is 0.93-0.98x throughout and cannot be otherwise: a layer split moves the same weight bytes per token, so the entire gain is prefill and the entire question is prompt length. Below ~256 tokens splitting costs 2-6%; above ~1024 it wins, growing with both prompt length and concurrency. So it is a loss for chat-shaped traffic and a win for prompt-heavy work, which is the opposite of a single verdict. `layer_split_speedup()` defaults to `async_rpc=False` and returns the conservative 0.92x, so nothing promises users a speedup their build cannot deliver. With `async_rpc=True` and no prompt length it returns None rather than guessing, and it snaps down to the nearest measured row rather than interpolating: these are six measured points, not a fitted curve. The old constant is kept and still used, so no existing caller changes behaviour.
Four follow-ups to the two-Spark work, all confined to the spark subcommands. 1. spark plan reasons about single, replicas and layer split, not only single versus split. recommend_topology() is a pure function of model bytes, KV bytes per user, users, prompt tokens and per-node free bytes. A model that does not fit is a layer split, the only option. A model that fits is replicas from 8 users up and a single Spark below that; a split of a model that fits is recommended only for prefill-heavy long-prompt work, and says why. The measured table (Qwen3.8-27B-UD-Q4_K_XL, llama.cpp b10796, two Sparks, 2026-09-04, uncapped clocks) lives in one constants block keyed by prompt tokens and concurrency: two replicas 1.00x / 1.13x / 1.13x / 1.30x / 1.75x / 1.91x and a layer split 0.95x / 0.99x / 0.92x / 0.85x / 0.94x / 1.01x aggregate decode at 1 / 2 / 4 / 8 / 16 / 32 users, prompt 512. Every sentence that quoted the pre-#18626 flat 0.92x now quotes this rule: a split never speeds up decode for a model that fits, it is a capacity and prefill feature (1.7x to 1.85x prefill). plan gains --prompt-tokens and --prefill-heavy. 2. spark provision copies the llama.cpp bundle. provision_paths() gains the managed bundle directory, resolved as the installer resolves it: UNSLOTH_LLAMA_CPP_PATH, else <UNSLOTH_STUDIO_HOME>/llama.cpp, else the legacy ~/.unsloth/llama.cpp. Without it a paired peer keeps whatever llama-server it had, and two bundles a release apart speak different RPC protocols. 3. RPC protocol mismatch is detected before a two-node layer split is printed. Two independent signals: the bundle identity on both nodes (BUILD_INFO.txt tag and the md5 of libggml-rpc, read on the peer by a self-contained probe over ssh; a bundle without BUILD_INFO.txt reads as unknown, never a crash), and a live HELLO against any ggml-rpc-server already listening on either node, using the b10796 wire format (command 14, a 24-byte zero conn_caps request, a size-prefixed reply whose first three bytes are major, minor, patch). b10796 speaks RPC 6.0 where earlier bundles spoke 5.1, and llama-server fails at load with "RPC server version mismatch"; spark serve and spark doctor now name both versions and the fix, which is unsloth spark provision. The probe is bounded and never raises. 4. rpc_server_binary() looks in the bundle first. Bundles from b10796-mix-659e406 ship ggml-rpc-server next to llama-server; the docstring that said otherwise is fixed, the bundle is searched under the current and the legacy rpc-server name honouring UNSLOTH_STUDIO_HOME, and the source build and PATH fallbacks stay for older bundles. The serve output now names the resolved binary on the peer instead of a hardcoded ~/llamacpp-rpc path. Tests: 23 new offbox tests cover the topology rules and table lookups, the provision paths under the default and a custom UNSLOTH_STUDIO_HOME, bundle identity with and without BUILD_INFO.txt, the comparison message, the HELLO probe against an in-process fake server (6.0.0 reply, truncated reply, hang-up), the preflight verdicts, and binary discovery (found, legacy name, absent). The one existing provision test that pinned the tuple by position is updated for the new entry. 64 passed, 41 skipped.
…existing installs The copy allowlist in runtime_patterns_for_choice named llama-server, llama-quantize, the DiffusionGemma visual-server and lib*.so*, so a bundle that ships ./ggml-rpc-server next to ./libggml-rpc.so installed only the client library: the executable the two-Spark layer split runs on the peer was filtered out of every fresh install, and spark_cluster.rpc_server_binary() looks for it in the bundle first. Name ggml-rpc-server (and the pre-rename rpc-server) in the Linux, macOS and Windows allowlists, for fork and upstream bundles alike, and chmod it 755 in install_from_archives since extraction drops the archive's exec bits. It stays in build/bin (build/bin/Release on Windows) with no root-level link, which is where rpc_server_binary() looks first; a test pins that the installer's names and overlay directories match spark_cluster's search list. Add rpc_server_backfill_needed so an install that matches on tag but lacks the executable is re-extracted on the next update, and route all three tag-match skips through one bundle_backfill_reason check. Unlike the visual-server it is not gated to fork bundles, since upstream ships the server too when built with GGML_RPC; thrash on bundles that never carry it is prevented by evidence instead (no libggml-rpc in the runtime dir, or a fork build older than b10796, means nothing is owed).
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ofile is the runner-independent one [skip ci]
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # tests/studio/install/test_install_llama_prebuilt_logic.py # tests/studio/install/test_source_build_rpc_server.py
The installer, the worker CLI and serving now share one lookup, so the toolkit's rpc_server_binary, llama_bundle_dir and rpc_server_names answer from it instead of keeping a second copy. The cross-platform cases live with the lookup; these tests pin that the toolkit agrees with it and that the bundle identity names the server the installer placed.
…esolves AutoConfig reads back _attn_implementation = None for a checkpoint that never named one, and the model constructor then takes SDPA, so --pp-backend legacy rejected every ordinary config. The check now resolves the backend the model class will use (SDPA when it supports it, eager otherwise) and still refuses eager.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a7094cc3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| out = subprocess.run( | ||
| f"env {local_common} --node_rank=0 {shlex.quote(local_probe)}", | ||
| shell = True, | ||
| capture_output = True, | ||
| text = True, | ||
| timeout = timeout, |
There was a problem hiding this comment.
Terminate the local probe process group on timeout
When the NCCL probe times out, subprocess.run(..., shell=True) kills only the intermediate shell, leaving its torchrun process and workers running. The finally block cleans up only the peer, so a failed spark doctor or bandwidth check can leave the local rank holding GPU memory or waiting for rendezvous long after the requested timeout. This shell-timeout behavior was reproduced locally with a harmless child process. Start the local probe in a separate session and terminate its entire process group on timeout or interruption.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed (subprocess.run with shell=True and a timeout leaves the shell's child running). Fixed in cc58936: the local rank runs in its own session through _run_in_own_group, and a timeout or an interrupt stops the whole group with SIGTERM, then SIGKILL, even when the shell already exited and torchrun still holds the pipe. Covered by test_a_timed_out_local_probe_stops_its_whole_process_group, with a real child process.
subprocess.run(shell=True, timeout=...) kills only the shell, so a timed-out bandwidth check or spark doctor left torchrun and its worker holding the GPU and waiting for rendezvous. The local rank now runs in its own session and a timeout or interrupt stops the whole group (SIGTERM, then SIGKILL).
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b70d4ec4ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for var in ("UNSLOTH_STUDIO_HOME", "STUDIO_HOME"): | ||
| value = os.environ.get(var) | ||
| if value: | ||
| return Path(value).expanduser() | ||
| return Path.home() / ".unsloth" / "studio" |
There was a problem hiding this comment.
Honor UNSLOTH_HOME when resolving the Studio root
When Studio is installed with only UNSLOTH_HOME set, this resolver uses ~/.unsloth/studio instead of <UNSLOTH_HOME>/studio, unlike the installer and existing Studio root resolvers. Consequently, provision_paths() skips the actual managed venv (or copies an older default installation), while managed_torchrun() and venv_activate() also select the wrong environment. Pairing can therefore report success without provisioning the environment needed by subsequent training launches. Resolve the root using the existing root precedence, including UNSLOTH_HOME, rather than falling directly back to the legacy location.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b3502ba. _studio_root() now follows the same order as storage_roots: UNSLOTH_STUDIO_HOME / STUDIO_HOME first, then <UNSLOTH_HOME>/studio, then the legacy ~/.unsloth/studio. Blank values count as unset. provision_paths(), config_path(), managed_torchrun() and venv_activate() all read it, so an install made with only UNSLOTH_HOME now provisions and activates its own venv. test_provision_paths_follow_unsloth_home covers this, including an explicit Studio home still winning, and fails without the change.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Reproduced a checkpoint-loss bug at b3502ba. When I reused a --save directory and simulated the peer launch failing with SSH exit 255, the launcher deleted the existing local stage1/adapter_model.safetensors and requested deletion of stage1 on the peer. The new run never started. Cleanup code Could we reject a save directory that already contains a checkpoint before touching either node? A regression test could simulate a failed peer launch and verify that the existing checkpoint is preserved. |
Stacked on #18276 (ships
ggml-rpc-serverwith the llama.cpp bundle), and optional: multi-machine serving (#18277, #18278, #18279) no longer depends on this PR. The installer changes that putggml-rpc-serverin the bundle moved to #18276. The toolkit'srpc_server_binary,llama_bundle_dirandrpc_server_namesnow answer fromstudio/llama_rpc.pythere, so there is one lookup.Adds first class support for one DGX Spark, and for two of them cabled over the ConnectX-7 200GbE link, along with the diagnostics needed to tell a healthy pair from a broken one.
All numbers below are measured on real hardware (GB10, aarch64, sm_121a, CUDA 13), not projected.
New commands
unsloth sparkgains:up,status,setup,peers,env,serve,train,doctor,provision,plan,kernels,merge,estimate.unsloth spark upis the one command that covers all seven cluster states, so a user who does not know what state their machine is in still has somewhere to start.What two Sparks actually buy
The training figure uses
torch.distributed.pipeliningwith DualPipeV at M=32, which is 99% of the2M/(M+1)bubble ceiling. The schedule is no longer the limiting factor.On a single Spark,
spark kernelspicks the right NVFP4 kernel for the workload: flashinfer_cutlass reaches 309 TF/s against Marlin's 50 TF/s at M=4096 for prefill, a 6.2x difference, while Marlin wins at M=1 for decode.Two things the tooling says out loud
These are both cases where the intuitive expectation is wrong, so
spark planstates them rather than letting people discover them by benchmark.Pipeline parallel cannot speed up decode. The bytes moved per token do not change when you split layers across nodes, so time per output token stays flat. This is not an artifact of our implementation: vLLM's own PP measures 1.08x with flat TPOT.
plan --for latencyrecommends tensor parallel instead, which is the only axis that makes a single request faster.A model that fits on one Spark never decodes faster split across two. Measured from 1 to 32 concurrent users the layer split's aggregate decode is 0.85x to 1.01x of a single Spark (0.95x decode-only). Splitting buys capacity and prefill (1.7x to 1.85x), never decode. What a second Spark does buy for a model that fits is throughput at load: two independent replicas measured 1.30x at 8 users, 1.75x at 16 and 1.91x at 32, and only 1.00x to 1.13x below 8.
Also worth stating: usable memory is 121.69 GiB per node, not 128.
spark estimatechecks that a layer split run fits before it starts, rather than after an OOM.Replicas planner, bundle provisioning, RPC protocol parity
Four follow-ups, all in
studio/spark_cluster.py,unsloth_cli/commands/spark.pyand the offbox tests, none of which run on the model-load path.spark plannow reasons about single / replicas / layer split.recommend_topology()is a pure function of model bytes, KV bytes per user, user count, prompt length and per-node free memory. A model that does not fit is a layer split, the only option. A model that fits is replicas from 8 users up and a single Spark below that (the second copy buys 1.13x at 2 to 4 users and 1.00x at 1, where only vLLM tensor parallel helps). A layer split of a model that fits is recommended only with--prefill-heavy, and says why. The measured table lives in one constants block (REPLICAS_DECODE_SPEEDUP,LAYER_SPLIT_DECODE_SPEEDUP), keyed by prompt tokens and concurrency, with the model, date and uncapped clocks named in the comment.plangained--prompt-tokensand--prefill-heavy, and every printed sentence that quoted the old flat 0.92x now quotes this rule.Aggregate decode tok/s, Qwen3.8-27B-UD-Q4_K_XL (16.4 GiB), llama.cpp b10796, prompt 512, 128 generated tokens, uncapped clocks, 2026-09-04:
At prompt 2048 the replicas ratios are 1.01 / 1.38 / 1.30 / 1.81 / 1.99 / 2.38. Memory per node at 16 users: single 22.6 GiB, replicas 19.3 GiB each, split 10.9 + 11.8 GiB.
spark provisioncopies the llama.cpp bundle.provision_paths()gains the managed bundle directory, resolved the way the installer resolves it (UNSLOTH_LLAMA_CPP_PATH, else<UNSLOTH_STUDIO_HOME>/llama.cpp, else~/.unsloth/llama.cpp), so a paired peer cannot end up on a different llama-server than the local node.RPC protocol mismatch is caught before a layer split is launched. Two independent signals: the bundle identity on both nodes (
BUILD_INFO.txttag plus the md5 oflibggml-rpc, over ssh with a self-contained probe; a bundle withoutBUILD_INFO.txtreads asunknown, never a crash), and a live HELLO against any ggml-rpc-server already listening on either node, speaking the b10796 wire format (command 14, a 24-byte zeroconn_capsrequest, a size-prefixed reply whose first three bytes are major, minor, patch). b10796 speaks RPC 6.0 where earlier bundles spoke 5.1, and llama-server then fails at load withRPC server version mismatch;spark serveandspark doctornow name both versions and the fix (unsloth spark provision). The HELLO probe is unit tested against an in-process fake server for a 6.0.0 reply, a truncated reply and a hang-up.rpc_server_binary()finds the executable in the bundle. Bundles fromb10796-mix-659e406shipggml-rpc-servernext tollama-server; the docstring that said otherwise is fixed, the bundle is searched first (current and legacyrpc-servernames, honouringUNSLOTH_STUDIO_HOME), and the source-build and PATH fallbacks stay for older bundles.The installer now copies
ggml-rpc-server, and backfills installs that lack it. The copy allowlist instudio/install_llama_prebuilt.py(runtime_patterns_for_choice) namedllama-server,llama-quantize, the visual-server andlib*.so*, so a bundle that ships./ggml-rpc-servernext to./libggml-rpc.soinstalled only the client library and every fresh install silently lacked the executable item 4 looks for.ggml-rpc-server(and the pre-renamerpc-server) is now in the Linux, macOS and Windows allowlists for fork and upstream bundles, chmod 755 ininstall_from_archivesbecause extraction drops exec bits, and left inbuild/bin(build/bin/Releaseon Windows) with no root link, which is whererpc_server_binary()looks first; a test pins the installer's names and overlay directories tospark_cluster's search list.rpc_server_backfill_neededre-extracts a tag-matching install that haslibggml-rpcbut not the server (same shape as the DiffusionGemma backfill, not gated to fork bundles since upstream ships it too; fork builds before b10796 and bundles withoutlibggml-rpcare never owed it, so nothing thrashes), and the three tag-match skips share onebundle_backfill_reasoncheck. Verified on a Spark: a fresh install ofb10798-mix-659e406landsbuild/bin/ggml-rpc-serverexecutable and--helpprints usage; a pre-fix install of the same tag is re-extracted once withexisting install matches b10798-mix-659e406 but is missing ggml-rpc-serverand skipped on the run after.The source-build fallback ships
ggml-rpc-servertoo. When the prebuilt install fails andstudio/setup.shorstudio/setup.ps1builds llama.cpp from source, neither configuredGGML_RPCnor built the target, so a source-built install had nothing for item 4 to find. Every configure now carries-DGGML_RPC=ON -DGGML_RPC_RDMA=OFF(set before the CPU-fallback args are copied, so the CPU fallbacks carry them too) and, after the requiredllama-serverandllama-quantize, builds the RPC server best-effort under whichever name the tree uses (ggml-rpc-server, orrpc-serverbefore the rename, read fromtools/rpcandexamples/rpcbecause the VS generator has no--target help); a tree without it never fails the build, and the binary stays inbuild/bin(build/bin/Releaseon Windows) with no root link, whererpc_server_binary()looks. RDMA is off on every platform: it is what every shipped prebuilt is built with, and it avoids the hard runtime dependency on libibverbs and libnl that ggml-rpc otherwise picks up whenever libibverbs is installed on the build host (it is on every DGX Spark). macOS additionally checks the CMake cache andotool -Lafter the build, the gate the fork'sunsloth-prebuilt-macos.ymlruns, since a Mac with the RDMA framework would otherwise link/usr/lib/librdma.dylibintolibggml-rpcand the install fails to load elsewhere; a build that trips it is redone withoutGGML_RPC.runtime_payload_health_groupsand the staged validation do not require the RPC server. Verified with the CPU path ofsetup.shon this Spark (GGML_RPC:BOOL=ON,GGML_RPC_RDMA:BOOL=OFF,build/bin/ggml-rpc-serverexecutable,--helpprints usage, no libibverbs inldd,llama-server --versionstill runs); the CUDA variant of the same script path is untested here because both GPUs were busy benchmarking.spark provisionmoves bulk bytes at the disk floor instead of at ssh speed. rsync over ssh on this link is bound by ssh's CPU: with the same 1 GiB file in/dev/shmon both ends and one rail,rsync -aover ssh measured 0.22 GB/s (0.28 with-c [email protected]), one raw TCP stream 0.63 GB/s, the NVMe 1.1 to 1.3 GB/s, so a 170 GiB GGUF took about 13 minutes where the disk allows 3.provision_peernow starts an ephemeralrsync --daemonon the peer over ssh (temporary config in a 700 dir under/tmp, one module per destination root, random high port, random one-shot user and secret in a 600secrets file,hosts allow= the single local rail address,address= the peer's rail address only,use chroot = no,read only = no,max connections = 4, log and pid file in the same dir, started undertimeoutas a backstop), then pushes the regular files with up to 4 concurrent rsync clients over disjoint byte-balanced file subsets againstrsync://user@peer_rail:port/module/, secret inRSYNC_PASSWORD, no ssh on the data path. The unchanged ssh rsync then runs as the finaliser for every path: on a tree the workers filled it moves only symlinks, directory metadata and--delete(a non-chrooted daemon rewrites absolute symlink targets, so the workers never carry symlinks; the venv'sbin/python -> /usr/bin/...arrives intact). The daemon is stopped by pid file (whole process group) and its dir removed from afinally, on error, on Ctrl-C and on SIGTERM, andpgrep -x rsyncon the peer is reported afterwards. The bytes are unencrypted over the direct cable, a point-to-point link with no other host; the comment and--helpsay so,--no-fastandUNSLOTH_SPARK_PROVISION_FAST=0force ssh, and the path is refused off Linux, off a Spark, for a non-private peer address, or when the local rail address is not in the peer's /24. ssh stays the default everywhere else and the fallback whenever the daemon does not start or a path fails.Measured 2026-09-04 on the two Sparks over the 192.168.200.0/24 rail, cold source cache every run (
posix_fadvise DONTNEED), fresh destination every run, one transfer at a time, 4 workers, the local node running a vLLM benchmark throughout (peer GPU idle):/dev/urandomfile (1 file, 1 stream)c54f8d4f84868ba6472c39beeab4bf9ac54f8d4f84868ba6472c39beeab4bf9aFloors measured the same day: cold NVMe read 1.1 GB/s (16 GiB random file) and 1.3 GB/s (the GGUF) on the local node, 0.72 GB/s on the peer; peer
O_DIRECTwrite 7.5 GB/s. The single-file rows are one TCP stream because rsync cannot split one file, and land at 0.8 GB/s against a 1.1 to 1.3 GB/s read floor; multi-file trees get all four streams. Wall time includes daemon start and stop (about 1.5 s) and the ssh finaliser.The stall: with four concurrent streams, 2 of 9 venv runs had two of the four flows blackholed at once, in both directions on the same 5-tuple (
ss -tni:cwnd:1 backoff:8 rto:51712, retransmits lost, while the other two flows on the same rail kept moving). Both NICs count millions ofrx_err_lane_*_phyerrors on that rail (local 2.15M / 6.78M, peer 0.61M / 4.65M), the QSFP seating problem the module already documents, so the loss is physical. Before the fix a stalled worker sat until the daemon's 600 s timeout and the path fell back to ssh. Now each worker runs with--timeout=30(daemontimeout = 60) and up to 3 attempts; a retry is a fresh connection and rsync re-sends only what does not already match, which is what the 71.8 s row shows (the following 3 runs had no retries). Tests cover the config text and the secrets file mode (run under bash where available), the port range, every gate, the disjoint and complete work split, the retry, and that the daemon is stopped after a worker failure, an exception, and a finaliser error, with a fakessh/rsyncrunner.Diagnostics
unsloth spark doctordetects two hardware faults that look similar and have opposite remedies:cuInitreturns 100 whilenvidia-smistill works. Needs a plain reboot.doctor --parity-onlycatches cross node capability divergence. That is what made a two-node job hang for 1800 seconds whennvccwas absent from the peer's non-interactive ssh PATH, which is invisible from an interactive shell.Fast-path parity, worth 2.19x on this pair
The capability check above catches divergence that hangs a job. This one catches divergence that does not: a kernel package installed on one node and missing on the other raises nothing, deadlocks nothing, and simply runs that node at a fraction of the speed.
Measured on this pair, on a byte-identical single-node Qwen3.5 LoRA training cell:
Same torch 2.11.0+cu130, same transformers 5.5.0, same peft, no throttle bits on either node. The cause was that local was missing
causal_conv1dandflash-linear-attention/fla-core, so Qwen3.5's linear-attention layers fell back to the torch implementation. The only visible sign was one line,The fast path is not available, on one node's log and not the other's. Installing the peer's exact versions took local to 2557 and 2541 tok/s at 10.07 GiB, within 1.4 percent of the peer, with nothing else moved.On a two-node run the pair moves at the slower node's pace, so this halves the whole job rather than one rank, and it stays invisible until somebody benchmarks each node separately.
unsloth doctorandunsloth spark doctornow compare the fast-path stack whenever a peer is configured:torch,transformers,trl,peft,accelerate,bitsandbytes,triton,flash-attn,causal_conv1d,flash-linear-attention,fla-coreandxformers, read from metadata only, so it is safe to run while a GPU is busycausal_conv1d_fn, the fla kernels,flash_attn_func,tritonand the xformers attention entry point, and readstransformers' ownis_causal_conv1d_availableandis_flash_linear_attention_availablegates. An installed package whose extension will not load is exactly as slow as an absent one and reads as present inpip list, so the metadata comparison alone would miss it. It runs as a child process so an import that aborts the interpreter costs the package inventory nothing, and it has its own timeout.The report names the node, the package, both versions, and the command that fixes it:
Two rules it follows, both learned here:
transformersitself reports a gate as unavailable on both nodes, since that is the signal that the installed build was looking for that kernel.--skip-fastpathturns it off.Not breaking anything else
Everything is gated on actually running on a DGX Spark:
device_mapon a single-GPU box, where it would otherwise silently collapse ontocuda:0with no messagerunhint is advisory only, wrapped so it can never breakunsloth run, and passestimeout=0to discovery so no hint puts an mDNS browse in front of a model loadspark_clusteris stdlib only at module scopesparksubcommands;unsloth/__init__.pyandunsloth/models/import none of itNo behaviour change on NVIDIA, AMD or CPU hosts, across Windows, Linux, WSL or macOS.
Testing
The fast-path check has 17 tests of its own, driven with fake node responses: matching stacks, a package missing on one node, a version mismatch, an unreachable peer, a local probe that could not run, a runtime probe that crashed, and a node whose package is installed at the matching version but whose kernel does not import. None of them need a Spark, a GPU, a peer or a network.
These are hardware independent and run anywhere (the skips are the torch-dependent merge and loader-notice cases on a torch-free venv). Against the full CLI suite:
main: 35 failed, 1139 passedSame 35 pre-existing failures in
test_inference_chat.py, no regressions.Three silent-cost fixes found by re-verifying this branch on the pair
Each was proved failing-first by mutating the fix back out and watching the new
test go red. Off-box suite 402 to 409 passed, 129 skipped either way: the seven
new tests are the whole difference.
ruffclean at the pinned 0.15.18.The harness defaulted to the schedule the docs say to avoid
studio/spark_pipeline.py's own--scheduledefaulted togpipe.unsloth spark trainalways passes--scheduleexplicitly, so the shipped path wassafe, but the commands it prints are what a user pastes and edits, and
dropping the flag from one of those selected the arm that peaked at 99.92 GiB
against a 121.69 GiB node, where 1f1b peaked at 7.34 GiB for identical work.
This is worth stating because it is not a one-line edit. The legacy backend
refuses
1f1boutright, because the hand-written version deadlocks. Flippingthe default globally would have turned
--pp-backend legacywith no--schedulefrom a working run into an error, trading one never-OOM hazard fora hard failure somewhere else. The default is now resolved per backend by
default_schedule()inmain(), 1f1b on torch and gpipe retained on legacy,with
argparsecarryingdefault = Nonebecause it cannot express a defaultthat depends on another flag. Both arms verified end to end on the gloo path.
A missing attention fast path costs 2.1x and says almost nothing
Measured on two Sparks, Qwen3.5-9B, 1f1b, M=4, batch 64, seq 512, gradient
checkpointing, both nodes pinned at 300,1690: 877 tok/s with
flash-linear-attention and causal-conv1d present, 418 without, and peak memory
14.02 GiB against 17.08. The only sign is one
logger.warning_oncefromtransformers in the middle of the weight-loading output.
check_fast_path()now says so before the weights load, naming the missingpackages, the measured cost, and that both nodes need them, since two ranks
that disagree are not even slow in the same way. It is advisory and cannot break
a load. It also cannot cry wolf, which matters more than the warning itself: it
asks transformers the same question transformers asks itself, reading
is_fast_path_availablefrom the model's own modeling module and warning onlyon an explicit
False. An architecture with no fused path has no suchattribute, so the value is None and nothing prints. Verified live on all three
cases: fast path present and silent, a plain llama with no fast path and silent,
packages made unavailable and warning.
--microbatcheswas pinned by no testThat flag was once omitted from the emitted commands, worth about 20% at 70B,
with no error and only a slower run. Nothing in the suite would have noticed it
going missing again. Three tests now cover it, including the default path, where
the CLI defaults to M=32 while the harness defaults to M=4, so a dropped flag
runs a different configuration rather than failing.
unsloth doctordiagnosed a real cross-node fault nobody arrangedThis was unplanned and is the strongest evidence in the verification pass.
Early in the pass
spark doctor --parity-onlyreported one divergence(
which_nvccpresent locally, absent on the peer) with thenon-interactive-ssh PATH explanation and the fix, and "OK, the two nodes run the
same fast-path stack".
Later, unrelated work destroyed torch in the shared studio venv on one node:
bin/torchrundisappeared andsite-packages/torchwas reduced tocsrc,_inductorandsharewith no dist-info, soimport torchfailed with"cannot import name 'nn' from 'torch' (unknown location)". Re-run unchanged,
doctor immediately reported 3 capability divergences (
pkg_torchabsentlocally,
which_torchrunabsent locally,which_nvccabsent on the peer) and7 fast-path differences, named torch as the one that "gates everything; a
version split here also splits every kernel below it", and gave the exact
pip install "torch==2.11.0+cu130"against the right venv.Nothing was staged for it and it was not shown the fault.
Reproducing the training numbers: state the conditions
The 70B capacity claim re-measured cleanly: 80 layers split 0-39 / 40-79,
--shard-loadmaterialising 361 tensors with none left on meta, 66.10 GiB ofweights and 69.40 / 69.73 GiB peak per node, no thermal event, both nodes
pinned and verified at 1677-1683 MHz under load.
spark estimatehad predicted70.2 GiB. The single-node refusal is arithmetic from the run itself: 2 x 66.10 =
132.20 GiB against 121.69 GiB.
The pipeline-parallel speedup also re-earned itself: 1.86x against the
recorded 1.776x. That figure is an upper bound, because the control was a
single point rather than a sweep; a control swept over its accumulation axis
would pull the ratio toward 1.776x, not away from it.
The absolute 9B tok/s ladder did not reproduce (877 and 805 against 1073 and
1438), and the discrepancy could not be resolved, because the recorded
protocol does not state its batch. Anyone quoting a tok/s figure from this
work should record the conditions beside it, as these are:
torch.distributed.pipelining,scale_grads=Trueflash_linear_attention0.5.2,fla_core0.5.2,causal_conv1d1.7.0,flash_attn2.8.1,einops0.8.2