SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.07228 · 2022

Language Model Decoding as Likelihood-Utility Alignment

arXiv · PDF · Open in the Atlas

Code that ran

4 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; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 1 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/2210.07228.json · badge: /api/ran/2210.07228.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
epfl-dlab/understanding-decoding canonical (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
get_confidence_interval Ran
ran on a synthesized input
epfl-dlab/understanding-decoding/src/evaluation_from_file_pipeline.py
code served (permissive licence) · get_code("76a9f4646a0f6ac5")
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 tuple, ndim 2, 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create sample trial data
# trials should be a numpy array where percentile is computed along the last axis
# Shape: (n_trials, n_experiments) or similar structure
trials = np.random.randn(100, 4)  # 100 trials, 4 dimensions

# Define ARGS dict with all parameters
ARGS = {
    "trials": trials,
    "confidence_level": 0.95
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
get_model_and_tokenizer Ran
ran on a synthesized input
epfl-dlab/understanding-decoding/detoxify/src/utils.py
code served (permissive licence) · get_code("cfaef4c55ff6fd63")
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 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.

import torch
import transformers
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock model class
class MockModel(torch.nn.Module):
    def __init__(self, num_labels=2):
        super().__init__()
        self.num_labels = num_labels
        self.linear = torch.nn.Linear(4, num_labels)
    
    def forward(self, input_ids, attention_mask=None):
        return self.linear(torch.randn(2, 4))
    
    @classmethod
    def from_pretrained(cls, model_type, num_labels=2):
        return cls(num_labels=num_labels)

# Create a mock tokenizer class
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 1000
    
    @classmethod
    def from_pretrained(cls, model_type):
        return cls()
    
    def __call__(self, text, return_tensors=None):
        return {
            'input_ids': torch.tensor([[101, 2054, 2003, 102]]),
            'attention_mask': torch.tensor([[1, 1, 1, 1]])
        }

# Mock the transformers module to use our test classes
original_getattr = getattr

def mock_getattr_for_transformers(obj, name):
    if obj is transformers:
        if name == "BertForSequenceClassification":
            return MockModel
        elif name == "BertTokenizer":
            return MockTokenizer
    return original_getattr(obj, name)

transformers.BertForSequenceClassification = MockModel
transformers.BertTokenizer = MockTokenizer

ARGS = {
    "model_type": "bert-base-uncased",
    "model_name": "BertForSequenceClassification",
    "tokenizer_name": "BertTokenizer",
    "num_classes": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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
get_score_from_scores_per_datapoint Ran
ran on a synthesized input
epfl-dlab/understanding-decoding/src/evaluation_from_file_pipeline.py
code served (permissive licence) · get_code("cf777f7fd5f4d38c")
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 float64, ndim 0, 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 random
import numpy as np

# Construct the results dictionary with scores per datapoint
scores_per_datapoint = [0.85, 0.92, 0.78, 0.88, 0.95, 0.81]

results = {
    'datapoint': scores_per_datapoint
}

# Define seed for reproducibility
seed = 42

# Construct ARGS dictionary with all required parameters
ARGS = {
    'results': results,
    'seed': seed
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
move_to Ran
ran; our contract draft was wrong, not the code
epfl-dlab/understanding-decoding/detoxify/src/utils.py
code served (permissive licence) · get_code("f1ef1b0e36849908")
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)

# Test with a nested structure containing tensors, dicts, and lists
tensor_obj = torch.randn(2, 4)
dict_obj = {
    "tensor": torch.randn(2, 3),
    "nested_dict": {
        "another_tensor": torch.randn(2, 5)
    }
}
list_obj = [
    torch.randn(2, 4),
    {"tensor": torch.randn(2, 3)},
    [torch.randn(2, 2), torch.randn(2, 1)]
]

device = "cpu"

ARGS = {
    "obj": dict_obj,
    "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
get_score_from_metric Not yet run
unverified (harvested, no recorded run)
epfl-dlab/understanding-decoding/src/evaluation_from_file_pipeline.py
code served (permissive licence) · get_code("13e44254a817a756")
How it ran

no invocation recorded.

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, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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
move_to 2 other papers
2 later
aaai_25418 (2023 (year only))
Video Event Extraction via Tracking Visual States of Arguments
2604.14602 (2026-04)
CausalDetox: Causal Head Selection and Intervention for Language Model Detoxification

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

A critical component of a successful language generation pipeline is the decoding algorithm. However, the general principles that should guide the choice of a decoding algorithm remain unclear. Previous works only compare decoding algorithms in narrow scenarios, and their findings do not generalize across tasks. We argue that the misalignment between the model's likelihood and the task-specific notion of utility is the key factor to understanding the effectiveness of decoding algorithms. To structure the discussion, we introduce a taxonomy of misalignment mitigation strategies (MMSs), providing a unifying view of decoding as a tool for alignment. The MMS taxonomy groups decoding algorithms based on their implicit assumptions about likelihood--utility misalignment, yielding general statements about their applicability across tasks. Specifically, by analyzing the correlation between the likelihood and the utility of predictions across a diverse set of tasks, we provide empirical evidence supporting the proposed taxonomy and a set of principles to structure reasoning when choosing a decoding algorithm. Crucially, our analysis is the first to relate likelihood-based decoding algorithms with algorithms that rely on external information, such as value-guided methods and prompting, and covers the most diverse set of tasks to date. Code, data, and models are available at https://github.com/epfl-dlab/understanding-decoding.

For agents

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

get_harvested_code_for_paper("2210.07228")
get_code_for_paper("2210.07228")
have("2210.07228")

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

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

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

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

Connect an agent — have() is free.