Skip to content

Commit 048dddf

Browse files
test(case2): real two-process socket + real-network confirmation
Added socket_echo_server.py (remote-host boundary) + --socket-echo-addr socket round-trip of the REAL per-block aux payload (~156KB/block) in the fused engine. tc netem is blocked in the vast container (no NET_ADMIN), so real latency came from a real inter-host link (reverse SSH tunnel, ~102ms RTT): loopback (~0ms): 51.5 tok/s = 2.02x AR real net (~102ms): 14.1 tok/s = 0.56x AR (net loss; network = 71% wall time) End-to-end real-models + real-network proof that the cross-host token-level draft data plane is WAN-infeasible. Updated ADR 0014 + README. Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
1 parent baa7ace commit 048dddf

4 files changed

Lines changed: 606 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ H200 compute by injecting one proposer↔verifier round-trip per block:
267267
| vs AR | **2.20×** | 1.81× | 1.50× | 1.22× | **0.98×** (break-even) | 0.77× (loss) |
268268

269269
**Break-even ≈100 ms/block**: a cloud↔desk WAN (30–150 ms) straddles/exceeds it,
270-
while a LAN (≤15 ms) keeps the 1.8–2.2× win. So the realizable split is **WAN =
270+
while a LAN (≤15 ms) keeps the 1.8–2.2× win. Confirmed end-to-end with a **real
271+
two-process socket over a real ~102 ms network** (reverse SSH tunnel, real
272+
156 KB/block aux payload): co-located **2.02×** → real-network **0.56× AR** (a
273+
net loss; network was 71 % of wall time). So the realizable split is **WAN =
271274
control + tool plane** (the Mac bridge) and **LAN = co-located data plane**. See
272275
[ADR 0014](docs/adr/0014-agent-connection-capacity-and-cross-host-topology-tests.md)
273276
for the full plan, evidence, and the served-MLX-gemma gap found during testing.

docs/adr/0014-agent-connection-capacity-and-cross-host-topology-tests.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,33 @@ straddles or exceeds break-even, while a LAN/Thunderbolt link (≤15 ms) preserv
183183
the 1.8–2.2× win. This is the architecture's prediction (design doc §4.2),
184184
**now quantified on real compute** — and it is why the data plane must be LAN.
185185

186+
### 4.4 Real two-process socket over a real network (no simulation)
187+
188+
To remove the "injected sleep" caveat, the per-block exchange was run through a
189+
**real TCP socket to a second process** (`scripts/research/socket_echo_server.py`),
190+
serializing the **actual** per-block payload — the verifier→proposer aux hidden
191+
states + draft tokens, **≈156 KB/block** — once per block
192+
(`--socket-echo-addr`). Two transports were measured (H200 NVL,
193+
`results/research/k3_crosshost_{socket_loopback,realnet}_gpu.json`):
194+
195+
| transport | RTT | decode tok/s | vs AR |
196+
| --- | --- | --- | --- |
197+
| loopback socket (same host) | ~0 ms | 51.5 | **2.02×** |
198+
| **real network** (GPU↔cloud-agent, reverse SSH tunnel) | **~102 ms** | **14.1** | **0.56×** |
199+
200+
- **Loopback** matches the co-located number → the socket + serialization of the
201+
156 KB payload are themselves cheap; the killer is purely the round-trip.
202+
- **Real network**: at a genuine ~102 ms RTT the cross-host loop collapses to
203+
**0.56× AR — a net loss, worse than running AR alone**, and *worse* than the
204+
latency-only model (0.98× at 100 ms) because the real transport also pays the
205+
**156 KB/block bandwidth** (network was **71 %** of decode wall time). This is
206+
an end-to-end real-models + real-network confirmation that the token-level
207+
draft data plane is WAN-infeasible.
208+
- Note: `tc netem` artificial latency could **not** be applied inside the vast
209+
container (`RTNETLINK: Operation not permitted` — no `NET_ADMIN` in the
210+
restricted netns), so real latency was obtained from a real inter-host link
211+
(the reverse-tunnel RTT) rather than synthetic netem.
212+
186213
## 5. Decision
187214

