SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.12950 · ICLR · 2023

RLCD: REINFORCEMENT LEARNING FROM CON-TRASTIVE DISTILLATION FOR LM ALIGNMENT

Dan Klein, Kevin Yang, Nanyun Peng, Yuandong Tian, Asli Celikyilmaz

arXiv · PDF · Open in the Atlas

Code that ran

2 of 6 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; 1 failure of our instrument; 4 no recorded run), measured 2026-11-22; 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/2307.12950.json · badge: /api/ran/2307.12950.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
facebookresearch/RLCD canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
prasanns/rlhf-length-biases community
Papers with Code archive
0 ran · 3 no recorded run
FunctionStatusWhere it lives
parse_indices Ran
ran, honoured the contract we drafted
facebookresearch/RLCD/scripts/simulate_preference_data.py
code served (permissive licence) · get_code("a74b91f02512331c")
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 list, ndim 1, dtype family int; 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

def _parse_indices_helper(indices):
    for index in indices.split(','):
        if '-' in index:
            start, end = index.split('-')
            for i in range(int(start), int(end) + 1):
                yield i
        else:
            yield int(index)

def parse_indices(indices):
    return list(_parse_indices_helper(indices))

ARGS = {
    'indices': '1,3-5,7'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int — 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
process_filter_result Ran
ran; our contract draft was wrong, not the code
facebookresearch/RLCD/scripts/simulate_preference_data.py
code served (permissive licence) · get_code("5683be533bddb9cf")
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 tuple, 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.

# Analyzing the function process_filter_result
# It takes a single parameter 'result' which is a string
# The function performs string operations on it:
# - Checks if 'Human' is in the string
# - Finds indices of 'Human', '\n', '</s>', 'Assistant:'
# - Uses string slicing and stripping
# - Returns a tuple of (bool, str or None)

# Create a valid test case that exercises the function logic
result_string = "Assistant: This is a response\n\nHuman: Next question"

ARGS = {
    'result': result_string
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 tuple, ndim 1, dtype family float — a tuple 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
computelike Not yet run
unverified (harvested, no recorded run)
prasanns/rlhf-length-biases/rlhfutils/rlhfutils/rewards.py
pointer only (licence: NONE) · get_code("184cc42fa122fabd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, prasanns/rlhf-length-biases 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. No invocation recorded.

contdistill Not yet run
unverified (harvested, no recorded run)
prasanns/rlhf-length-biases/rlhfutils/rlhfutils/rewards.py
pointer only (licence: NONE) · get_code("ab43db669ce08a10")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, prasanns/rlhf-length-biases 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. No invocation recorded.

generate_result Not yet run
unverified (harvested, no recorded run)
facebookresearch/RLCD/scripts/simulate_preference_data.py
code served (permissive licence) · get_code("21de08a24cc455d0")
How it ran

no invocation recorded.

probcompute Not yet run
unverified (harvested, no recorded run)
prasanns/rlhf-length-biases/rlhfutils/rlhfutils/rewards.py
pointer only (licence: NONE) · get_code("1d88b65e3ddd280c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, prasanns/rlhf-length-biases 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. No invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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 propose Reinforcement Learning from Contrastive Distillation (RLCD), a method for aligning language models to follow principles expressed in natural language (e.g., to be more harmless) without using human feedback. RLCD creates preference pairs from two contrasting model outputs, one using a positive prompt designed to encourage following the given principles, and one using a negative prompt designed to encourage violating them. Using two different prompts causes model outputs to be more differentiated on average, resulting in cleaner preference labels in the absence of human annotations. We then use the preference pairs to train a preference model, which is in turn used to improve a base unaligned language model via reinforcement learning. Empirically, RLCD outperforms RLAIF (Bai et al., 2022b) and context distillation (Huang et al., 2022) baselines across three diverse alignment tasks-harmlessness, helpfulness, and story outline generationand when using both 7B and 30B model scales for simulating preference data.

For agents

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

get_harvested_code_for_paper("2307.12950")
get_code_for_paper("2307.12950")
have("2307.12950")

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

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

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

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

Connect an agent — have() is free.