Taewoo Park

Projects

DRIFT

Inference is the one capability almost nobody expects to hold themselves. I split a single open-weight model across a Mac and a CUDA box, and proved the answer is the bit-for-bit one a single machine would have given.

Take back the machine the model runs on

DRIFT runs one large language model across heterogeneous personal machines — a Mac on Apple MPS and a Windows or Linux PC on NVIDIA CUDA — splitting it layer by layer and streaming only the hidden state over a framework-neutral byte protocol. No datacenter, no NCCL, no vendor lock.

A friend in New York leaves a node running while they sleep; I am in Seoul. Their GPU computes the front layers, mine the back, the hidden state crosses an encrypted wire, and every hop signs a receipt. Together the two machines run a model neither could hold alone.

It is the first concrete step under my intelligence-sovereignty essay, and I scope it as a demonstration rather than a product: my background is not AI infrastructure or political economy, and I cannot see a business or governance path for it yet.

The whole contribution lives at the boundary between nodes

Everyone in this space passes activations; what differs is what the passing is welded to. Exo binds node-to-node communication to MLX, so it is Apple-silicon only. Petals moves torch tensors over gRPC, llama.cpp's RPC is bound to ggml, and pipeline parallelism in vLLM and Megatron is welded to torch.distributed and NCCL.

NCCL cannot place an Apple Metal device and an NVIDIA CUDA device in one process group, and MLX cannot leave the Apple ecosystem. My answer is a wire carrying nothing but bytes: no torch object, no MLX array, no CUDA handle. Two runtimes that could never talk meet at a contract both can implement.

The five planes — orchestrator head, per-layer shards, one neutral wire
The five planes — orchestrator head, per-layer shards, one neutral wire

What actually crosses, and why it stays small

The format is a 4-byte big-endian length prefix and a msgpack dict, sealed as one ChaCha20-Poly1305 frame when a network key is set. Only three things cross a stage boundary: hidden_states as floats, plus position_ids and input_ids as integers. The KV cache never travels — that would be megabytes per token and would defeat the design.

The payload size depends on hidden_size, not on the parameter count: for Qwen's 1536 a decode step puts 3 072 bytes on the wire in fp16, or 1 560 in group-wise int8. Serialization is a CPU fp16 round-trip, bit-lossless when the compute dtype is fp16 — the premise that lets the split reproduce one machine exactly rather than approximately.

I froze the contract at the first milestone, so node internals can change without a flag day, and any future runtime only has to implement the framing to join.

Splitting layers is trivial until the output has to be identical

The KV cache index. Hugging Face's DynamicCache reports past length from layer zero's slot, so a shard keeping global layers 14 to 28 leaves slot zero empty: during decode the causal mask is built as if there were no past, and parity breaks silently after the first token. This one cost me the most to find, and the fix is to re-index each shard's kept layers to local, zero-based slots at load time.

Rotary embeddings. They depend only on position_ids, so each shard computes its own cosine and sine from absolute positions using the model's own rotary_emb. The boundary carries a handful of integers instead of a full tensor, and every node stays self-sufficient.

The attention mask. Causal-full for prefill, KV-length-aware for decode, rebuilt per shard and chosen per layer by that layer's own attention type — Gemma alternates local and global, and nothing about it is hardcoded.

Local re-indexing — the fix that keeps decode parity
Local re-indexing — the fix that keeps decode parity

The head stops being the hub every activation passes through

In chain mode the hidden state flows node to node and the tail delivers the final state to the head's collect sink, instead of star-routing every hop back through the head. Tensor crossings per token fall from 2N to N+1, and — the actual point — the head's bandwidth becomes constant in the node count rather than linear. A de-privileged head is only possible once it stops being a bottleneck.

With a thin head it holds zero model weights: embed_tokens becomes the first node's duty, and norm, lm_head and argmax the last node's. The head sends one integer token id into the pipeline and gets one back, doing no tensor maths and materialising no parameters. Parity survives because the argmax is invariant to which machine computes it over a bitwise-identical hidden state.

