SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.00049 · NeurIPS · 2024

QUEST: Quality-Aware Metropolis-Hastings Sampling for Machine Translation

André Martins, António Farinhas, R Gonçalo, Faria, Sweta Agrawal, Ricardo Rei, José De Souza

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 1 has no contract verdict; 2 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.00049.json · badge: /api/ran/2406.00049.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
deep-spin/quest-decoding canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
jacobi_joint_probability Ran
ran on a synthesized input
deep-spin/quest-decoding/quest/model/jacobi.py
code served (permissive licence) · get_code("6c37931bd0e91834")
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. 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 torch.nn.functional import log_softmax

torch.manual_seed(0)

# prompt_logits: tensor of shape (batch_size, seq_len, vocab_size)
# After indexing [:, -1:], it becomes (batch_size, 1, vocab_size)
# Then concatenated with x_logits along dim=-2
prompt_logits = torch.randn(2, 3, 4)  # batch=2, seq_len=3, vocab=4

# x_logits: tensor of shape (batch_size, seq_len_x, vocab_size)
# Will be concatenated with prompt_logits[:, -1:] along dim=-2
x_logits = torch.randn(2, 5, 4)  # batch=2, seq_len_x=5, vocab=4

# x: list of token sequences (response indices)
# Used in transition_scores: for each batch, iterate over r with len(r)
# x[i] should have length <= total_logits.shape[1] = 1 + 5 = 6
x = [
    [0, 2, 1, 3],           # batch 0, 4 tokens
    [1, 0, 2]               # batch 1, 3 tokens
]

# y: list of token sequences (response indices)
# Same structure as x
y = [
    [3, 1, 0],              # batch 0, 3 tokens
    [2, 1, 0, 3, 2]         # batch 1, 5 tokens
]

# temperature: float parameter
temperature = 0.8

ARGS = {
    "prompt_logits": prompt_logits,
    "x_logits": x_logits,
    "x": x,
    "y": y,
    "temperature": temperature
}
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 tuple — a tuple 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
sample_jacobi Ran
ran; our contract draft was wrong, not the code
deep-spin/quest-decoding/quest/model/jacobi.py
code served (permissive licence) · get_code("c3e32902396d316c")
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

torch.manual_seed(0)

# Construct logits: shape (batch_size=2, sequence_length=3, vocab_size=4)
# This will be reshaped to (6, 4) in the function for multinomial sampling
logits = torch.randn(2, 3, 4)

# Construct response_length: list of integers for each batch item
response_length = [3, 3]

# Optional parameters
temperature = 1.0
eos_token_id = 2

ARGS = {
    "logits": logits,
    "response_length": response_length,
    "temperature": temperature,
    "eos_token_id": eos_token_id,
}
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 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
transition_scores Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deep-spin/quest-decoding/quest/model/hf.py
code served (permissive licence) · get_code("afb652ab5792f29b")
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 torch.nn as nn

torch.manual_seed(0)

# Analyze the function:
# - logprobs: iterated as `for lp, r in zip(logprobs, response)`
#   Each lp is indexed with `lpi[ri]` where lpi comes from `lp[:len(r)]`
#   So lp must be indexable (tensor or list), and lpi must support indexing
#   and .item() method, so it should be a tensor
# - response: iterated as `for lp, r in zip(logprobs, response)`
#   Each r is used as `len(r)` and iterated with `for ri in r`
#   So r should be a list or tensor of indices

# Create logprobs: batch_size=2, max_seq_len=5, vocab_size=4
# Each element should be indexable and support .item()
logprobs = [
    torch.randn(5, 4),  # 5 tokens, 4 vocab size
    torch.randn(5, 4)   # 5 tokens, 4 vocab size
]

# Create response: batch_size=2, variable lengths
# Each response contains token indices
response = [
    [0, 2, 1, 3],      # 4 tokens
    [1, 0, 3]          # 3 tokens
]

ARGS = {
    "logprobs": logprobs,
    "response": response
}
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 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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 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.

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

An important challenge in machine translation is to generate high-quality and diverse translations. Prior work has shown that the estimated likelihood from the MT model correlates poorly with translation quality. In contrast, quality evaluation metrics (such as COMET or BLEURT) exhibit high correlations with human judgments, which has motivated their use as rerankers (such as quality-aware and minimum Bayes risk decoding). However, relying on a single translation with high estimated quality increases the chances of "gaming the metric". In this paper, we address the problem of sampling a set of high-quality and diverse translations. We provide a simple and effective way to avoid over-reliance on noisy quality estimates by using them as the energy function of a Gibbs distribution. Instead of looking for a mode in the distribution, we generate multiple samples from high-density areas through the Metropolis-Hastings algorithm, a simple Markov chain Monte Carlo approach. The results show that our proposed method leads to high-quality and diverse outputs across multiple language pairs (ENGLISH↔{GERMAN, RUSSIAN}) with two strong decoder-only LLMs (ALMA-7B, TOWER-7B).

For agents

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

get_harvested_code_for_paper("2406.00049")
get_code_for_paper("2406.00049")
have("2406.00049")

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

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

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

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

Connect an agent — have() is free.