libem
libem copied to clipboard
feat: cascade feature
What this PR does / why we need it:
This PR introduces the cascade functionality to Libem, enabling the system to dynamically adjust model usage based on confidence scores. This aims to optimize cost and throughput while maintaining the accuracy of GPT-4o.
Key changes include:
-
vectorize,prematch, andmatchunder Libem/cascade.- Add reset functionality to clear the client before
prematchandmatchstages.
- Add reset functionality to clear the client before
- Under
Libem/examples/cascade:-
util.py: Contains benchmark and plot functions to measure cost and accuracy. -
online.py: Provides a working example of the cascade functionality. -
bench.py: Performs benchmarking and generates graphs to visualize cost and accuracy.
-
Which issue(s) this PR addresses (if any):
Addresses # NA
Special notes for your reviewer:
I am only adding the reset as part of the cascade since it is the most reasonable place I can think of for now. Would love to improve on this later if there is a better place to do reset.
Does this PR introduce a user-facing change?
NONE
Nice. Will review this coming week.