SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.12191 · EMNLP · 2023

Pointwise Mutual Information Based Metric and Decoding Strategy for Faithful Generation in Document Grounded Dialogs

Yatin Nandwani, Dinesh Raghu, Vineet Kumar, Sachindra Joshi, Luis Lastras

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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 6 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2305.12191.json · badge: /api/ran/2305.12191.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
ynandwan/pmi-faith canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
concat_padded_tensors Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/modeling_nce.py
code served (permissive licence) · get_code("b02d06c0faf674c0")
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 Tensor, ndim 2, dtype family int, shape (2, 7) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 two tensors with matching batch dimensions but different last dimensions
# t1: shape (2, 4) - batch of 2, sequence length 4
# t2: shape (2, 3) - batch of 2, sequence length 3
t1 = torch.randint(0, 10, (2, 4))
t2 = torch.randint(0, 10, (2, 3))

# pad_token parameter
pad_token = 0

ARGS = {
    "t1": t1,
    "t2": t2,
    "pad_token": pad_token
}
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 Tensor, ndim 2, dtype family int, shape (2, 7) — shape (2, 7) as a later run recorded it
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
convert_dial_list Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/dataset.py
code served (permissive licence) · get_code("a77daed734d009e1")
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
import torch.nn as nn
from typing import Any, Dict, List

torch.manual_seed(0)

# Construct a list of dialogue dictionaries
# Each dialogue is a dictionary with string keys and various value types
dialogues = [
    {
        "id": "dial_001",
        "turn_count": 3,
        "messages": ["hello", "hi there", "how are you"],
        "speakers": ["user", "bot", "user"]
    },
    {
        "id": "dial_002",
        "turn_count": 2,
        "messages": ["what time is it", "it is noon"],
        "speakers": ["user", "bot"]
    }
]

ARGS = {
    "dialogues": dialogues
}
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_dataset Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/dataset.py
code served (permissive licence) · get_code("856adbd7f6afcfa6")
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 Dataset. 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 json
import os
import tempfile
from typing import Any, Dict, List

# Create a temporary JSON file with valid dialogue data
temp_dir = tempfile.mkdtemp()
input_file = os.path.join(temp_dir, "test_dialogue.json")

dialogue_data = [
    {
        "dialog_idx": 0,
        "utterances": [
            {
                "response": "Hello, how can I help?",
                "original_response": "Hello, how can I help you?",
                "history": ["Hi there"],
                "knowledge": ["I am a helpful assistant"],
                "control_tokens": ["polite"],
                "negative_samples": ["rude response"],
                "BEGIN": "start",
                "VRM": "value"
            },
            {
                "response": "I can assist you further.",
                "original_response": None,
                "history": ["Hi there", "Hello, how can I help?"],
                "knowledge": ["I am helpful"],
                "control_tokens": None,
                "negative_samples": None,
                "BEGIN": None,
                "VRM": None
            }
        ]
    },
    {
        "dialog_idx": 1,
        "utterances": [
            {
                "response": "What do you need?",
                "original_response": "What do you require?",
                "history": ["Good morning"],
                "knowledge": ["Morning greeting knowledge"],
                "control_tokens": ["formal"],
                "negative_samples": ["informal response"],
                "BEGIN": "greeting",
                "VRM": "response_value"
            }
        ]
    }
]

with open(input_file, 'w', encoding='utf-8') as f:
    json.dump(dialogue_data, f)

