Skip to content

tinker_cookbook.preference.Comparison

class tinker_cookbook.preference.Comparison()

A pair of completions (A and B) generated from the same prompt conversation.

Used as the basic unit for preference learning: a single prompt with two candidate responses that can be compared by a human or a preference model.

comparison = Comparison(
prompt_conversation=[{"role": "user", "content": "Summarize X"}],
completion_A=[{"role": "assistant", "content": "Summary A..."}],
completion_B=[{"role": "assistant", "content": "Summary B..."}],
)

Fields:

swap()

Return a new Comparison with A and B swapped.

Returns: Comparison – A copy where completion_A and completion_B are exchanged.