Spaces:
Running
Running
docs: expand technical hub with detailed routing policies, evaluation harness guide, and playground features
Browse files- docs/index.html +68 -13
docs/index.html
CHANGED
|
@@ -665,17 +665,23 @@
|
|
| 665 |
<div class="card-grid">
|
| 666 |
<div class="sub-card">
|
| 667 |
<h3>1. Prompt Adaptation</h3>
|
| 668 |
-
<p>
|
| 669 |
</div>
|
| 670 |
<div class="sub-card">
|
| 671 |
-
<h3>2. LLM Approximation (Cache)</h3>
|
| 672 |
-
<p>
|
| 673 |
</div>
|
| 674 |
</div>
|
| 675 |
|
| 676 |
-
<div class="
|
| 677 |
-
<
|
| 678 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 679 |
</div>
|
| 680 |
|
| 681 |
<!-- Live Cascade Simulator Box -->
|
|
@@ -770,13 +776,16 @@
|
|
| 770 |
</div>
|
| 771 |
</div>
|
| 772 |
<div class="sub-card">
|
| 773 |
-
<h3>3.
|
| 774 |
-
<p>InferRoute implements
|
| 775 |
-
<
|
| 776 |
-
<
|
| 777 |
-
<
|
| 778 |
-
<
|
| 779 |
-
|
|
|
|
|
|
|
|
|
|
| 780 |
</div>
|
| 781 |
</div>
|
| 782 |
</div>
|
|
@@ -957,6 +966,30 @@ sequenceDiagram
|
|
| 957 |
</div>
|
| 958 |
</div>
|
| 959 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 960 |
</div>
|
| 961 |
|
| 962 |
<!-- Tab 3: Benchmarks -->
|
|
@@ -1057,6 +1090,28 @@ sequenceDiagram
|
|
| 1057 |
</div>
|
| 1058 |
</div>
|
| 1059 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1060 |
</div>
|
| 1061 |
|
| 1062 |
<!-- Tab 4: Self-Healing -->
|
|
|
|
| 665 |
<div class="card-grid">
|
| 666 |
<div class="sub-card">
|
| 667 |
<h3>1. Prompt Adaptation</h3>
|
| 668 |
+
<p>Prunes long prompt histories or few-shot example prefixes down to at most 1 context example when querying cheap local models (Ollama/vLLM), restoring full complexity only when cascading to commercial endpoints.</p>
|
| 669 |
</div>
|
| 670 |
<div class="sub-card">
|
| 671 |
+
<h3>2. LLM Approximation (Redis Cache)</h3>
|
| 672 |
+
<p>Uses standard Redis completion caches. Matches queries in under 10ms, avoiding upstream model fees completely for exact duplicate concurrent prompts.</p>
|
| 673 |
</div>
|
| 674 |
</div>
|
| 675 |
|
| 676 |
+
<div class="card-grid" style="margin-top: 1.5rem;">
|
| 677 |
+
<div class="sub-card">
|
| 678 |
+
<h3>3. Sequential LLM Cascade</h3>
|
| 679 |
+
<p>Sequentially routes queries through a chain of backends (Ollama โ vLLM โ Gemini โ OpenAI). A Reliability Judge assesses output quality at each tier, escalating to the next tier if the quality score falls below \(\tau\).</p>
|
| 680 |
+
</div>
|
| 681 |
+
<div class="sub-card">
|
| 682 |
+
<h3>4. Streaming Cascade Buffer Heuristics</h3>
|
| 683 |
+
<p>Buffers SSE stream chunks server-side to detect infinite loops or gibberish outputs. Speculatively cancels degraded local streams and escalates to premium cloud nodes mid-stream to avoid client-facing disruptions.</p>
|
| 684 |
+
</div>
|
| 685 |
</div>
|
| 686 |
|
| 687 |
<!-- Live Cascade Simulator Box -->
|
|
|
|
| 776 |
</div>
|
| 777 |
</div>
|
| 778 |
<div class="sub-card">
|
| 779 |
+
<h3>3. Supported Routing Policies</h3>
|
| 780 |
+
<p>InferRoute implements six distinct routing strategies matching the RouterBench & FrugalGPT frameworks:</p>
|
| 781 |
+
<div style="display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-secondary);">
|
| 782 |
+
<div><strong style="color: var(--text-primary);">๐ฒ Zero Router Baseline (zero):</strong> Non-content-aware routing. Randomly routes requests to Cloud vs. Local backends based on a target mixture ratio \(p \in [0, 1]\) to form the baseline cost-quality curve.</div>
|
| 783 |
+
<div><strong style="color: var(--text-primary);">๐ Rule-Based Router (rule):</strong> Content-aware heuristics. Evaluates prompt keywords (e.g., routing math tasks to GPT/Gemini, coding tasks to local vLLM, simple greetings to Ollama).</div>
|
| 784 |
+
<div><strong style="color: var(--text-primary);">๐ง KNN-Based Router (knn):</strong> Jaccard nearest-neighbor lookup on historical runs. Finds the \(K\) most similar prompts, averages their quality, and maximizes the score equation.</div>
|
| 785 |
+
<div><strong style="color: var(--text-primary);">๐ธ๏ธ MLP-Based Router (mlp):</strong> A fast logistic regression classifier extracting features (length, code, math, JSON) to predict model success rates and select the highest-scoring backend.</div>
|
| 786 |
+
<div><strong style="color: var(--text-primary);">๐ฎ Oracle Router (oracle):</strong> Theoretical optimal offline reference that has perfect knowledge of outcomes and chooses the cheapest backend that achieves a quality score \(\ge 0.8\).</div>
|
| 787 |
+
<div><strong style="color: var(--text-primary);">๐ Cascade Router (cascade):</strong> FrugalGPT-style sequential escalation. Triggers cascading hops across model tiers if the reliability judge output score falls below threshold \(\tau\).</div>
|
| 788 |
+
</div>
|
| 789 |
</div>
|
| 790 |
</div>
|
| 791 |
</div>
|
|
|
|
| 966 |
</div>
|
| 967 |
</div>
|
| 968 |
</div>
|
| 969 |
+
|
| 970 |
+
<!-- Playground Control Center Card -->
|
| 971 |
+
<div class="glass-card" style="margin-top: 2rem;">
|
| 972 |
+
<h2>๐จ Observability Control Center & Interactive Playground</h2>
|
| 973 |
+
<p>InferRoute features an interactive client playground dashboard (served at the root <code>/</code> path) allowing developers to monitor and simulate gateway functions in real-time:</p>
|
| 974 |
+
<div class="card-grid" style="margin-top: 1.5rem;">
|
| 975 |
+
<div class="sub-card">
|
| 976 |
+
<h3>1. Live Telemetry Cost Dashboard</h3>
|
| 977 |
+
<p>Displays financial metrics including cumulative API dollars saved, tokens processed, Redis cache hit rates, average Time-to-First-Token (TTFT), and system uptime in real-time.</p>
|
| 978 |
+
</div>
|
| 979 |
+
<div class="sub-card">
|
| 980 |
+
<h3>2. Interceptor Pipeline Visualizer</h3>
|
| 981 |
+
<p>Renders a live vertical step visualizer tracking individual requests. Watch prompts flow through Cache lookup โ Concurrency limit verification โ Primary model execution โ speculative loops cancellation โ Cascade trigger.</p>
|
| 982 |
+
</div>
|
| 983 |
+
<div class="sub-card">
|
| 984 |
+
<h3>3. Wallet & Credit Controller</h3>
|
| 985 |
+
<p>Simulates tenant wallet balances and limits. Allows manual top-up adjustments (e.g., refilling $10.00 trial credits) to inspect rate-limiting triggers and HTTP 402 payment requirements.</p>
|
| 986 |
+
</div>
|
| 987 |
+
<div class="sub-card">
|
| 988 |
+
<h3>4. Chaos Engineering Panel</h3>
|
| 989 |
+
<p>Allows manual injection of failures (latency spikes, HTTP 500 crashes, network dropouts) into specific backend nodes to observe gateway self-healing, automatic failovers, and circuit-breaker status changes in real-time.</p>
|
| 990 |
+
</div>
|
| 991 |
+
</div>
|
| 992 |
+
</div>
|
| 993 |
</div>
|
| 994 |
|
| 995 |
<!-- Tab 3: Benchmarks -->
|
|
|
|
| 1090 |
</div>
|
| 1091 |
</div>
|
| 1092 |
</div>
|
| 1093 |
+
|
| 1094 |
+
<!-- Reproducible Evaluation Sweep Harness -->
|
| 1095 |
+
<div class="glass-card" style="margin-top: 2rem;">
|
| 1096 |
+
<h2>๐ Reproducible Evaluation Sweep Harness</h2>
|
| 1097 |
+
<p>InferRoute provides a built-in evaluation framework to verify the cost-quality trade-offs of all routing algorithms under realistic workload datasets. The system sweeps ratios and willingness-to-pay parameters to export Pareto curves:</p>
|
| 1098 |
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem;">
|
| 1099 |
+
<div class="sub-card" style="background: rgba(0, 0, 0, 0.01);">
|
| 1100 |
+
<h3>1. Run the Evaluation Sweep Orchestrator</h3>
|
| 1101 |
+
<p style="margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-secondary);">This script iterates across dataset prompts, simulating requests against mock or real endpoints and logging cost, latency, quality, and routing outputs:</p>
|
| 1102 |
+
<pre style="background: rgba(0,0,0,0.03); padding: 0.75rem; border-radius: 6px; border: 1px solid var(--border-color); font-family: monospace; color: var(--text-primary); font-size: 0.85rem;">python benchmarks/run_router_eval.py</pre>
|
| 1103 |
+
</div>
|
| 1104 |
+
<div class="sub-card" style="background: rgba(0, 0, 0, 0.01);">
|
| 1105 |
+
<h3>2. Compile Metrics & Generate Pareto Curves</h3>
|
| 1106 |
+
<p style="margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-secondary);">This script reads the raw evaluation outcomes, fits the cost-quality points using the Trapezoidal Rule to calculate Area Under the Curve (AIQ), and exports standard PNG curves:</p>
|
| 1107 |
+
<pre style="background: rgba(0,0,0,0.03); padding: 0.75rem; border-radius: 6px; border: 1px solid var(--border-color); font-family: monospace; color: var(--text-primary); font-size: 0.85rem;">python benchmarks/plot_results.py</pre>
|
| 1108 |
+
</div>
|
| 1109 |
+
<div class="sub-card" style="background: rgba(109, 40, 217, 0.02); border-color: rgba(109, 40, 217, 0.15);">
|
| 1110 |
+
<h3 style="color: var(--accent-violet);">โ๏ธ Sweeping Parameters Summary</h3>
|
| 1111 |
+
<p style="font-size: 0.85rem; color: var(--text-secondary);">The evaluation sweeps the target cloud mixture ratio \(p \in [0, 1]\) for the Zero Router baseline, and sweeping trade-off thresholds \(\lambda \in [0, 1]\) or \(\tau \in [0, 1]\) for KNN, MLP, and Cascade routing algorithms to systematically construct the Pareto frontier.</p>
|
| 1112 |
+
</div>
|
| 1113 |
+
</div>
|
| 1114 |
+
</div>
|
| 1115 |
</div>
|
| 1116 |
|
| 1117 |
<!-- Tab 4: Self-Healing -->
|