libem icon indicating copy to clipboard operation
libem copied to clipboard

feat: cascade feature

Open Char15Xu opened this issue 1 year ago • 1 comments

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, and match under Libem/cascade.
    • Add reset functionality to clear the client before prematch and match stages.
  • 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

Char15Xu avatar Dec 02 '24 05:12 Char15Xu

Nice. Will review this coming week.

zenodflow avatar Dec 03 '24 19:12 zenodflow