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 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, 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-train → cre qe-cascade → 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.
Links
- Source and documentation: https://github.com/ymoslem/CRE-Router
- Paper: https://arxiv.org/abs/2606.27457
- Reproducing the paper: https://github.com/ymoslem/CRE-Router/blob/main/REPRODUCE.md
Apache-2.0 licensed.
Metadata
Release files for cre-router 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cre_router-0.4.0.tar.gz | 156.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cre_router-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 255.9 kB
Release files / cre_router-0.4.0.tar.gz
| Download URL | cre_router-0.4.0.tar.gz |
|---|---|
| Size | 156.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43c808a1bae934d723a011cff86feafd04763d06bdb62d3402e150c03c6bfdea
|
|
BLAKE2b-256 checksum How to use checksums |
0164203a26197de928c37f07a83acc9bea271db1084a56c6134dece9bfa977f1
|
| 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 28, 2026.
Transparency logRelease files / cre_router-0.4.0-py3-none-any.whl
| Download URL | cre_router-0.4.0-py3-none-any.whl |
|---|---|
| Size | 99.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13a064dfa03f5cfe6d5a18063648f4daf481bebee2fae3b186a2bcbebafdd10e
|
|
BLAKE2b-256 checksum How to use checksums |
d6bae7926489dea6b1f2d0311dcdcdf889d35c2844206b95074b8bf1a2996a67
|
| 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 28, 2026.
Transparency log