I wrote the decode loop once over an injectable transport and swap it between in-process, star and chain — so the network is the single variable between milestones, and any regression is provably a transport bug.

One decode loop, three interchangeable transports
One decode loop, three interchangeable transports

Checking a node is honest without trusting it

A network shares one 32-byte pre-shared key. Every keyed connection runs an ephemeral X25519 exchange into HKDF-SHA256 with the key mixed in, then ChaCha20-Poly1305 with a per-direction counter nonce. Mixing the key into the derivation is the membership check: a peer without it derives a different key and its first frame fails to decrypt. A node exposed through a public tunnel refuses to run unkeyed.

Every hop then signs an Ed25519 receipt over the session, sequence, layer range, input hash and output hash. On each token of ordinary traffic the head checks signatures, adjacency — hop i's output hash must equal hop i+1's input hash — and the end anchors. A fixed challenge would be escaped by a node honest only on the challenge; binding verification to real traffic leaves nothing to be selectively honest on.

What it misses I state just as plainly: a node that consistently miscomputes and signs honestly is the recompute audit's job, not the receipt's.

The parity gate — strict bitwise on one device, relaxed across vendors
The parity gate — strict bitwise on one device, relaxed across vendors
One decoder layer per node, up to 28 on the default model
One decoder layer per node, up to 28 on the default model

Every networked step must reproduce one machine before anything else lands

The in-process two-shard split matched the reference bitwise on six prompts at every generation length from 1 to 180. The TCP star matched bitwise, isolating serialization and framing. Chain mode matched at two and three nodes, and again with encryption on — the channel does not perturb a token. So did the thin head.

I killed a node mid-decode at entry, middle and tail positions, and recovered bitwise 48 times out of 48: the orchestrator re-splits across the survivors, re-prefills the sequence so far, and resumes. Because greedy decoding is deterministic over a fixed prefix, the resumed continuation is identical to never having dropped.

Tampering was caught live on ordinary generation, with zero false suspects on an honest run. The cross-vendor case is the one I actually wanted — front half on a Mac's Apple MPS, back half on a Colab NVIDIA T4 — and it reproduced one machine exactly across 130 of 130 tokens, even though the two vendors' fp16 kernels widened the first-step logit gap to roughly 2 × 10⁻² against 8 × 10⁻³ on one device.

Mac MPS plus Colab CUDA — 130 of 130 tokens matching one machine
Mac MPS plus Colab CUDA — 130 of 130 tokens matching one machine

The numbers are absolute, and they are not a cherry-picked win

Against the single-machine oracle on six prompts and every length from 1 to 180, token exact-match was 411 out of 411. First-step logit maximum absolute difference in fp32 was 7.81 × 10⁻³ — an fp16 unit in the last place — and KL divergence stayed at or under 2.82 × 10⁻¹⁰.

Per token per hop the wire carries 3.10 KB in fp16 and 1.52 KB in int8 — 51 % of the bytes at roughly 67 % measured fidelity, under a relaxed gate and never the bitwise one. Protocol overhead on localhost is about 1.2 ms a hop against roughly 41 ms of compute a token, and each node materialises only its slice, the heaviest carrying 42 % of the weights.

Depend on what you can observe

I never hardcode an architecture. At load the engine introspects the model, so the code that runs a plain Qwen decoder also runs Gemma's per-layer embeddings, square-root hidden scaling, dual rotary bases, hybrid attention and KV-sharing groups — every quirk discovered from config and signature.

That is also what lets the split scale: one node per decoder layer, up to 28 machines on Qwen and 35 on Gemma, with the head and the wire unchanged. Two to four is the practical range today, and nodes find each other by LAN discovery, a host list, a tunnel, or gossip.

An OpenAI-compatible surface sits on top, so the model still runs across DRIFT nodes while the client API is ordinary HTTP. What is still only the vision, and labelled that way rather than implied: leaderless consensus, Sybil resistance, a token economy, zero-replay failover, speculative decoding, redundant execution.