Skip to main content

PolyServe

tests

PolyServe is an autotuner for LLM serving: it finds the fastest configuration for your GPU and your traffic, then serves it. Give it a model and, ideally, a sample of your prompts. It knows which settings each engine offers on each card (vLLM, SGLang and llama.cpp; weight precision, batch size, KV-cache type, speculative decoding and more), drops every configuration that will not fit in memory, measures the rest on your prompts, and serves the fastest one that meets your latency target behind an OpenAI-compatible API. What pays is what it tries and how it measures, not the order it tries things in. The winning settings changed from card to card and from one set of prompts to another, so PolyServe's pick beat a fixed rule of thumb (fp8 weights and KV cache, a short context, batch 256) by 15–97% on the three cards where both ran; but random sampling of the same settings, given the same time, did as well as PolyServe's staged order on two of those cards and better on the third. Calibration measures speed and latency; what quantization costs in answer quality is checked separately.

Results

Measured on rented GPUs against stock vllm serve and SGLang defaults:

  • The pick holds on prompts it never saw. Llama 3.1 8B, calibrated on 300 Dolly-15k prompts and measured on 300 others: +93% on an A40, +59% on an A100, +71% on an RTX 4090 over stock SGLang (stock vLLM does not start there), and +24% on an H100 over stock vLLM with fp8 weights.
  • Your traffic decides what pays. On one A40 with Qwen2.5-3B the pick changed with the prompts: suffix decoding on Dolly prompts (+122% on held-out prompts), a draft model on news-article extraction (+66.5%), an fp8 KV cache on real chat (+10%).
  • Calibration pays for itself within hours. It took 22–56 minutes per model and workload, repaid by 0.5–2.6 hours of busy serving on held-out prompts. Measuring the busiest load first skips 29–45% of that time without changing a pick.

Every result, with methods, ablations, quality checks and limits: docs/benchmarks.md.

Quickstart

pip install git+https://github.com/Aagam-Bothara/polyserve.git   # not on PyPI yet
pip install "vllm==0.29.0"     # driver 580+; older drivers: "vllm==0.11.0" "transformers>=4.56,<5"
polyserve serve Qwen/Qwen2.5-3B-Instruct --workload chat
curl localhost:8000/v1/chat/completions -H 'content-type: application/json' \
  -d '{"model":"Qwen/Qwen2.5-3B-Instruct","messages":[{"role":"user","content":"hi"}]}'

The first launch calibrates and caches the result per machine, model, objective and workload; later launches serve at once. To tune for your own traffic, pass a sample of it: --workload-file prompts.jsonl, one prompt per line. Optional: pip install arctic-inference==0.1.1 adds suffix decoding; SGLang can live in its own environment (set SGLANG_PYTHON to its python); llama.cpp needs llama-server built with CUDA, on PATH or in LLAMA_SERVER.

With Docker (built on the official vLLM image):

docker build -t polyserve .
docker run --gpus all --ipc=host -p 8000:8000 -v ~/.cache/huggingface:/root/.cache/huggingface \
  -v ~/.polyserve:/root/.polyserve polyserve serve Qwen/Qwen2.5-3B-Instruct

Supported hardware

Linux, Python 3.10–3.13. NVIDIA GPUs of compute capability 7.5 or newer run vLLM, SGLang and llama.cpp (measured on an A40, A100, H100 NVL, L4 and RTX 4090); older NVIDIA GPUs and x86 CPUs run llama.cpp. vLLM-CPU and pre-Turing GPUs have never been benchmarked (details).

Learn more

  • docs/benchmarks.md: every result, at a glance and in full, with methods, ablations, quality, limits and what is still unmeasured.
  • docs/usage.md: how calibration works, workloads, objectives, every search option and the CLI.
  • docs/writeup.md: the design of the memory planner, calibration and the predictor, what the evidence does and does not support, and the roadmap.
  • benchmarks/strategies/SUMMARY.md: every table, regenerated from the raw JSON.
  • CONTRIBUTING.md: development setup, tests and adding a backend.

MIT licensed.

Metadata

Release files for polyserve 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polyserve 0.1.0
File Size Uploaded Provenance Actions
polyserve-0.1.0.tar.gz 214.4 kB With provenance Details for polyserve-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polyserve 0.1.0
File Interpreter ABI Platform Actions
polyserve-0.1.0-py3-none-any.whl Python 3 none any Details for polyserve-0.1.0-py3-none-any.whl

Total release size: 376.0 kB

Release files / polyserve-0.1.0.tar.gz

Download URL polyserve-0.1.0.tar.gz
Size 214.4 kB
Tags Source
SHA-256 checksum
How to use checksums
406c2e79c93e136578b525adf363ec7fd55c79ce409d3df551223e28be154422
BLAKE2b-256 checksum
How to use checksums
7a95d50ae6a8de60c9a3f5ca73dfa956c0bac1a9eb9fb7025aeae7e5e775c87d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / polyserve-0.1.0-py3-none-any.whl

Download URL polyserve-0.1.0-py3-none-any.whl
Size 161.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2e3b5f5a557b2b8f2459be0cddffde73e0e2ba62e43868eb3d758746df7c64e
BLAKE2b-256 checksum
How to use checksums
aaf56c062c0a65c0ad31f4978a8c626d90bfbe72ec11e430393eb164f4ca9096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Security for polyserve 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for polyserve-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page