SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.02231 · 2023

Fine-Tuning Language Models with Advantage-Induced Policy Alignment

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 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; 0 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2306.02231.json · badge: /api/ran/2306.02231.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
microsoft/rlhf-apa canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
make_head Ran
ran; our contract draft was wrong, not the code
microsoft/rlhf-apa/trlx/utils/modeling.py
code served (permissive licence) · get_code("2ab02dee00149590")
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 Sequential. 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 = {
    "n_embd": 64,
    "out": 10,
    "dtype": torch.float32,
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
parse_result Ran
ran; our contract draft was wrong, not the code
microsoft/rlhf-apa/trlx/ray_tune/wandb.py
code served (permissive licence) · get_code("e2c3cae9e92c72e8")
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 torch
import numpy as np

torch.manual_seed(0)

# Construct a result dict that will be passed to parse_result
# The function filters for numeric values (int, float) that don't start with 'config.'
# and are not in the ray_info list

result = {
    # Numeric values that should be included in output
    'loss': 0.5,
    'accuracy': 0.95,
    'lr': 0.001,
    'grad_norm': 2.3,
    'episode_reward': 100,
    
    # Values that should be filtered out (in ray_info)
    'done': True,
    'time_this_iter_s': 1.2,
    'timesteps_total': 1000,
    'episodes_total': 50,
    'iterations_since_restore': 10,
    'timesteps_since_restore': 900,
    'time_since_restore': 10.5,
    'warmup_time': 2.0,
    'should_checkpoint': False,
    'training_iteration': 5,
    'timestamp': 1234567890,
    'pid': 12345,
    
    # Values that should be filtered out (start with 'config.')
    'config.hidden_size': 256,
    'config.learning_rate': 0.001,
    
    # Non-numeric values that should be filtered out
    'model_name': 'test_model',
    'status': 'running',
}

ARGS = {
    'result': result
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
rhasattr Ran
ran, violated the contract we drafted
microsoft/rlhf-apa/trlx/utils/modeling.py
code served (permissive licence) · get_code("ace162af010af5d8")
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 bool, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a nested object structure to test rhasattr
class LeafModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.value = 42

class MiddleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.leaf = LeafModule()

class RootModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.middle = MiddleModule()
        self.simple_attr = "test"

# Instantiate the root object with nested attributes
root_obj = RootModule()

# Test case 1: Check nested attribute chain
test_attr = "middle.leaf.value"

ARGS = {
    "obj": root_obj,
    "attr": test_attr
}
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 bool, 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
tokenize_dialogue Ran
ran on a synthesized input
microsoft/rlhf-apa/trlx/pipeline/offline_pipeline.py
code served (permissive licence) · get_code("6729b7c27552d487")
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. 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 numpy as np
from transformers import AutoTokenizer

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self, truncation_side='left'):
        self.truncation_side = truncation_side
        self.bos_token = "[BOS]"
        self.bos_token_id = 101
        self.eos_token_id = 102
        self.vocab = {
            "[BOS]": 101,
            "hello": 1000,
            "world": 1001,
            "how": 1002,
            "are": 1003,
            "you": 1004,
        }
        self.vocab_size = 2000
    
    def __call__(self, text, add_special_tokens=False):
        tokens = text.split()
        input_ids = [self.vocab.get(token, 1999) for token in tokens]
        return type('TokenizerOutput', (), {'input_ids': input_ids})()

dialogue_str = "hello world how are you"
dialogue_list = ["hello world", "how are you", "what is this", "it is great"]

tokenizer_left = MockTokenizer(truncation_side='left')
tokenizer_right = MockTokenizer(truncation_side='right')

ARGS = {
    'dialogue': dialogue_str,
    'tokenizer': tokenizer_left,
    'max_length': 2048,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is 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
topk_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
microsoft/rlhf-apa/trlx/models/modeling_ilql.py
pointer only (licence: MIT); the stored copy get_code serves, from katiekang1998/llm_hallucinations, is pointer only (licence: NONE) · get_code("3bfb7deb629cb756")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from katiekang1998/llm_hallucinations, and GitHub detected no licence in that repository when it was checked. 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. A run is recorded.

create_report Not yet run
unverified (harvested, no recorded run)
microsoft/rlhf-apa/trlx/ray_tune/wandb.py
code served (permissive licence) · get_code("c80bffc6c3b486fc")
How it ran

no invocation recorded.

rgetattr Not yet run
unverified (harvested, no recorded run)
microsoft/rlhf-apa/trlx/utils/modeling.py
code served (permissive licence) · get_code("fc2499cfa7162602")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 6 later) and 1 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
make_head 4 other papers
4 later
2309.17179 (2023-09)
Alphazero-like Tree-Search can Guide Large Language Model Decoding and Training
2403.05612 (2024-03)
Unfamiliar Finetuning Examples Control How Language Models Hallucinate
2409.12822 (2024-09)
Language Models Learn to Mislead Humans via RLHF
and 1 more not named here
rgetattr 4 other papers
4 later
2309.17179 (2023-09)
Alphazero-like Tree-Search can Guide Large Language Model Decoding and Training
2403.05612 (2024-03)
Unfamiliar Finetuning Examples Control How Language Models Hallucinate
2409.12822 (2024-09)
Language Models Learn to Mislead Humans via RLHF
and 1 more not named here
rhasattr 4 other papers
4 later
2309.17179 (2023-09)
Alphazero-like Tree-Search can Guide Large Language Model Decoding and Training
2403.05612 (2024-03)
Unfamiliar Finetuning Examples Control How Language Models Hallucinate
2409.12822 (2024-09)
Language Models Learn to Mislead Humans via RLHF
and 1 more not named here
topk_mask 2 other papers
2 later
2403.05612 (2024-03)
Unfamiliar Finetuning Examples Control How Language Models Hallucinate
2025.findings-acl.229 (2025 (year only))
System Prompt Hijacking via Permutation Triggers in LLM Supply Chains
create_report 1 other paper
1 later
2409.12822 (2024-09)
Language Models Learn to Mislead Humans via RLHF
parse_result 1 other paper
1 later
2409.12822 (2024-09)
Language Models Learn to Mislead Humans via RLHF

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-23.

Repositories linked to this paper

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

Abstract

Reinforcement learning from human feedback (RLHF) has emerged as a reliable approach to aligning large language models (LLMs) to human preferences. Among the plethora of RLHF techniques, proximal policy optimization (PPO) is of the most widely used methods. Despite its popularity, however, PPO may suffer from mode collapse, instability, and poor sample efficiency. We show that these issues can be alleviated by a novel algorithm that we refer to as Advantage-Induced Policy Alignment (APA), which leverages a squared error loss function based on the estimated advantages. We demonstrate empirically that APA consistently outperforms PPO in language tasks by a large margin, when a separate reward model is employed as the evaluator. In addition, compared with PPO, APA offers a more stable form of control over the deviation from the model's initial policy, ensuring that the model improves its performance without collapsing to deterministic output. In addition to empirical results, we also provide a theoretical justification supporting the design of our loss function.

For agents

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

get_harvested_code_for_paper("2306.02231")
get_code_for_paper("2306.02231")
have("2306.02231")

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

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

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

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

Connect an agent — have() is free.