Skip to main content

Cluster, Route, Escalate: a cascaded framework for cost-aware LLM serving

Project description

CRE-Router

Implementation of the paper Cluster, Route, Escalate: Cascaded Framework for Cost-Aware LLM Serving.

Production LLM serving trades accuracy against cost. CRE-Router routes each query to the most cost-effective model in a pool, then escalates low-quality outputs to a stronger model:

  • Stage 1 (clustering-based routing). Queries are embedded and clustered offline; each cluster is routed to the model that minimizes a cost-adjusted error score (Error + lambda * Cost), with lambda tuned once to satisfy a latency (TPOT) budget.
  • Stage 2 (quality-estimation cascade). A lightweight ModernBERT classifier inspects each efficient-model output and escalates low-quality answers up an ordered ladder of stronger models.

Both stages train only on task-correctness labels obtainable from standard benchmark evaluation; no extra annotation is required.

Install

pip install "cre-router[full]"

full installs the whole pipeline on one machine. Narrower installs are available through the serve, qe, and eval extras; see the installation guide.

Usage

The workflow is driven by the cre CLI, one stage per step:

cre clustercre evaluatecre fitcre qe-traincre serve

Run cre <stage> --help for options. Runnable end-to-end quickstarts (a no-GPU routing-table demo and a full serving walkthrough) are in the README.

Links

Apache-2.0 licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cre_router-0.1.0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cre_router-0.1.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file cre_router-0.1.0.tar.gz.

File metadata

  • Download URL: cre_router-0.1.0.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for cre_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6252a1adecf3b595232b84212a9d29b33ed2a6a29484adccf1ca15ecb18dab8
MD5 129402942e4713e5a5d75a4bafb9477d
BLAKE2b-256 6c52c0c13241aafc892160d12e2d4c3dee5609b5f112e2d13941e2868131e658

See more details on using hashes here.

File details

Details for the file cre_router-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cre_router-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for cre_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 239ed78828f04c9a197e43a08c7f6bd728ee3abb48f0d41fe23a44454c3e72fe
MD5 339f3a5340b10980b5cd1f72ed579aeb
BLAKE2b-256 026b0a192699bc29ccb6fbc93af62690197089c7175314b1d9e8c68bc2a1f4ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page