SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.18853 · NeurIPS · 2024

Decoding-Time Language Model Alignment with Multiple Objectives

Simon Du, Alisa Liu, Hannaneh Hajishirzi, Noah Smith, Yushi Hu, Yifang Chen, Ruizhe Shi

arXiv · PDF · Open in the Atlas

Code that ran

1 of 1 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 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/2406.18853.json · badge: /api/ran/2406.18853.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
srzer/mod marked official in Papers with Code
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
FusionModel Ran
ran on a synthesized input · constructed an object; no result was computed
srzer/mod/experiment-DPO/src/utils/util_decode_general.py
code served (permissive licence) · get_code("8ba128ef9f0cba33")
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 an instance of its own class, FusionModel: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from transformers.generation.logits_process import LogitsProcessorList
from transformers.generation.stopping_criteria import StoppingCriteriaList
from transformers.generation.configuration_utils import GenerationConfig

torch.manual_seed(0)

# Create a minimal config class
class MockConfig:
    def __init__(self):
        self.vocab_size = 1000
        self.bos_token_id = 0
        self.eos_token_id = 2
        self.pad_token_id = 1
        self.max_length = 20
        self.num_beams = 1
        self.num_return_sequences = 1
        self.output_scores = False
        self.return_dict_in_generate = False
        self.remove_invalid_values = False
        self.architectures = ["MockModel"]

# Create a minimal model class
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MockConfig()
        self.device_val = torch.device("cpu")
        self.generation_config = GenerationConfig()
        self.generation_config._from_model_config = False
        self.linear = nn.Linear(4, 1000)
    
    @property
    def device(self):
        return self.device_val
    
    def __call__(self, input_ids=None, past_key_values=None, **kwargs):
        batch_size = input_ids.shape[0] if input_ids is not None else 2
        seq_len = input_ids.shape[1] if input_ids is not None else 5
        logits = torch.randn(batch_size, seq_len, self.config.vocab_size)
        past_kv = tuple([torch.randn(2, batch_size, 4, 3) for _ in range(4)])
        
        class Output:
            def __init__(self, logits, past_key_values):
                self.logits = logits
                self.past_key_values = past_key_values
            
            def items(self):
                return [("logits", self.logits), ("past_key_values", self.past_key_values)]
            
            def __getitem__(self, key):
                if key == "logits":
                    return self.logits
                elif key == "past_key_values":
                    return self.past_key_values
                raise KeyError(key)
            
            def __setitem__(self, key, value):
                if key == "logits":
                    self.logits = value
                elif key == "past_key_values":
                    self.past_key_values = value
        
        return Output(logits, past_kv)
    
    def _validate_model_class(self):
        pass
    
    def _validate_model_kwargs(self, model_kwargs):
        pass
    
    def _prepare_model_inputs(self, inputs, bos_token_id, model_kwargs):
        if inputs is None:
            inputs = torch.tensor([[0, 1, 2]])
        return inputs, "input_ids", model_kwargs

# Create model instances
model1 = MockModel()
model2 = MockModel()

models = [model1, model2]
weights = [0.5, 0.5]

ARGS = {
    "models": models,
    "weights": weights,
}
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 FusionModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FusionModel 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 1 samples lifted from this paper's linked repositories, 1 carry a function identity and 0 do not. Of the 1 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 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.

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

Aligning language models (LMs) to human preferences has emerged as a critical pursuit, enabling these models to better serve diverse user needs. Existing methods primarily focus on optimizing LMs for a single reward function, limiting their adaptability to varied objectives. Here, we propose multi-objective decoding (MOD), a decoding-time algorithm that outputs the next token from a linear combination of predictions of all base models, for any given weighting over different objectives. We exploit a common form among a family of f -divergence regularized alignment approaches (such as PPO, DPO, and their variants) to identify a closed-form solution by Legendre transform, and derive an efficient decoding strategy. Theoretically, we show why existing approaches can be sub-optimal even in natural settings and obtain optimality guarantees for our method. Empirical results demonstrate the effectiveness of the algorithm. For example, compared to a parameter-merging baseline, MOD achieves 12.8% overall reward improvement when equally optimizing towards 3 objectives. Moreover, we experiment with MOD on combining three fully-finetuned LMs of different model sizes, each aimed at different objectives such as safety, coding, and general user preference. Unlike traditional methods that require careful curation of a mixture of datasets to achieve comprehensive improvement, we can quickly experiment with preference weightings using MOD to find the best combination of models. Our best combination reduces toxicity on Toxigen to nearly 0% and achieves 7.9-33.3% improvement across three other metrics (i.e., Codex@1, GSM-COT, BBH-COT).

For agents

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

get_harvested_code_for_paper("2406.18853")
get_code_for_paper("2406.18853")
have("2406.18853")

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

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

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

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

Connect an agent — have() is free.