Is Density vs. Feature Coverage That Different?
Coverage is a fundamental concept in offline RL and measures how data distribution contains information about another policy. The most basic form of coverage is measured by the magnitude of density ratios, but it is well known that this can be relaxed to feature coverage with linear reward/value functions. Having a lenient definition of coverage can be beneficial in policy evaluation and learning: for evaluation, a target policy may be poorly covered by data in terms of density ratio but well covered in feature, and whether the analysis takes advantage of the latter will determine whether a guarantee can be established. For policy learning, pessimistic approaches allow us to compete with the best covered policy, and a lenient notion of coverage (such as feature coverage) effectively searches over a significantly larger space of policies.
So for a long time, my understanding is that feature coverage is a significant improvement and generally “black-and-white” different from density coverage, until I went down a rabbit hole recently that shook my belief: in the policy-learning example below, whenever a policy has good feature coverage, an equally performant policy can be found (up to “minor” issues) that has good density coverage.
… wait what?
Setup and Background
For simplicity consider linear bandits (spoiler: keep this in mind). There is an action space . Upon taking action , the reward is with zero-mean bounded noise . A policy is simply a distribution over . Suppose our data is sampled from policy . Let and .
For another policy under consideration, , the data’s feature coverage over is
This quantity shows up if we fit the linear reward model (let be the learned coefficient) from data (sampled from ), and then use it to predict the expected reward of as . The guarantee looks like
For policy learning, by adding constraints or regularization based on , we can learn a policy that competes with the best policy with low feature coverage.
The Example
And here comes the example: consider a policy with small . We will construct a different policy that has good density coverage from (with some caveats). The construction is pretty straightforward: let be
The caveat is that may not be a valid distribution due to potentially negative weights and normalization issues, which we will discuss shortly. If we ignore these issues, we can verify that
and the size of the density ratio measured in is:
So produces exactly the same mean vector as —thus and have equal expected reward—and the density coverage of is exactly equal to the feature coverage of .
Addressing the Caveats
For me the above construction already suffices: I have the impression that there should be cases where should be impossible to reproduce however we reweight , even if we allow negative and unnormalized weights (turns out I am right! see the next section), which is why I described the caveats as “minor” at the beginning. That said, there caveats can be serious out of the scope of this post, and ChatGPT (ahem) provides some interesting ideas to address it. (This part is orthogonal to the main point of the post, so feel free to skip!)
The negative weights are harder to address, as truncation can introduce errors in the mean vector. The normalization issue has an interesting solution: we may use a “difference” variant of feature coverage, defined as
where is the covariance matrix instead of second moment. One can control by as long as , and obtain guarantees involving by centering around and around before doing regression. Then, a weight that always normalizes is (it may still suffer from negativity issues):
where and .
Reconciling the Dilemma
We have two contradicting claims:
-
Sometimes can never be reproduced by reweighting , even with negative and unnormalized weights.
-
can always be reproduced by the weights given above.
What gives?
The crux is in the simplified setting of linear bandits we adopted at the beginning: our analysis is technically correct, but Claim #2 only holds in linear bandits when there is no context, whereas Claim #1 is true in contextual bandits and MDPs, so there is no contradiction. For readers familiar with MDPs, the crucial observation that resolves the dilemma is that an arbitrary reweighting of data distribution is generally illegal, as any distribution that can be realized as the occupancy of a policy must respect the transition dynamics.
In fact, the mechanism that invalidates arbitrary reweighting in MDPs is already present in the simpler model of contextual bandits, where a classic example will make it instantly clear what’s going on: consider a contextual bandit (let’s say context is , action , linear feature ) where behavior policy is deterministic. If context has enough variations, it is still possible that is full-rank, which implies feature coverage over all policies. However, clearly provides no density coverage over any policy other than itself. If we construct the weight from the earlier analysis, it corresponds to altering the context distribution, which is not allowed.1
So that’s it! I guess the lesson is that contextless and contextual settings can sometimes be very different. When thinking about RL in LLMs, I frequently simplify the problem to ignore prompt when brainstorming, assuming that the contextual case will be similar. This is not the first time I run into problems with such simplifications—I once asked in a talk why pass@k rate is not directly determined by pass@1 via order statistics, only to realize later that this is not true due to heterogeneity of performance across prompts.
Footnote Remarks
-
In the scenario of LLMs, one may wonder if this alludes to something algorithmically interesting about reweighting prompts. I think this is probably a dead end. Imagine a contrived setting where is one dimensional that simply indicates whether the response is correct. Then, the reweighting given by the earlier analysis likely just upweights those easy problems that behavior policy already gets right to superficially match the accuracy of a better policy. ↩