Skip to content

tinker_cookbook.preference.PreferenceModelFromChatRenderer

class tinker_cookbook.preference.PreferenceModelFromChatRenderer(PreferenceModel)

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

Renders a Comparison into a prompt, samples a single token (A, B, or Tie), and maps it to a float score (-1 for A, 1 for B, 0 for Tie).

__call__(comparison)

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

Renders the comparison into a prompt, samples a single token (A, B, or Tie), and maps it to a float.

Parameters:

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