Goodhart’s law famously says: “When a measure becomes a target, it ceases to be a good measure.” Although originally from economics, it’s something we have to grapple with at OpenAI when figuring out how to optimize objectives that are difficult or costly to measure. It’s often necessary to introduce some proxy objective that’s easier or cheaper to measure, but when we do this, we need to be careful not to optimize it too much.
For example, as part of our work to align models like GPT-3 with human intent and values, we would like to optimize things like “How helpful is this response?”, or “How factually accurate is this claim?”. These are complex objectives that require humans to carefully check things over. For this reason, we train a model to predict these human preferences, known as a reward model, and use the reward model’s predictions as a proxy objective. But it’s important to keep track of how well the true objective is being optimized.
In this post we’ll look at some of the mathematics behind how we do this. We’ll focus on a setting that is particularly clean to analyze, in which we have access to the true objective. In practice, even human preferences can fail to measure what we really care about, but we’re setting that issue aside in this post.
There are many ways in which one could optimize the proxy objective, but perhaps the simplest is best-of- sampling, also known as rejection sampling or reranking. We simply sample n times and take the one that scores the highest according to the proxy objective.
Although this method is very simple, it can actually be competitive with more advanced techniques such as reinforcement learning, albeit at the cost of more inference-time compute. For example, in WebGPT, our best-of-64 model outperformed our reinforcement learning model, perhaps in part because the best-of-64 model got to browse many more websites. Even applying best-of-4 provided a significant boost to human preferences.
In addition, best-of- sampling has reliable performance and is straightforward to analyze mathematically, making it well-suited to empirical studies of Goodhart’s law and related phenomena.
The mathematics of best-of-n sampling
Let’s study best-of- sampling more formally. Suppose we have some sample space (such as the set of possible question-answer pairs), some probability distribution over , a true objective (or “reward”) , and a proxy objective . Let’s say that we somehow optimize and thereby obtain some new distribution . Then:
- The expectation measures how well we have optimized the true objective.
- The KL divergence measures how much optimization we have done. For example, if is obtained by taking the first sample from that lies in some subset , then this KL divergence is just the negative log probability that a sample from lies in .
It turns out that in the case of best-of- sampling, both of these quantities can be estimated efficiently using samples from .
Let’s look at the expectation first. The naive approach is to use a Monte Carlo estimator: run best-of- sampling many times, measure the true objective on those samples, and average the results. However, there is a better estimator. If we have samples from overall, then we can simultaneously consider every possible subset of these samples of size , where is the rank of the sample under the proxy objective, from (worst) up to (best).A
As well as using samples more efficiently, this also allows us to reuse samples for different values of (i.e., as long as has no point masses). One might naively guess that the answer is , since best-of- is doing something like taking the top of the distribution, and this is roughly correct: the exact answer is . B
Together, these estimators allow us to easily analyze how the true objective varies with the amount of optimization applied to the proxy objective.
Here’s a real-life example from WebGPT:
Best-of- performance for WebGPT 175B
Going beyond best-of-n sampling
The main limitation of best-of- sampling is that the KL divergence grows logarithmically with , so it is only suitable for applying a small amount of optimization.
To apply more optimization, we typically use reinforcement learning. In the settings we’ve studied so far, such as summarization, we’ve typically been able to reach a KL of around 10 nats using reinforcement learning before the true objective starts to decrease due to Goodhart’s law. We’d have to take n to be around 60,000 to reach this KL using best-of-, and we hope to be able to reach much larger KLs than this with improvements to our reward modeling and reinforcement learning practices.
However, not all nats are equal. Empirically, for small KL budgets, best-of- is the “brute force” approach, making it more information-theoretically efficient than reinforcement learning, but less computationally efficient at large KLs.C