Separate model preference from response-length bias in pairwise judge votes. For comparison n, an and bn are model IDs, Δn is response A's length minus response B's length, and yn is one for an A win, zero for a B win or one half for a tie. With model utilities ui and length coefficient β, predict:
pn=σ(uan−ubn+βΔn).Here, σ is the logistic sigmoid and pn the A-win probability. For M comparisons, fit the mean binary cross-entropy:
L=−M1n∑[ynlogpn+(1−yn)log(1−pn)].Log is the natural logarithm. Initialize utilities and the coefficient to zero. Perform exactly steps full-batch gradient-descent updates with the supplied learning rate, updating both from the same pre-update values. Center all utilities after each update. With no comparisons, the parameters stay zero.
Evaluate the fitted model at zero length difference:
pn(0)=σ(uan−ubn).A model's win rate averages pn(0) over its A appearances and 1−pn(0) over its B appearances; an unseen model receives 0.5.
Return a Python dictionary with length_coefficient as a Python float, debiased_probabilities as a float64 PyTorch tensor of shape (M,) in comparison order, and model_win_rates as a float64 PyTorch tensor of shape (num_models,) in model-index order. Both tensors use the outcomes device.
Input: num_models = 2, model_a = [0,1,0,1], model_b = [1,0,1,0], length_differences = [2,2,-2,-2], outcomes = [1,1,0,0], steps = 20, learning_rate = 0.1
Output: {"length_coefficient":0.994088,"debiased_probabilities":[0.5,0.5,0.5,0.5],"model_win_rates":[0.5,0.5]}
Explanation: Model identity is balanced across longer and shorter responses, so the fitted preference is assigned to length while zero-length probabilities stay neutral.
Input: num_models = 2, model_a = [0,1], model_b = [1,0], length_differences = [0,0], outcomes = [0.5,0.5], steps = 10, learning_rate = 0.1
Output: {"length_coefficient":0,"debiased_probabilities":[0.5,0.5],"model_win_rates":[0.5,0.5]}
Input: num_models = 3, model_a = [0], model_b = [1], length_differences = [0], outcomes = [1], steps = 10, learning_rate = 0.1
Output: {"length_coefficient":0,"debiased_probabilities":[0.691512],"model_win_rates":[0.691512,0.308488,0.5]}
torch.sigmoid evaluates logistic probabilities elementwise.
Tensor.index_add_ accumulates values for repeated model IDs.
torch.bincount counts appearances of nonnegative integer IDs.
Accepts: number
Accepts: array
Accepts: array
Accepts: array
Accepts: array
Accepts: number
Accepts: number
Separate model preference from response-length bias in pairwise judge votes. For comparison n, an and bn are model IDs, Δn is response A's length minus response B's length, and yn is one for an A win, zero for a B win or one half for a tie. With model utilities ui and length coefficient β, predict:
pn=σ(uan−ubn+βΔn).Here, σ is the logistic sigmoid and pn the A-win probability. For M comparisons, fit the mean binary cross-entropy:
L=−M1n∑[ynlogpn+(1−yn)log(1−pn)].Log is the natural logarithm. Initialize utilities and the coefficient to zero. Perform exactly steps full-batch gradient-descent updates with the supplied learning rate, updating both from the same pre-update values. Center all utilities after each update. With no comparisons, the parameters stay zero.
Evaluate the fitted model at zero length difference:
pn(0)=σ(uan−ubn).A model's win rate averages pn(0) over its A appearances and 1−pn(0) over its B appearances; an unseen model receives 0.5.
Return a Python dictionary with length_coefficient as a Python float, debiased_probabilities as a float64 PyTorch tensor of shape (M,) in comparison order, and model_win_rates as a float64 PyTorch tensor of shape (num_models,) in model-index order. Both tensors use the outcomes device.
Input: num_models = 2, model_a = [0,1,0,1], model_b = [1,0,1,0], length_differences = [2,2,-2,-2], outcomes = [1,1,0,0], steps = 20, learning_rate = 0.1
Output: {"length_coefficient":0.994088,"debiased_probabilities":[0.5,0.5,0.5,0.5],"model_win_rates":[0.5,0.5]}
Explanation: Model identity is balanced across longer and shorter responses, so the fitted preference is assigned to length while zero-length probabilities stay neutral.
Input: num_models = 2, model_a = [0,1], model_b = [1,0], length_differences = [0,0], outcomes = [0.5,0.5], steps = 10, learning_rate = 0.1
Output: {"length_coefficient":0,"debiased_probabilities":[0.5,0.5],"model_win_rates":[0.5,0.5]}
Input: num_models = 3, model_a = [0], model_b = [1], length_differences = [0], outcomes = [1], steps = 10, learning_rate = 0.1
Output: {"length_coefficient":0,"debiased_probabilities":[0.691512],"model_win_rates":[0.691512,0.308488,0.5]}
torch.sigmoid evaluates logistic probabilities elementwise.
Tensor.index_add_ accumulates values for repeated model IDs.
torch.bincount counts appearances of nonnegative integer IDs.
Accepts: number
Accepts: array
Accepts: array
Accepts: array
Accepts: array
Accepts: number
Accepts: number