Repository navigation
[LoRA] csgmv vs triton: 3.6 to 11% lower latency on a small model, vs 20 to 80% in the docs #52614
Replies: 1 comment
|
Yes — your guess is spot on: the Exact benchmark setup in PR #10286From PR #10286's benchmarking section: python -m sglang.launch_server \
--model-path meta-llama/Llama-3.1-8B-Instruct \
--disable-radix-cache \
--lora-paths lora=algoprog/fact-generation-llama-3.1-8b-instruct-lora \
--lora-backend csgmv \
--port 30000
python3 -m sglang.bench_serving \
--backend sglang \
--num-prompt 1000 \
--request-rate <2,8,16,inf> \
--dataset-name sharegpt \
--lora-name loraReported results (Median E2E Latency / Median ITL / Median TTFT vs. baseline
Why your setup shows 3.6–11% instead of 20–80%Four concrete differences between your benchmark and #10286 explain the gap:
If you re-run your script with |
Uh oh!
There was an error while loading. Please reload this page.
The LoRA docs (https://github.com/sgl-project/sglang/blob/v0.5.23/docs/docs/advanced_features/lora.mdx) say: "The
csgmvbackend was recently introduced to improve performance especially at high-concurrency scenarios. Our benchmark shows that it achieves 20% to 80% latency improvements over the basic triton backend."I tried to reproduce that on a different setup and measured a smaller difference. I'd like to know which settings the documented range was measured on. I found PR #10286, which reports -9% to -81% median end-to-end latency for Llama-3.1-8B-Instruct with one adapter on ShareGPT; I assume that is the source but am not sure.
My setup (SGLang 0.5.23, one RTX 4090, Qwen2.5-1.5B-Instruct, 32 synthetic rank-16 adapters, Zipf popularity,
--max-loras-per-batch 16, closed loop, 500 requests per run with 50 warm-up excluded, 3 repeats per cell). The bar I wrote down before running: at least 20% lower median p95 latency at concurrency 32 and above, with non-overlapping min-max ranges. Result: not met.Median (min-max) over 3 repeats:
Medians, which are closer to what #10286 reports (not the pre-registered metric): at 128, TTFT p50 761.9 vs 632.9 ms (-16.9%), end-to-end p50 5119.3 vs 4873.5 ms (-4.8%), TPOT p50 34.7 vs 33.6 ms (-3.2%). At 32, end-to-end p50 -3.7%, TTFT p50 -8.4%. At 8 the differences were under 5% and ranges overlapped.
Two reference runs at 20 rps with no adapters, before and after each backend's cells, differed by +0.1% (triton) and +0.8% (csgmv) in median end-to-end latency.
This may depend on model size, rank, GPU or the number of adapters; I tested one of each, and I did not test the setup in #10286. Could you say which settings the 20% to 80% was measured on, and whether the docs could name them?
Reproduction
Server: as in the study script with
--lora-backend tritonor--lora-backend csgmv, otherwise identical flags (--max-lora-rank 16 --max-loras-per-batch 16, all 7 linear target modules, 32 adapters,--mem-fraction-static 0.85 --context-length 4096). Load:scripts/loadgen.py --engine sglang --concurrency {8,32,128} --requests 500 --warmup 50 --adapters 32 --popularity zipf --seed 100+repeat. Adapters: synthetic, rank 16, alpha 32, B ~ N(0, 0.05^2), seeded (scripts/make_adapters.py).Not known: why the gap is smaller here. One model, one GPU, rank 16. Environment: SGLang 0.5.23, one RTX 4090. I do not have
check_envoutput from that machine (it is gone) and can rerun it if useful. I can run other settings if useful.AI tools helped with analysis scripts and code reading. The measurements and conclusions are mine.
All reactions