You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -102,8 +102,40 @@ The system combines three key components:
102
102
- safetensors ≥ 0.3.1
103
103
- faiss-cpu ≥ 1.7.4 (or faiss-gpu for GPU support)
104
104
105
+
## Benefits of Adaptive Classification in LLM Routing
106
+
107
+
We evaluate the effectiveness of adaptive classification in optimizing LLM routing decisions. Using the arena-hard-auto-v0.1 dataset with 500 queries, we compared routing performance with and without adaptation while maintaining consistent overall success rates.
108
+
109
+
### Key Results
110
+
111
+
| Metric | Without Adaptation | With Adaptation | Impact |
*Cost savings calculation assumes high-cost model is 2x the cost of low-cost model
121
+
122
+
### Analysis
123
+
124
+
The results highlight several key benefits of adaptive classification:
125
+
126
+
1.**Improved Cost Efficiency**: While maintaining the same overall success rate (22%), the adaptive classifier achieved 32.40% cost savings compared to 25.60% without adaptation - a relative improvement of 1.27x in cost efficiency.
127
+
128
+
2.**Better Resource Utilization**: The adaptive system routed more queries to the low-cost model (402 vs 387) while reducing high-cost model usage (98 vs 113), demonstrating better resource allocation.
129
+
130
+
3.**Learning from Experience**: Through adaptation, the system improved the success rate of low-model routes from 16.54% to 20.15% (1.22x increase), showing effective learning from successful cases.
131
+
132
+
4.**ROI on Adaptation**: The system adapted to 110 new examples during evaluation, leading to a 6.80% improvement in cost savings while maintaining quality - demonstrating significant return on the adaptation investment.
133
+
134
+
This real-world evaluation demonstrates that adaptive classification can significantly improve cost efficiency in LLM routing without compromising overall performance.
135
+
105
136
## References
106
137
138
+
-[RouteLLM: Learning to Route LLMs with Preference Data](https://arxiv.org/abs/2406.18665)
returnFalse, 0.0, {"error": "Failed to get initial response"}
140
+
141
+
# Generate alternate query
142
+
inverse_prompt=f"""Given this query and response pair, generate a new query that would lead to a similar response. Focus on the key aspects that would generate equivalent content:
143
+
144
+
Original Query: {query}
145
+
Response: {response_1}
146
+
147
+
Generate a new query that would elicit a similar response:"""
148
+
149
+
alternate_query=get_llm_response([
150
+
{"role": "user", "content": inverse_prompt}
151
+
], model, config)
152
+
153
+
ifnotalternate_query:
154
+
returnFalse, 0.0, {"error": "Failed to generate alternate query"}
155
+
156
+
# Get response for alternate query
157
+
response_2=get_llm_response([
158
+
{"role": "user", "content": alternate_query}
159
+
], model, config)
160
+
161
+
ifnotresponse_2:
162
+
returnFalse, 0.0, {"error": "Failed to get second response"}
0 commit comments