SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.18792 · ICLR · 2024

Kernel Metric Learning for In-Sample Off-Policy Evaluation of Deterministic RL Policies

U Berkeley, Kaist, Kee-Eung Kim, Yung-Kyun Noh, Jongmin Lee, Haanvid Lee, Tri Guntara

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.18792.json · badge: /api/ran/2405.18792.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
haanvid/kmifqe canonical (classifier label)
classifier basis: classifier_2025
5 ran · 2 no recorded run
copy not recorded community
not in the paper's declared repositories
0 ran · 1 no recorded run
FunctionStatusWhere it lives
Critic Ran
ran on a synthesized input · constructed an object; no result was computed
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("a858007a9d9624d1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Critic: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'state_dim': 4,
    'action_dim': 3,
    'hidden_units': 256,
    'last_layer_activation': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Critic — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Critic output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
KMIFQE Ran
ran on a synthesized input · constructed an object; no result was computed
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("36bb0207b41230a8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, KMIFQE: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import copy
from torch.distributions import Normal
import functorch
from functorch import make_functional_with_buffers, vmap, grad, hessian

torch.manual_seed(0)

class Critic(nn.Module):
    def __init__(self, state_dim, action_dim, hidden_units=256, last_layer_activation=None):
        super(Critic, self).__init__()
        self.l1 = nn.Linear(state_dim + action_dim, hidden_units)
        self.l2 = nn.Linear(hidden_units, hidden_units)
        self.l3 = nn.Linear(hidden_units, 1)
        self.last_layer_activation = last_layer_activation

    def forward(self, state, action):
        q1 = torch.tanh(self.l1(torch.cat([state, action], 1)))
        q1 = torch.tanh(self.l2(q1))
        if self.last_layer_activation == 'exp':
            return torch.exp(self.l3(q1))
        else:
            return self.l3(q1)

ARGS = {
    'state_dim': 4,
    'action_dim': 3,
    'max_action': 1.0,
    'last_layer_activation': None,
    'hidden_units': 64,
    'discount': 0.99,
    'tau': 0.005,
    'clip_behav_den_val_min': 0.0,
    'dim_wise_is_clip': False,
    'critic_target_path': './critic_targets/critic_target',
    'normalized_action_value': False,
    'relax_target_std': 0.0,
    'random': 0.0,
    'behav_bias': 0.0,
    'behav_std': 0.2,
    'clip_val_max': 100000000.0,
    'clip_val_min': 1e-08,
    'batch_size': 2,
    'hessian_batch_size': 2,
    'h_batch_size': 2,
    'reg_multiplier': 0.1,
    'weight_decay': 0.0,
    'max_episode_len': None,
    'n_eval_freq': 1000,
    'env_is_ant': False,
    'device': 'cpu',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
functorch, numpy, torch, wandb — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KMIFQE — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a KMIFQE output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gaussian_kernel Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("375fe0e2f099808a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# u is a 1D tensor used in:
# - len(u.shape) == 1 (assertion check)
# - torch.inner(u, u) (inner product with itself)
# - len(u) (length of the tensor)
# So we need a 1D tensor of some reasonable dimension

u = torch.randn(4)

ARGS = {
    "u": u
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gaussian_kernel_dim_wise Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("2b23095354e40d12")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects a 1D tensor as input
# It computes a Gaussian kernel value element-wise
u = torch.randn(4)

ARGS = {
    'u': u
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_action Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
haanvid/kmifqe/save_replay_buffer.py
code served (permissive licence) · get_code("1426432b272b7c1e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 1, dtype family float, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch
import torch.nn as nn

torch.manual_seed(0)
np.random.seed(0)

# Define a minimal policy class that has select_action method
class MinimalPolicy(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.linear = nn.Linear(state_dim, action_dim)
    
    def select_action(self, state):
        # state is a numpy array, convert to tensor, process, return numpy
        state_tensor = torch.FloatTensor(state).unsqueeze(0)
        action_tensor = self.linear(state_tensor)
        return action_tensor.squeeze(0).detach().numpy()

# Define a minimal environment with action_space.sample()
class MinimalEnv:
    def __init__(self, action_dim, max_action):
        self.action_dim = action_dim
        self.max_action = max_action
        self.action_space = self
    
    def sample(self):
        # Return a random action in the action space
        return np.random.uniform(-self.max_action, self.max_action, size=self.action_dim)

# Create instances
state_dim = 5
action_dim = 3
max_action = 1.0

policy = MinimalPolicy(state_dim, action_dim)
state = np.random.randn(state_dim)
env = MinimalEnv(action_dim, max_action)
random = 0.1
behav_bias = np.zeros(action_dim)
behav_std = 0.1

ARGS = {
    "policy": policy,
    "state": state,
    "env": env,
    "max_action": max_action,
    "action_dim": action_dim,
    "random": random,
    "behav_bias": behav_bias,
    "behav_std": behav_std
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (3,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
boolean Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from ZhengYinan-AIR/OMIGA
pointer only; the stored copy get_code serves, from ZhengYinan-AIR/OMIGA, is pointer only (licence: NONE) · get_code("3b81875ee24223a6")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_critic_grad_param Not yet run
unverified (harvested, no recorded run)
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("7577a78af6c2977c")
How it ran

no invocation recorded.

get_critic_hess_action Not yet run
unverified (harvested, no recorded run)
haanvid/kmifqe/KMIFQE.py
code served (permissive licence) · get_code("a3cf70458ecdb484")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
boolean 5 other papers
3 dated earlier, 1 the same month, 1 later
2202.13536 (2022-02)
LobsDICE: Offline Learning from Observation via Stationary Distribution Correction Estimation
2302.01667 (2023-02)
Mind the Gap: Offline Policy Optimization for Imperfect Rewards
2307.11620 (2023-07)
Offline Multi-Agent Reinforcement Learning with Implicit Global-to-Local Value Regularization
and 2 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We consider off-policy evaluation (OPE) of deterministic target policies for reinforcement learning (RL) in environments with continuous action spaces. While it is common to use importance sampling for OPE, it suffers from high variance when the behavior policy deviates significantly from the target policy. In order to address this issue, some recent works on OPE proposed in-sample learning with importance resampling. Yet, these approaches are not applicable to deterministic target policies for continuous action spaces. To address this limitation, we propose to relax the deterministic target policy using a kernel and learn the kernel metrics that minimize the overall mean squared error of the estimated temporal difference update vector of an action value function, where the action value function is used for policy evaluation. We derive the bias and variance of the estimation error due to this relaxation and provide analytic solutions for the optimal kernel metric. In empirical studies using various test domains, we show that the OPE with in-sample learning using the kernel with optimized metric achieves significantly improved accuracy than other baselines.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.18792")
get_code_for_paper("2405.18792")
have("2405.18792")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.18792.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.18792.svg)](https://syntology.ai/paper/2405.18792)

Connect an agent — have() is free.