Skip to main content
When you score models in a Weave evaluation, absolute value metrics (for example, 9/10 for Model A and 8/10 for Model B) are typically harder to assign than relative ones (for example, Model A performs better than Model B). Pairwise evaluation lets you compare the outputs of two models by ranking them relative to each other. This approach is useful when you want to determine which model performs better for subjective tasks such as text generation, summarization, or question answering. With pairwise evaluation, you get a relative preference ranking that shows which model is best for specific inputs.
This approach is a workaround and might change in future releases. A more robust API to support pairwise evaluations is planned.
The following code sample shows how to implement a pairwise evaluation in Weave by creating a class-based scorer called PreferenceScorer. The PreferenceScorer compares two models, ModelA and ModelB, and returns a relative score of the model outputs based on explicit hints in the input text.
After you run this evaluation, you have a relative preference ranking between ModelA and ModelB based on the PreferenceScorer results.
Evaluation