Skip to main content

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 or E2EL) budget.
  • Stage 2 (quality-estimation cascade). A lightweight ModernBERT classifier inspects each efficient-model output and escalates low-quality answers to the most accurate model the routing uses. cre fit plans which clusters to gate.

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, eval and data extras; see the installation guide.

Usage

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

cre cluster → cre evaluate → cre fit → cre qe-data → cre qe-train → cre serve

Offline, from saved captures: cre stats → cre fit → cre compose.

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.

Apache-2.0 licensed.

Metadata

Release files for cre-router 0.6.3

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

Source distribution (sdist)

Source distribution for cre-router 0.6.3
File Size Uploaded Provenance Actions
cre_router-0.6.3.tar.gz 160.1 kB With provenance Details for cre_router-0.6.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cre-router 0.6.3
File Interpreter ABI Platform Actions
cre_router-0.6.3-py3-none-any.whl Python 3 none any Details for cre_router-0.6.3-py3-none-any.whl

Total release size: 263.6 kB

Release files / cre_router-0.6.3.tar.gz

Download URL cre_router-0.6.3.tar.gz
Size 160.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4fbf35d9f0c642ad7261353734f28191801b0ac39dfbcfa98addd1c5a642ff43
BLAKE2b-256 checksum
How to use checksums
4c7fbd5d0bca5ba852a56d8a4d4c4a7c3518ee929f1e5527b7766bd903a52c0a
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 Oct 25, 2026.

Transparency log

Release files / cre_router-0.6.3-py3-none-any.whl

Download URL cre_router-0.6.3-py3-none-any.whl
Size 103.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc366c482e4e64dc1213acb4c8dd4c58cccba94b334f01518995486d47d255a5
BLAKE2b-256 checksum
How to use checksums
fe994adc4d5ccbe16147167202d198872a22cd336135de44038017c87e217846
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 Oct 25, 2026.

Transparency log

Security for cre-router 0.6.3

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 cre_router-0.6.3.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 Oct 25, 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.

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