Skip to content

feat(why_sie): compare serving jobs with and without SIE - #39

Merged
rparundekar merged 19 commits into
mainfrom
feat/why-sie
Nov 16, 2026
Merged

rparundekar merged 19 commits into
mainfrom
feat/why-sie

Conversation

@rparundekar

@rparundekar rparundekar commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

Adds a why_sie/ folder. Each recipe in it does one serving job the way a team would build it by hand, does the same job on SIE with the same models and load, and reports the numbers, including where SIE doesn't come out ahead.

  • why_sie/README.md: what the folder is for, and a table of six serving jobs with what we found for each. All six have a recipe in this PR.
  • why_sie/measure_cold_starts_and_bursts: one rerank call to a model that's usually at zero on SIE Serverless, retried on each 503 for as long as its Retry-After says; the same call warm; then 2,000 bge-m3 calls from 32 callers. Live run on 16 Nov 2026: answered cold after 81.5 s (one 503 at 20 s, Retry-After: 60), warm in 0.32 s, and the burst had 0 errors with a p95 of 1.42 s. 3 of 3 as expected.
  • why_sie/share_one_gpu_between_two_sglang_models: Qwen3-Embedding-4B and Qwen3Guard-Gen-0.6B on one 24 GB L4, set up three ways: plain SGLang at its defaults, plain SGLang with --mem-fraction-static set by hand, and one SIE server with KV budgets. Run on one L4 on 16 Nov 2026: at the defaults the guard ran out of memory; by hand the embedder kept 64% of its throughput alone and the guard 47%; with SIE both started on the first try and kept 66% and 64%. 1 of 3 as expected: neither shared setup kept the 80% we hoped for, and the README says SIE saves the memory arithmetic, not compute. It also reports that the guard alone was slower through SIE (44 vs 63 checks a second).
  • why_sie/find_when_a_gpu_pays_off: bge-m3 throughput on one L4 by input mix and concurrency, and the break-even against paying per call. Live run: about 51,600 tokens a second on the mixed inputs, so paying per call is cheaper below about 11% busy.
  • why_sie/pack_five_models_on_one_gpu: an agent turn of five calls, one server per model against packed on two GPUs and one. Live run on four A10s: at 50% load the slowest 5% of turns took 2.10 times as long on two GPUs and 3.17 times on one, past the 1.25 bar; the reranker slows its neighbours.
  • why_sie/serve_more_models_than_fit: 10 models that fit against 16 that don't, one server on one GPU, bge-m3 pinned. Live run on one A10: no unloads when they fit; about 1,740 an hour when they don't, a median 10.5 s wait for a model to load, and the pinned model never reloaded but its p99 went from 34 ms to 2.1 s. The original two-worker result about duplicate loads isn't covered, and the README says so.
  • why_sie/kill_a_worker_under_load: SIE's gateway and queue against a hand-built round-robin with health checks, from published images (gateway, sidecar, server, NATS). Live run on two A10s: the queue handles about 0.92 of round-robin's capacity, lost 0 of 38,440 requests through three worker kills against 26 failures for round-robin, and a killed SGLang engine answered again after 31 s and 61 s.
  • AGENTS.md: an exception for why_sie/. These recipes report latency, errors and throughput, which the rest of the repo doesn't, and they still run live.
  • tools/check_tree.py, root README.md, MODELS.md: register the folder, index the two recipes, add the models the recipes use (licenses checked on Hugging Face, images from SIE v0.11.1's compatibility matrix).

Every recipe except the cold-start one starts its own servers on your GPUs, so it needs Docker and one to four 24 GB GPUs, and doesn't use SIE Serverless. The live runs used --launcher process in an environment built from SIE v0.11.1's source; the docker run paths run the same commands in the published images and haven't been run end to end. Two setups need a server with models from two bundles, which no published image serves yet (superlinked/sie#969); their READMEs say so.

How failures are reported

Each recipe judges its own run against thresholds in its rules.yaml and writes the verdicts to summary.json, saved after every setup. A setup that can't start or can't be measured gets a "not measured" verdict with the reason, and the run exits 1 when any verdict fails. Every server the recipes start binds to 127.0.0.1, except the SIE sidecar's probe port, which SIE v0.11.1 hard-codes to all interfaces. --launcher process takes --server-python, the interpreter of an environment with SIE installed.

Checks

  • uvx pre-commit run --all-files passes
  • Each changed recipe: uv lock --check, strict mypy and uv run recipe.py --help pass
  • Each changed recipe ran live (uv run recipe.py), and its README matches what came out
  • Data is synthetic or from a public dataset whose license allows redistribution, named in the README (synthetic passages and prompts; NFCorpus, CC BY-SA 4.0)
  • No API keys, .env files, runs/ output or personal data

Generated using wayfare.

@rparundekar

Copy link
Copy Markdown
Collaborator Author

Self-Review

Six passes over the full diff (about 5,500 lines in 58 files, not counting lockfiles and data): code, silent failures, tests, comments and docs, types, and security. Lint, strict mypy, every selfcheck and tools/check_tree.py pass. Every number in the six recipe READMEs matches what its recipe.py computes.

Important (12)

  • [security] why_sie/kill_a_worker_under_load/recipe.py:108,187,216,254,285,510: with --network host, the workers, gateway and NATS bind to every interface with no auth (serve has no --host, NATS has no -a). On a rented cloud GPU box, anyone who can reach it can use the GPUs or read and forge queue messages. The other five recipes pass --host 127.0.0.1.
  • [code, types, tests, silent-failure] why_sie/kill_a_worker_under_load/recipe.py:606-613,670-671: if the queue setup fails to start, verdicts() reads kill["queue"]["failed"] from an error dict, raises KeyError, and summary.json is never written.
  • [code] every recipe's --launcher process runs python from PATH, which under uv run is the recipe's own venv without sglang or sie_server, so the servers exit at once (share_one recipe.py:90, find_when :88, pack_five :95, serve_more :97, kill :196,:515). The READMEs say the numbers came from process mode, which only works with the image environment's interpreter.
  • [silent-failure] why_sie/kill_a_worker_under_load/recipe.py:131-145: docker kill runs with check=False and nothing confirms the worker is gone, so a failed kill records "0 failed" and passes. recipe.py:47-61,522-527: the engine kill can match no process and pass; in process mode it kills every SGLang process on the host. recipe.py:452-459: nothing checks that the restarted worker came back.
  • [silent-failure, tests] why_sie/pack_five_models_on_one_gpu/recipe.py:313-327,352-367: p95 counts successful turns only and verdicts() never reads failed, so a setup that fails many turns can pass.
  • [silent-failure, tests] why_sie/serve_more_models_than_fit/recipe.py:360-387,270-281: "fit" and "pinned" pass when every request failed or when the log regex matches nothing; log times are dated from the first request, so a run across UTC midnight drops events.
  • [silent-failure] why_sie/share_one_gpu_between_two_sglang_models/recipe.py:446-453: the defaults verdict passes when the guard fails to start for any reason, though guard_ran_out_of_memory is already computed.
  • [types, tests] why_sie/find_when_a_gpu_pays_off/recipe.py:177-183,291-294: missing usage counts as 0 tokens; a cell with no tokens makes the break-even None and the printout raises TypeError. why_sie/pack_five_models_on_one_gpu/recipe.py:276-279,452-461: zero capacity reaches expovariate(0.0) and crashes.
  • [silent-failure, code] share_one, pack_five, serve_more, kill: summary.json is written only at the end, so one exception loses the setups already measured; a skipped or failed setup leaves no verdict and the run exits 0.
  • [comments, code] why_sie/README.md:16-23: several rows quote the earlier experiments where the recipes report their own runs (1.8x vs 2.10x, two GPUs and about 1,300 unloads an hour vs one GPU and 1,740, 42 of 115,337 and "up to 15 s" vs 26 of 38,440 and a 30.3 s slowest request, "about 60% each" vs 47 to 66%), and the May 2026 cold starts sit under "our runs in November 2026".
  • [comments, code] AGENTS.md:66-69 and why_sie/README.md:8-9: the exception says every recipe runs a by-hand setup, but three compare against a stated baseline, and it doesn't exempt these recipes from "only uv and an SIE API key" or make_client().
  • [comments, code] MODELS.md (Qwen3-Embedding-4B row) still names cuda12-sglang-embedding, which has no published image (Published SGLang image refuses SGLang embedders, so an embedder and a guard can't share one SIE server sie#969); pack_five README:200-206 says "Tested on L4" for a run on A10s; thresholds sit in code (kill recipe.py:624-626) or nowhere (find_when's Pass/Miss lines are judged by hand).

Suggestions (14)

  • [tests] Several selfchecks assert values read from rules.yaml (find_when selfcheck.py:13-20, serve_more :15-16, measure_cold :37-52), so editing the settings breaks them; the verdict functions' failure branches are mostly untested.
  • [silent-failure] measure_cold recipe.py:164-178 reports a cold pass when the model was already warm; recipe.py:96 treats Retry-After: 0 as missing and sleeps 60 s; with --skip-cold the burst gets no verdict.
  • [silent-failure] Readiness checks poll fixed ports, so a container left from an earlier run can answer for the new server; wait_for_empty_gpu(s) gives up silently after 60 s; docker rm -f failures are ignored.
  • [silent-failure, types] share_one recipe.py:206-233: alone-phase errors lower the baseline and inflate "kept"; find_when best() can pick a cell with errors; warm-up loops retry every exception for up to 900 s.
  • [comments] serve_more README:57-59 says a load "started" but the code matches "loaded successfully"; README:36 says the passages on disk are cut to 1,000 characters (cut at runtime); rules.yaml:29 says ten models (nine listed).
  • [comments] pack_five README:100,43-44,159: --setups two_gpus needs one_per_model for a comparison; the warm-up filter is on send time; the 120 s timeout is per call.
  • [comments] share_one README:23,141-142: 82% is SGLang's static fraction, not total use; the GiB and fraction figures need their bases.
  • [comments] find_when README:154 says "a few thousand tokens a second" (break-even is about 5,900); README:123's verdict line doesn't match the Pass/Miss regex; README:97 mentions a server log --launcher none doesn't write.
  • [comments] .env.example in the five GPU recipes asks for an API key the recipe never reads.
  • [comments] MODELS.md bge-m3 and Qwen3Guard-Gen-0.6B use descriptions fit one recipe only.
  • [code] kill recipe: --steps engine still starts both stacks; worker restart under the same --rm name can collide; the in-flight requests at an engine kill aren't counted.
  • [code] pack_five recipe.py:452-461: capacity takes the min of the two passes' rates, which overstates a five-call baseline turn.
  • [types] pack_five Runner.measure returns two shapes; serve_more Summary is built from 16 positional arguments.
  • [security] kill_a_worker_under_load/config/bundles/sglang.yaml:20 names a hosting vendor in a comment copied from public SIE; optional to drop.

Strengths

  • Every recipe has an offline selfcheck that CI runs, built from hand-written rows that read like real cases.
  • Units are named consistently (_s, _ms), and producers and consumers of the summary dicts agree on keys.
  • YAML is always safe_load, subprocesses use argv lists, downloads use pinned revisions, and no secrets, private repo names or internal costs are committed.
  • The copied SIE configs are byte-identical to v0.11.1, and the parsed log lines, timeouts and environment variables match SIE's source.

Generated using wayfare.

… failed step

- Workers, round-robin and engine servers, the gateway and NATS bind to 127.0.0.1; the sidecar probe port is hard-coded to all interfaces in SIE v0.11.1 and the README says so.
- A failed setup or step is recorded and reported as not measured, summary.json is saved after every step, and the run exits 1 when a verdict fails.
- Kills are confirmed before they are timed, restarts wait for readiness, the engine kill reports how many processes it stopped and only targets its own server, and every engine recovery is judged against thresholds in rules.yaml.
…king recipe

- A setup that fails more than max_failed_share of its turns fails its verdict.
- Setups that can't run are recorded as not measured, summary.json is saved after each setup, and zero baseline capacity stops with a clear message.
- The README names the A10s the run used and prices them at the L4 rate.
…equests or unparsed logs

- Fit and pinned need the failed share under a bar, and both fail when no load events for the pinned model were parsed.
- Log times across UTC midnight are handled, and a setup that errors is reported as not measured.
- Labels per model live in rules.yaml.
…verdict

- Errors and missing usage are counted in the same window as successes and fail a phase above max_error_share.
- Warm-up retries only on loading and connection errors.
- The published-image limit (superlinked/sie#969) is stated in Run it.
- Expected outcomes live under expect in rules.yaml and verdicts() computes them.
- Cells with errors or missing usage are counted and left out of the headline; no tokens prints n/a.
- The server is pinned to one GPU.
- Every 503 is checked for a Retry-After, and Retry-After 0 is no longer treated as missing.
- The burst verdict is kept with --skip-cold, calls per second counts successful calls, and the client timeout lives in rules.yaml.
… against

- The why_sie table quotes each recipe's run and labels the earlier Kubernetes numbers.
- The AGENTS.md exception covers a stated baseline as well as a by-hand setup, and GPU recipes that start their own servers.
- MODELS.md points the Qwen3-Embedding-4B image to superlinked/sie#969.
@rparundekar

Copy link
Copy Markdown
Collaborator Author

Self-Review: Improvements

Important (12 / 12 fixed):

  • why_sie/kill_a_worker_under_load/recipe.py: servers, gateway and NATS open on every interface. Fixed: all bind to 127.0.0.1 and NATS monitoring is dropped. The sidecar probe port is hard-coded to 0.0.0.0 in SIE v0.11.1 (runtime_state.rs:121), so the README names it as the one exception.
  • why_sie/kill_a_worker_under_load/recipe.py: KeyError on a failed queue setup lost summary.json. Fixed: setup and step errors are recorded separately and become not-measured verdicts.
  • every recipe: --launcher process ran the recipe's own venv Python. Fixed: new --server-python flag, documented in each README.
  • why_sie/kill_a_worker_under_load/recipe.py: unconfirmed worker and engine kills, unchecked restarts, host-wide engine kill. Fixed: kills are confirmed before timing, restarts wait for readiness, the engine kill counts its processes and only targets its own server's children.
  • why_sie/pack_five_models_on_one_gpu/recipe.py: failed turns ignored by the verdict. Fixed: max_failed_share in rules.yaml.
  • why_sie/serve_more_models_than_fit/recipe.py: fit and pinned passed on failures or an unparsed log; midnight dates. Fixed: failure bar, a no-load-events guard, and midnight handling.
  • why_sie/share_one_gpu_between_two_sglang_models/recipe.py: defaults verdict passed on any start failure. Fixed: it needs the out-of-memory error.
  • why_sie/find_when_a_gpu_pays_off/recipe.py and pack_five recipe.py: zero tokens or zero capacity crashed. Fixed: missing usage is counted, no tokens prints n/a, zero capacity stops with a clear message.
  • share_one, pack_five, serve_more, kill: summary.json only at the end, missing verdicts, exit 0. Fixed: saved after each setup or step, not-measured verdicts, exit 1 when any verdict fails.
  • why_sie/README.md: rows quoted the earlier runs. Fixed: each row quotes its recipe's run, and the May 2026 cluster numbers are labelled.
  • AGENTS.md: the exception overclaimed and didn't cover GPU recipes. Fixed: by-hand or stated baseline; GPU recipes may need Docker and skip make_client().
  • MODELS.md, pack_five README, kill recipe thresholds, find_when verdicts. Fixed: the Qwen3-Embedding-4B row points to Published SGLang image refuses SGLang embedders, so an embedder and a guard can't share one SIE server sie#969, A10 is named, engine thresholds moved to rules.yaml, find_when computes its verdicts from expect:.

Suggestions (14 / 14 fixed):

  • Selfchecks use hand-written thresholds and cover the verdict failure branches, the cold-start retry loop, log parsing in v0.11.1's format, and httpx replies through MockTransport.
  • measure_cold: an already-warm model reports no cold start measured; Retry-After 0 sleeps 0; the burst verdict stays with --skip-cold; calls per second counts successes.
  • Port-free checks before every start; GPU-not-empty and docker rm failures are reported; stop loops survive a timeout.
  • Alone-phase errors no longer inflate "kept"; best() skips bad cells; warm-ups retry only on loading and connection errors.
  • README wording fixed for load timing, runtime passage cuts, the per-call timeout, the 82% figure, the 6,000 tokens a second line, the verdict regex and .env.example in the GPU recipes.
  • Types: Runner.measure split in two, Summary built by keyword, labels per model in rules.yaml; the vendor name dropped from a copied comment.

Checks after the fixes: ruff, ruff format, strict mypy, uv lock --check, every selfcheck, recipe.py --help and tools/check_tree.py pass in all six recipes. No GPU runs: the measured numbers in the READMEs are unchanged.

Commits: 559cf52, a80f1d7, ddf9d18, 5af1c64, e69c164, 70f0e9b, aa15bde


Generated using wayfare.

@rparundekar rparundekar changed the title feat(why_sie): add recipes that compare serving jobs built by hand with SIE feat(why_sie): compare serving jobs with and without SIE Nov 16, 2026
@rparundekar
rparundekar merged commit 56ee4d1 into main Nov 16, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant