SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.01685 · 2026

Semantic-aware Wasserstein Policy Regularization for Large Language Model Alignment

Heesun Bae, Byeonghu Na, Il-Chul Moon, Yeongmin Kim, Hyungho Na, Mina Kang, Suhyeon Jo

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 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/2602.01685.json · badge: /api/ran/2602.01685.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
aailab-kaist/WPR canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
gather_log_probs Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/applications/DeepSpeed-Chat/dschat/rlhf/ppo_wpr_trainer.py
code served (permissive licence) · get_code("fc034842e7b01a89")
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 (2,) 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for testing
# logits: shape (batch_size, num_classes) - 2 samples, 4 classes
logits = torch.randn(2, 4)

# labels: shape (batch_size,) - 2 labels with values in [0, 3]
labels = torch.tensor([0, 2])

# get_all parameter - boolean flag (though not used in the function body)
get_all = False

ARGS = {
    "logits": logits,
    "labels": labels,
    "get_all": get_all,
}
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 (2,) — shape (2,) 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
generate_response Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/inference/inference_apps.py
code served (permissive licence) · get_code("d94756f73698ae1a")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# Build a minimal model that supports .generate() method
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, max_new_tokens, temperature, do_sample, top_k):
        # Return generated token sequences
        # input_ids shape: (batch_size, seq_len)
        batch_size = input_ids.size(0)
        seq_len = input_ids.size(1)
        new_tokens = max_new_tokens
        # Generate output with additional tokens
        generated = torch.cat([
            input_ids,
            torch.randint(0, 100, (batch_size, new_tokens))
        ], dim=1)
        return generated

# Build a minimal tokenizer with decode method
class MinimalTokenizer:
    def decode(self, token_ids, skip_special_tokens=False):
        # Convert token ids to a string representation
        if isinstance(token_ids, torch.Tensor):
            token_ids = token_ids.tolist()
        return " ".join(str(t) for t in token_ids)

# Construct the arguments
model = MinimalModel()
tokenizer = MinimalTokenizer()
temperature = 0.7
inputs = {
    'input_ids': torch.randint(0, 100, (2, 4))  # batch_size=2, seq_len=4
}

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'temperature': temperature,
    'inputs': inputs
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
generate_response Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/inference/inference_with_rewards.py
code served (permissive licence) · get_code("6b6296292665f55a")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# Build a minimal model that supports .generate() method
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, temperature, do_sample, max_new_tokens, **kwargs):
        # Generate dummy output tokens
        batch_size = input_ids.size(0)
        seq_len = input_ids.size(1)
        total_len = seq_len + max_new_tokens
        # Return tensor of generated token ids
        generated = torch.randint(0, 100, (batch_size, total_len))
        return generated

# Build a minimal tokenizer that supports .decode() method
class MinimalTokenizer:
    def decode(self, token_ids, skip_special_tokens=False):
        # Convert token ids to a string representation
        return "generated text sample"

# Create instances
model = MinimalModel()
tokenizer = MinimalTokenizer()

# Create inputs dict with input_ids tensor
# Batch size 2, sequence length 3
inputs = {
    'input_ids': torch.randint(0, 100, (2, 3))
}

temperature = 0.7

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'temperature': temperature,
    'inputs': inputs
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
get_question Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/inference/testing_util.py
code served (permissive licence) · get_code("ed8331339b4de97c")
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 str. 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 os
import tempfile
import shutil

# Create temporary directories with question.txt files
temp_dir1 = tempfile.mkdtemp()
temp_dir2 = tempfile.mkdtemp()

# Write a question file to the first directory
with open(os.path.join(temp_dir1, 'question.txt'), 'w') as f:
    f.write("What is the capital of France?\n")
    f.write("Is it Paris?\n")

# Second directory has no question.txt (will test the else branch)
# (no file written)

problem_list = [temp_dir1, temp_dir2]

ARGS = {
    'problem_list': problem_list,
    'prob_index': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_solutions Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/inference/testing_util.py
code served (permissive licence) · get_code("0c83bb0f43b8dc57")
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 dict. 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 json
import os
import tempfile
import shutil

# Create a temporary directory structure with a solutions.json file
temp_dir = tempfile.mkdtemp()
problem_dir = os.path.join(temp_dir, "problem_0")
os.makedirs(problem_dir, exist_ok=True)

# Create a solutions.json file
solutions_data = {
    "solution_1": {"code": "print('hello')", "score": 0.95},
    "solution_2": {"code": "print('world')", "score": 0.87}
}

solutions_file = os.path.join(problem_dir, "solutions.json")
with open(solutions_file, 'w') as f:
    json.dump(solutions_data, f)

# Create problem_list with the temporary directory
problem_list = [problem_dir]
prob_index = 0

ARGS = {
    "problem_list": problem_list,
    "prob_index": prob_index
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_valid_problems Ran
ran; our contract draft was wrong, not the code
aailab-kaist/WPR/inference/testing_util.py
code served (permissive licence) · get_code("8bbb265e59e23293")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 os
import json
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create subdirectories and files to match what the function expects
data_subdir = os.path.join(temp_dir, 'data')
os.makedirs(data_subdir, exist_ok=True)

# Create a few problem folders with the expected files
problem_1 = os.path.join(data_subdir, 'problem_1')
os.makedirs(problem_1, exist_ok=True)
with open(os.path.join(problem_1, 'input_output.json'), 'w') as f:
    json.dump({"test": "data"}, f)

problem_2 = os.path.join(data_subdir, 'problem_2')
os.makedirs(problem_2, exist_ok=True)
with open(os.path.join(problem_2, 'sols.json'), 'w') as f:
    json.dump({"solution": "code"}, f)

# Create a problem folder without valid files (should be skipped)
problem_3 = os.path.join(data_subdir, 'problem_3')
os.makedirs(problem_3, exist_ok=True)
with open(os.path.join(problem_3, 'other_file.txt'), 'w') as f:
    f.write("some content")

ARGS = {
    'data_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
log_init Ran
ran, honoured the contract we drafted
aailab-kaist/WPR/applications/DeepSpeed-Chat/dschat/rlhf/rlhf_wpr_engine.py
code served (permissive licence) · get_code("429d42a3bf925da5")
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 float, 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 time
import torch
import torch.nn as nn
import torch.distributed as dist

# Mock distributed.get_rank() to return 0 so the function executes
class MockDistributed:
    @staticmethod
    def get_rank():
        return 0

# Patch torch.distributed.get_rank
torch.distributed.get_rank = MockDistributed.get_rank

ARGS = {
    'model_name': 'ResNet50',
    'stime': 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 float, 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
get_reward_score Not yet run
unverified (harvested, no recorded run)
aailab-kaist/WPR/inference/inference_with_rewards.py
code served (permissive licence) · get_code("8880eb6933481aea")
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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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
log_init 9 other papers
9 dated earlier
2308.02223 (2023-08)
ESRL: Efficient Sampling-based Reinforcement Learning for Sequence Generation
2310.10505 (2023-10)
ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models
2024.naacl-long.326 (2024 (year only))
LSTDial: Enhancing Dialogue Generation via Long-and Short-Term Measurement Feedback
and 6 more not named here
get_solutions 4 other papers
4 dated earlier
2105.09938 (2021-05)
Measuring Coding Challenge Competence With APPS
2107.03374 (2021-07)
Evaluating Large Language Models Trained on Code
2203.08597 (2022-03)
Less is More: Summary of Long Instructions is Better for Program Synthesis
and 1 more not named here
get_valid_problems 4 other papers
4 dated earlier
2105.09938 (2021-05)
Measuring Coding Challenge Competence With APPS
2107.03374 (2021-07)
Evaluating Large Language Models Trained on Code
2203.08597 (2022-03)
Less is More: Summary of Long Instructions is Better for Program Synthesis
and 1 more not named here
get_question 3 other papers
3 dated earlier
2105.09938 (2021-05)
Measuring Coding Challenge Competence With APPS
2107.03374 (2021-07)
Evaluating Large Language Models Trained on Code
2403.04706 (2024-03)
Common 7B Language Models Already Possess Strong Math Capabilities

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

Large language models (LLMs) are commonly aligned with human preferences using reinforcement learning from human feedback (RLHF). In this method, LLM policies are generally optimized through reward maximization with Kullback-Leibler (KL) divergence regularization of the reference policy. However, KL and its f -divergence variants only compare token probabilities at identical indices, failing to capture semantic similarity. We propose Wasserstein Policy Regularization (WPR), a semantic-aware regularization for the RLHF framework based on the entropy-regularized Wasserstein distance, which incorporates the geometry of the token space. The dual formulation of the distance expresses the regularization as penalty terms applied to the reward via optimal dual variables, which yield a tractable objective compatible with standard RL algorithms. Empirically, our method outperforms KL-and f -divergence-based baselines, demonstrating the benefits of semantic-aware policy distances for alignment. Our code is available at https://github.com/aailab-kaist/WPR.

For agents

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

get_harvested_code_for_paper("2602.01685")
get_code_for_paper("2602.01685")
have("2602.01685")

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

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

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

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

Connect an agent — have() is free.