Skip to content

tinker_cookbook.preference.PreferenceModelFromChatRenderer

class tinker_cookbook.preference.PreferenceModelFromChatRenderer(PreferenceModel)

A PreferenceModel that uses a chat renderer and Tinker sampling client.

Parameters:

  • convo_renderer – Renderer for formatting comparisons as chat prompts.
  • sampling_client – Tinker sampling client for generating preference labels.

__call__(comparison)

Score a comparison by sampling a preference token from the model.

Parameters:

  • comparison (Comparison) – The comparison to evaluate.

Returns: float: -1.0 if A is preferred, 1.0 if B is preferred, 0.0 for a tie or an unrecognized output.