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.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 cre-router 0.6.0
File Size Uploaded
cre_router-0.6.0.tar.gz 152.6 kB Details

Built distribution (wheel)

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

Total release size: 252.8 kB

Release files / cre_router-0.6.0.tar.gz

Download URL cre_router-0.6.0.tar.gz
Size 152.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6eaecf4c3a7f0e8cf162b8a18ec6dfa2f9aa3c223063650431075a54fa6a5c3b
BLAKE2b-256 checksum
How to use checksums
87da550c549e8a145214543acfe079f713fa6fa90c5423927dbe9cac39826302
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 5, 2026.

Transparency log

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

Download URL cre_router-0.6.0-py3-none-any.whl
Size 100.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c31f2de05e10fcebc808cd76bd4361573173abf219d0fec08a11df7a8eaec3bc
BLAKE2b-256 checksum
How to use checksums
c40e65585ed6148a8a7057655b2910934c135262357de6f1c8b61e34d49d77d2
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 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.2

2 release files

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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