188215
1. **Case 1 is validated**: the session-bound gRPC runtime admits and serves
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
{
2+
"kind": "k3_specdecode_gpu_bench",
3+
"config": {
4+
"verifier_id": "google/gemma-4-26B-A4B-it",
5+
"drafter_id": "z-lab/gemma-4-26B-A4B-it-DFlash",
6+
"f_theta_dir": "results/research/f_theta_v5_s5_sliding",
7+
"haystack_lines": 160,
8+
"n_samples": 2,
9+
"max_new_tokens": 64,
10+
"block_size": 16,
11+
"sink": 4,
12+
"window": 64,
13+
"seed": 0,
14+
"skip_unfused": true,
15+
"rtt_sweep": null,
16+
"socket_echo_addr": "127.0.0.1:53999",
17+
"netem_sweep": "0",
18+
"netem_dev": "lo",
19+
"output": "results/research/k3_crosshost_realnet_gpu3.json"
20+
},
21+
"env": {
22+
"gpu": "NVIDIA H200 NVL",
23+
"torch": "2.12.0+cu130"
24+
},
25+
"prompt_tokens": {
26+
"min": 3238,
27+
"max": 3238
28+
},
29+
"ar_incremental": {
30+
"decode_tokens_per_s_mean": 25.286,
31+
"recall": 1.0
32+
},
33+
"restored_pertoken": {
34+
"decode_tokens_per_s_mean": 25.677,
35+
"recall": 1.0
36+
},
37+
"restored_specdecode": {
38+
"skipped": true,
39+
"decode_tokens_per_s_mean": null,
40+
"mean_accept_len": 0.0,
41+
"recall": 0.0,
42+
"per_sample": [
43+
{
44+
"decode_tokens_per_s": null,
45+
"mean_accept_len": 0.0,
46+
"time_breakdown_s": {
47+
"aux_clean_forward": 0.0,
48+
"drafter": 0.0,
49+
"incremental_verify": 0.0
50+
},
51+
"tokens": []
52+
},
53+
{
54+
"decode_tokens_per_s": null,
55+
"mean_accept_len": 0.0,
56+
"time_breakdown_s": {
57+
"aux_clean_forward": 0.0,
58+
"drafter": 0.0,
59+
"incremental_verify": 0.0
60+
},
61+
"tokens": []
62+
}
63+
]
64+
},
65+
"restored_specdecode_fused": {
66+
"decode_tokens_per_s_mean": 46.032,
67+
"mean_accept_len": 3.49,
68+
"time_breakdown_s_mean": {
69+
"drafter_cached": 0.179,
70+
"incremental_verify": 1.216,
71+
"ctx_kv_extend": 0.026
72+
},
73+
"recall": 1.0,
74+
"per_sample": [
75+
{
76+
"tokens": [
77+
818,
78+
6789,
79+
3393,
80+
563,
81+
5213,
82+
28487,
83+
1618,
84+
236772,
85+
236832,
86+
236828,
87+
236819,
88+
236771,
89+
84750,
90+
106,
91+
106,
92+
107,
93+
45518,
94+
107,
95+
101,
96+
818,
97+
6789,
98+
3393,
99+
563,
100+
5213,
101+
28487,
102+
1618,
103+
236772,
104+
236832,
105+
236828,
106+
236819,
107+
236771,
108+
84750,
109+
106,
110+
106,
111+
107,
112+
45518,
113+
107,
114+
101,
115+
818,
116+
6789,
117+
3393,
118+
563,
119+
5213,
120+
28487,
121+
1618,
122+
236772,
123+
236832,
124+
236828,
125+
236819,
126+
236771,
127+
84750,
128+
106,
129+
106,
130+
106,
131+
45518,
132+
107,
133+
101,
134+
818,
135+
6789,
136+
3393,
137+
563,
138+
5213,
139+
28487,
140+
1618
141+
],
142+
"decode_s": 1.2094762809574604,
143+
"prefill_s": 0.811,
144+
"decode_tokens_per_s": 52.915,
145+
"time_breakdown_s": {
146+
"drafter_cached": 0.052,
147+
"incremental_verify": 1.134,
148+
"ctx_kv_extend": 0.023,
149+
"network_rtt": 0.0
150+
},
151+
"blocks": 14,
152+
"mean_accept_len": 3.64,
153+
"decode_tokens": 64,
154+
"block_rtt_ms": 0.0,
155+
"net_bytes_per_block": 0
156+
},
157+
{
158+
"tokens": [
159+
818,
160+
6789,
161+
3393,
162+
563,
163+
5213,
164+
236777,
165+
59790,
166+
236772,
167+
236828,
168+
236819,
169+
236825,
170+
236770,
171+
84750,
172+
106,
173+
106,
174+
45518,
175+
107,
176+
101,
177+
818,
178+
6789,
179+
3393,
180+
563,
181+
5213,
182+
236777,
183+
59790,
184+
236772,
185+
236828,
186+
236819,
187+
236825,
188+
236770,
189+
84750,
190+
106,
191+
106,
192+
106,
193+
107,
194+
45518,
195+
107,
196+
101,
197+
818,
198+
6789,
199+
3393,
200+
563,
201+
5213,
202+
236777,
203+
59790,
204+
236772,
205+
236828,
206+
236819,
207+
236825,
208+
236770,
209+
84750,
210+
106,
211+
106,
212+
106,
213+
107,
214+
45518,
215+
107,
216+
101,
217+
818,
218+
6789,
219+
3393,
220+
563,
221+
5213,
222+
236777
223+
],
224+
"decode_s": 1.6348003204911947,
225+
"prefill_s": 0.808,
226+
"decode_tokens_per_s": 39.149,
227+
"time_breakdown_s": {
228+
"drafter_cached": 0.307,
229+
"incremental_verify": 1.298,
230+
"ctx_kv_extend": 0.028,
231+
"network_rtt": 0.0
232+
},
233+
"blocks": 15,
234+
"mean_accept_len": 3.33,
235+
"decode_tokens": 64,
236+
"block_rtt_ms": 0.0,
237+
"net_bytes_per_block": 0
238+
}
239+
],
240+
"speedup_over_ar_x": 1.82
241+
},
242+
"crosshost_socket_netem_sweep": {
243+
"ar_baseline_tps": 25.286,
244+
"transport": "real TCP socket round-trip + tc netem on lo",
245+
"sweep": [
246+
{
247+
"netem_delay_ms": 0.0,
248+
"tc_applied": false,
249+
"decode_tokens_per_s": 14.075,
250+
"vs_ar_x": 0.557,
251+
"blocks": 14,
252+
"mean_accept_len": 3.64,
253+
"net_bytes_per_block": 159477,
254+
"network_s": 3.25,
255+
"decode_s": 4.546940378844738
256+
}
257+
],
258+
"max_netem_ms_at_or_above_ar": 0.0
259+
}
260+
}

0 commit comments

Comments
 (0)