Prefix-cache-, load-, and network-aware routing for LLM replica fleets, with online weight tuning
Project description
GORGO is an online-tuned, network-aware routing policy for cross-region LLM serving. It jointly accounts for network latency, prefix-cache reuse, and replica queueing to minimize TTFT, and learns its weights via an evolutionary strategy on live traffic.
We release ART-Chat-2.5M, a synthetic long-context, high prefix-reuse chat dataset (2.5M requests, 19× the intra-user prefix reuse of WildChat-4.8M), used to tune and evaluate GORGO's routing policy in the paper.
Goal
Decrease TTFT from standard methods for LLM load balancing (least-load, session-affinity, vtc-basic) by >2× using GORGO + tuning.
Getting Started
Setup your Python environment:
uv venv
source .venv/bin/activate
uv sync
Note that for the following run commands, you can optionally specify a --env=<your-modal-env> following the run subcommand.
To launch a model replica:
REGION=us-east GPU_TYPE=H100 MODEL_ORG=Qwen MODEL_NAME=Qwen3.5-35B-A3B-FP8 modal deploy engine/modal_sglang.py
Full list of regions here.
To launch the proxy:
REGION=us-east modal run proxy/modal_proxy.py::proxy
See the list of API routes here
To run an example workload on lmsys-chat-1m:
modal run proxy/workload.py --proxy-url https://... \
--source hf --preset lmsys --num-requests 1000 --stream true
Or on Wildchat-4.8M with a specified data path:
modal run proxy/workload.py --proxy-url https://... \
--source hf --data-path /datasets/datasets/allenai__WildChat-4.8M --stream true --num-requests 1000
Note that the Modal volume names are specified in app.py
Project Structure
- proxy: Request handling, workload streaming, and parameter tuning code that all runs on CPU instances in the same region.
- engine: LLM inference engine backend. Currently sglang is supported with DeepGEMM kernels built into the image and volume weight loading.
- data_processing: Scripts for reading from HF/local volumes and saving data + statistics + serialized radix trees to volumes.
- policy: Various load-balancing policies constructed from both Arcadia Research's GORGO paper and vLLM's AI-Brix model gateway.
- utils: Helpful util classes including RadixTrie, which is used for storing KV-cache state across sglang servers in the proxy.
Running Policy Experiments
The experiment runner spawns isolated per-policy engine fleets + proxies across regions, replays a Mooncake trace, and saves results. See experiment_runner/BENCHMARK_PLAN.md for full methodology.
# 1. Build a trace (production example; also supports --source lmsys / --source wildchat)
modal run data_processing/build_mooncake_trace.py::main \
--source prod --start-time 2026-04-01T00:30:00 --end-time 2026-04-01T01:00:00 \
--num-requests 200000 --include-bodies --max-input-tokens 24000 --time-scale 1.0 \
--output-path mooncake_traces/my_trace/with_bodies/prod.jsonl
# 2. Launch (spec defines policies/regions/concurrency; manifest points at the trace)
modal run --detach experiment_runner/policy_matrix_app.py::main \
--base-spec-path specs/c64/tuning/policy_matrix_c64_tuning_p95ttft_2d.json \
--sweep-manifest-path specs/c64/manifests/manifest_prod_decoded_apr5_1615_1645.json \
--experiment-id my_experiment_v1 --start-index 0 --top-k 1 \
--output-dir /results/policy_matrix_sweep/my_experiment_v1
# 3. Monitor / early-stop
python scripts/experiment_status.py --experiment-id my_experiment_v1 --env alessio-dev
python scripts/stop_experiment.py --experiment-id my_experiment_v1 # saves partial results
# 4. Pull + analyze
modal volume get --force GORGO-bench-results /workload_runs results/
python scripts/analyze_results.py --prefix <run_prefix> --label "My Run"
python scripts/plot_policy_summary.py --results-dir results --run-prefix <run_prefix> --out results/analysis/summary.png
To reproduce the paper's tuning + eval runs, use the specs/manifests in
specs/c64/:tuning/policy_matrix_c64_tuning_p95ttft_2d.json(tuning) andeval_ts2/{apr6,apr7_ts3}.json(held-out eval), each paired with the matching file inspecs/c64/manifests/.specs/c64/loadsweep_apr7/holds thetime_scalesweep used for the load-sweep results.
Using the public ART-Chat-2.5M dataset
The paper's traces above live on a private Modal volume, but ART-Chat-2.5M ships the same data publicly as one Mooncake FAST'25 JSONL per day (jsonl/artchat_week_<YYYYMMDD>.jsonl, April 1st–7th 2026) — already in the request/timestamp/hash_ids shape the proxy replays directly, so no conversion script is needed.
# 1. Download a day's trace and land it on the GORGO-hf-datasets volume
huggingface-cli download alessiotoniolo/ART-Chat-2.5M \
jsonl/artchat_week_20260405.jsonl --repo-type dataset --local-dir /tmp/art-chat
modal volume put GORGO-hf-datasets \
/tmp/art-chat/jsonl/artchat_week_20260405.jsonl \
mooncake_traces/art_chat/artchat_week_20260405.jsonl
# 2. Point a manifest at it (mirrors the shape of specs/c64/manifests/*.json)
cat > specs/c64/manifests/manifest_hf_apr5.json <<'EOF'
{"top": [{"result": {"output_path": "/datasets/mooncake_traces/art_chat/artchat_week_20260405.jsonl"}}]}
EOF
# 3. Launch with any spec from specs/c64/, same as above
modal run --detach experiment_runner/policy_matrix_app.py::main \
--base-spec-path specs/c64/tuning/policy_matrix_c64_tuning_p95ttft_2d.json \
--sweep-manifest-path specs/c64/manifests/manifest_hf_apr5.json \
--experiment-id my_hf_run --start-index 0 --top-k 1 \
--output-dir /results/policy_matrix_sweep/my_hf_run
Row
timestampin the released trace is milliseconds since the start of the whole week, not the start of that day, so an"arrival_mode": "open-loop"spec (used by the paper's specs, tuned for a pre-sliced 30-minute window) will sit idle for days before the first request. For a full day file, either slice/rebase it yourself to the window you want, or set"arrival_mode": "bounded"in your spec copy to replay requests back-to-back at the configured concurrency and ignore the raw schedule entirely.
Tuning Parameters
The tuning script is now a lightweight client for the running proxy. It
submits a batch tuning request to the proxy's embedded /tuning/* API; the
proxy runs the workload locally against http://127.0.0.1:8000 so the tuning
metric does not include client-to-proxy tunnel latency. Start the proxy with
the GORGO-completions and GORGO-bench-results volumes available (the
default proxy/modal_proxy.py::proxy deployment does this) and set the active
policy to gorgo before launching a run.
The tuning script will present a TUI allowing you to adjust default parameters before starting the proxy-managed workload steps.
modal run -q proxy/tuning.py::tune_interactive --proxy-url https://your-proxy.modal.run
Alternatively, you can specify the specific parameters/settings via CLI args:
modal run proxy/tuning.py::tune_cli --proxy-url https://your-proxy.modal.run \
--start-time 2026-04-01T12:00:00 \
--num-requests 200 \
--concurrency 32 \
--metric output_throughput \
--algorithm gaussian-es \
--max-steps 16 \
--seed 0 \
--t-prefill-min 1e-4 --t-prefill-max 0.1 \
--queued-tokens-weight-min 1e-3 --queued-tokens-weight-max 0.05
Citation
@misc{gorgo2026,
title = {GORGO: Online Tuning for Cross-Region Network-Aware LLM Serving},
author = {Toniolo, Alessio Ricci and Thorstenson, Rome and Dinesh, Abinaya},
year = {2026},
eprint = {2602.11688},
archivePrefix = {arXiv},
primaryClass = {cs.DC}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gorgo_lb-0.2.0.tar.gz.
File metadata
- Download URL: gorgo_lb-0.2.0.tar.gz
- Upload date:
- Size: 7.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Oracle Linux Server","version":"9.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a229253cc5ca5fb43484f3712b2a2526b16f65ca4f9b2b0f65983671098550e
|
|
| MD5 |
f30737bd8ba3765516bf8a24abaf5801
|
|
| BLAKE2b-256 |
d24f9081e65d515894e0e475a1a4329ce52b83494847c9ffbde9be403c0e8bad
|
File details
Details for the file gorgo_lb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gorgo_lb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Oracle Linux Server","version":"9.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
740c212b8a25bdde4bfd2d095161113e4c8ca4ef74ac462d85d148ed4803e80a
|
|
| MD5 |
de115e13309688ecbfd37cd648ac6127
|
|
| BLAKE2b-256 |
336b32e4d45dc42e2d4533e3f4bf91fed141c8ec9511db124918a80b8b4b460a
|