SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.14688 · 2024

Q-Probe: A Lightweight Approach to Reward Maximization for Language Models

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 4 failures of our instrument; 0 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/2402.14688.json · badge: /api/ran/2402.14688.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
likenneth/q_probe canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
binomial_confidence_interval Ran
ran; our contract draft was wrong, not the code
likenneth/q_probe/preference_exp/utils.py
code served (permissive licence) · get_code("c8740af760ce1a05")
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
from scipy.stats import binomtest, binom

# Set seed for reproducibility
torch.manual_seed(0)

# Define arguments for binomial_confidence_interval
ARGS = {
    "a_wins": 25,
    "b_wins": 15,
    "confidence_level": 0.75
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
scipy, 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
get_remote_file Ran
ran; our contract draft was wrong, not the code
likenneth/q_probe/preference_exp/utils.py
code served (permissive licence) · get_code("e7ce4c19888c6df6")
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 socket
import tempfile

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

# Get the current hostname
current_hostname = socket.gethostname()

# Create a test local path
test_local_path = os.path.join(temp_dir, "test_file.txt")

# Create a remote path string - using local hostname to avoid actual SCP calls
# Format is "hostname:path"
remote_path = f"{current_hostname}:/tmp/test_remote_file.txt"

ARGS = {
    "remote_path": remote_path,
    "local_path": test_local_path,
}
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
sample_list_to_dict Ran
ran; our contract draft was wrong, not the code
likenneth/q_probe/code_exp/q_probe/sweep_utils.py
code served (permissive licence) · get_code("3962aa4c294057b5")
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

torch.manual_seed(0)

samples = [
    {'idx': 0, 'data': 'sample_0_a'},
    {'idx': 0, 'data': 'sample_0_b'},
    {'idx': 1, 'data': 'sample_1_a'},
    {'idx': 2, 'data': 'sample_2_a'},
    {'idx': 1, 'data': 'sample_1_b'},
]

ARGS = {
    'samples': samples
}
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 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
shortcut_eval_probe Ran
ran, honoured the contract we drafted
likenneth/q_probe/code_exp/q_probe/sweep_utils.py
code served (permissive licence) · get_code("3d41c270b36fcb1f")
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
import numpy as np

torch.manual_seed(0)

class SimpleProbe(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def get_value(self, features):
        """
        Takes numpy array of features and returns numpy array of values
        """
        features_tensor = torch.tensor(features, dtype=torch.float32)
        with torch.no_grad():
            output = self.linear(features_tensor)
        return output.numpy().squeeze()

# Create sample data structure
sample_dict = {
    0: [
        {'features': np.random.randn(4), 'reward': 0.5},
        {'features': np.random.randn(4), 'reward': 0.7},
        {'features': np.random.randn(4), 'reward': 0.3},
        {'features': np.random.randn(4), 'reward': 0.9},
    ],
    1: [
        {'features': np.random.randn(4), 'reward': 0.2},
        {'features': np.random.randn(4), 'reward': 0.6},
        {'features': np.random.randn(4), 'reward': 0.8},
        {'features': np.random.randn(4), 'reward': 0.4},
    ]
}

# Create probe
probe = SimpleProbe(input_dim=4, output_dim=1)

# Define arguments
ARGS = {
    'sample_dict': sample_dict,
    'probe': probe,
    'temperature': 1.0,
    'chunk_size': 2,
    'n_shuffles': 2
}
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 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
slice_and_move_batch_for_device Ran
ran; our contract draft was wrong, not the code
likenneth/q_probe/preference_exp/utils.py
code served (permissive licence) · get_code("e5b14d12b64c08c2")
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

torch.manual_seed(0)

# Create a batch dictionary with tensors of different shapes
batch = {
    "input_ids": torch.randint(0, 100, (8, 4)),  # batch_size=8, seq_len=4
    "attention_mask": torch.ones(8, 4),           # batch_size=8, seq_len=4
    "labels": torch.randint(0, 10, (8,)),         # batch_size=8
    "metadata": ["sample_1", "sample_2", "sample_3", "sample_4", "sample_5", "sample_6", "sample_7", "sample_8"]  # list of strings, not tensor
}

rank = 0
world_size = 2
device = "cpu"

ARGS = {
    "batch": batch,
    "rank": rank,
    "world_size": world_size,
    "device": device
}
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 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 later) and 3 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
get_remote_file 15 other papers
4 dated earlier, 3 the same month, 8 later
2309.16240 (2023-09)
Beyond Reverse KL: Generalizing Direct Preference Optimization with Diverse Divergence Constraints
2312.00267 (2023-12)
Sample Efficient Preference Alignment in LLMs via Active Exploration
2401.01967 (2024-01)
A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicity
and 12 more not named here
slice_and_move_batch_for_device 1 other paper
1 later
2410.22891 (2024-10)
VPO: Leveraging the Number of Votes in Preference Optimization

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 present an approach called Q-probing to adapt a pre-trained language model to maximize a task-specific reward function. At a high level, Q-probing sits between heavier approaches such as finetuning and lighter approaches such as few shot prompting, but can also be combined with either. The idea is to learn a simple linear function on a model's embedding space that can be used to reweight candidate completions. We theoretically show that this sampling procedure is equivalent to a KL-constrained maximization of the Q-probe as the number of samples increases. To train the Q-probes we consider either reward modeling or a class of novel direct policy learning objectives based on importance weighted policy gradients. With this technique, we see gains in domains with ground-truth rewards (code generation) as well as implicit rewards defined by preference data, even outperforming finetuning in data-limited regimes. Moreover, a Q-probe can be trained on top of an API since it only assumes access to sampling and embeddings. Code: https://github.com/likenneth/q_probe .

For agents

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

get_harvested_code_for_paper("2402.14688")
get_code_for_paper("2402.14688")
have("2402.14688")

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

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

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

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

Connect an agent — have() is free.