ARGS = {
    "dataset_name_or_path": input_file,
    "split": "train"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 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_output_name Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/pmi_generate.py
code served (permissive licence) · get_code("badf073462e1fd33")
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.

from pathlib import Path

class Args:
    def __init__(self):
        self.dataset_path = '/path/to/dataset.csv'
        self.num_return_sequences = 1
        self.max_history = 5
        self.max_length = 100
        self.copy_knowledge = 0
        self.copy_gold = 0
        self.temperature = 1.0
        self.repetition_penalty = 1.0
        self.do_sample = False
        self.pmi_decode = False
        self.top_k = 0
        self.top_p = 0.0
        self.add_log_prob_in_pmi = False
        self.pmi_weight = 1.0
        self.ctrl = False
        self.control_tokens = []

ARGS = {
    'args': Args()
}
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
masked_log_softmax Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/modeling_nce.py
code served (permissive licence) · get_code("20cb1e1782f60309")
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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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.functional as F

torch.manual_seed(0)

# Create a vector tensor with shape (batch_size=2, sequence_length=4)
vector = torch.randn(2, 4)

# Create a mask tensor with shape (batch_size=2,) that will be broadcast
# The mask should have 1s for valid positions and 0s for masked positions
mask = torch.tensor([[1.0, 1.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0]])

# Set dim to the last dimension (standard for log_softmax over logits)
dim = -1

ARGS = {
    "vector": vector,
    "mask": mask,
    "dim": dim
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
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
pad_tensor Ran
ran on a synthesized input
ynandwan/pmi-faith/faithful-decode/models/modeling_nce.py
code served (permissive licence) · get_code("2dec641c76d04d78")
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 Tensor, ndim 2, dtype family int, shape (2, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 small tensor to pad
# Shape: (2, 3) - batch size 2, sequence length 3
tensor_to_pad = torch.randint(0, 10, (2, 3))

# Define the new size (must be >= current size for padding to occur)
new_size = 5

# Define the pad token
pad_token = 0

ARGS = {
    "tensor_to_pad": tensor_to_pad,
    "new_size": new_size,
    "pad_token": pad_token,
}
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 Tensor, ndim 2, dtype family int, shape (2, 5) — shape (2, 5) as a later run recorded it
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_huggingface_pretrained_model Not yet run
unverified (harvested, no recorded run)
ynandwan/pmi-faith/faithfulness-metrics/src/compute_faithfulness_api.py
code served (permissive licence) · get_code("4a463c48c18c4b42")
How it ran

no invocation recorded.

get_tokens Not yet run
unverified (harvested, no recorded run)
ynandwan/pmi-faith/faithfulness-metrics/src/compute_faithfulness_api.py
code served (permissive licence) · get_code("9c6cb7a5a08fbe5d")
How it ran

no invocation recorded.

top_k_top_p_filtering Not yet run
unverified (harvested, no recorded run)
ynandwan/pmi-faith/faithful-decode/models/generation_utils_pmi.py
code served (permissive licence) · get_code("eec474cc8cda034e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 5 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 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
top_k_top_p_filtering 21 other papers
1 the same month, 20 later
2305.18290 (2023-05)
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
2311.17911 (2023-11)
OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation
2402.15708 (2024-02)
Query Augmentation by Decoding Semantics from Brain Signals
and 18 more not named here
concat_padded_tensors 1 other paper
1 dated earlier
2204.10757 (2022-04)
FaithDial: A Faithful Benchmark for Information-Seeking Dialogue
convert_dial_list 1 other paper
1 dated earlier
2204.10757 (2022-04)
FaithDial: A Faithful Benchmark for Information-Seeking Dialogue
masked_log_softmax 1 other paper
1 dated earlier
2204.10757 (2022-04)
FaithDial: A Faithful Benchmark for Information-Seeking Dialogue
pad_tensor 1 other paper
1 dated earlier
2204.10757 (2022-04)
FaithDial: A Faithful Benchmark for Information-Seeking Dialogue

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 major concern in using deep learning based generative models for document-grounded dialogs is the potential generation of responses that are not faithful to the underlying document. Existing automated metrics used for evaluating the faithfulness of response with respect to the grounding document measure the degree of similarity between the generated response and the document's content. However, these automated metrics are far from being well aligned with human judgments. Therefore, to improve the measurement of faithfulness, we propose a new metric that utilizes (Conditional) Point-wise Mutual Information (PMI) between the generated response and the source document, conditioned on the dialogue. PMI quantifies the extent to which the document influences the generated response -with a higher PMI indicating a more faithful response. We build upon this idea to create a new decoding technique that incorporates PMI into the response generation process to predict more faithful responses. Our experiments on the BEGIN benchmark demonstrate an improved correlation of our metric with human evaluation. We also show that our decoding technique is effective in generating more faithful responses when compared to standard decoding techniques on a set of publicly available document-grounded dialog datasets.

For agents

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

get_harvested_code_for_paper("2305.12191")
get_code_for_paper("2305.12191")
have("2305.12191")

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

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

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

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

Connect an agent — have() is free.