Our Insight: Two Sources of Suboptimality
Let \(r\) and \(\hat{r}\) be the original and reconstructed reward functions, and \(\pi_r\) and
\(\pi_{\hat{r}}\) their optimal policies. The suboptimality gap is
\(\mathrm{SubOpt}(r, \hat{r}) := V^{\pi_r}_r - V^{\pi_{\hat{r}}}_r\).
Theorem (Suboptimality gap)
Define the policy-averaged successor measure
\(\bar{M}^{\pi}(s^+ \mid s) := \mathbb{E}_{a \sim \pi(\cdot \mid s)}[M^{\pi}(s^+ \mid s,a)]\),
the successor-measure residual
\(\Delta M := \bar{M}^{\pi_{\hat{r}}} - \bar{M}^{\pi_r}\),
and the reward residual \(\Delta r := \hat{r} - r\). Then
\[
\mathrm{SubOpt}(r, \hat{r}) \;\le\; \lVert \Delta M \rVert_1 \cdot \lVert \Delta r \rVert_\infty
\]
The bound vanishes under either of two conditions: the reconstructed reward matches the
original (\(\Delta r = 0\)), or the retrieved policy's successor measure matches the optimal
policy's (\(\Delta M = 0\)) even when rewards are wrong. OLS pursues only the first
condition. Because exact reconstruction is impossible in practice, the residual rewards
change the policy's behavior and enlarge \(\Delta M\). BLS seeks a task vector that minimizes both
residuals jointly.
The optimal policy's successor measure is unknown at test time, so we rely on two inductive
biases: (1) optimal policies visit high-reward states more often than low-reward states, and
(2) reward functions sharing similar reward rankings tend to induce similar successor measures.
Preserving high-value rewards and the relative ranking of rewards is therefore a practical
surrogate for reducing \(\Delta M\).
Soft-margin contrastive loss
We split states into high-reward states \(G\) and low-reward states \(N\) with a threshold
\(\tau\), and enlarge the margins of reconstructed rewards between the two sets:
\[
\mathcal{L}_{sm}(z) = \log \sum_{s \in G} \exp\!\big(-\phi(s)^\top z\big)
+ \log \sum_{s \in N} \exp\!\big(\phi(s)^\top z\big)
\]
The first term pushes up the lowest reconstructed rewards in \(G\); the second drives down the
highest ones in \(N\). Unlike a hard-margin loss that only looks at a single worst pair, the
log-sum-exp form accounts for all violating margins and is smooth for gradient descent.
Trust-region loss
The soft-margin loss alone does not control reconstruction error, so we regularize \(z\) to stay
close to the OLS solution, in reward space rather than parameter space:
\[
\mathcal{R}(z) = \mathbb{E}_s\!\left[\big\lVert \phi(s)^\top z - \phi(s)^\top \hat{z}_{\mathrm{OLS}} \big\rVert_2^2\right],
\qquad
\mathcal{L}(z) = \mathcal{L}_{sm}(z) + \lambda\, \mathcal{R}(z)
\]
The coefficient \(\lambda\) correlates with reward type: sparse rewards prefer a small
\(\lambda\) (emphasizing margins), dense rewards prefer a large one (staying near OLS).
Algorithm: BLS
- Split states: \(G \gets \{s : r(s) \ge \tau\}\), \(N \gets \{s : r(s) < \tau\}\).
- Initialize \(z \gets \hat{z}_{\mathrm{OLS}}\).
- For \(t = 1, \ldots, T\): take a gradient step on \(\mathcal{L}_{sm}(z) + \lambda \mathcal{R}(z)\), then normalize \(z \gets z / \lVert z \rVert_2\).
- Return \(z\) and retrieve the zero-shot policy \(\pi_z\).
BLS runs once before executing a task. On an RTX 4090, 500 optimization steps take under 1 second
on OGBench and about 1.4 seconds on HumEnv, so the overhead relative to OLS is negligible. BLS is
architecture-agnostic: it only changes how the task vector is inferred and can be plugged into any
BFM, with either OLS or another inference method as the anchor.