SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.13210 · EMNLP · 2022

Mutual Information Alleviates Hallucinations in Abstractive Summarization

Ryan Cotterell, Clara Meister, Liam Van Der Poel

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 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 9 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-24; 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.13210.json · badge: /api/ran/2210.13210.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
vanderpoelliam/cpmi canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
iinemo/lm-polygraph community
Papers with Code archive
2 ran · 1 no recorded run
ljyflores/loss-library community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
MeanConditionalPointwiseMutualInformation Ran
ran on a synthesized input
iinemo/lm-polygraph/src/lm_polygraph/estimators/conditional_pointwise_mutual_information.py
code served (permissive licence) · get_code("2b4c65c44bfcdd3b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned ndarray, ndim 1, dtype family float, shape (2,) 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 numpy as np
from typing import Dict

# Import the class
import logging
log = logging.getLogger('lm_polygraph')

def polygraph_module_init(func):
    def wrapper(*args, **kwargs):
        if func.__name__ == '__init__':
            log.info(f'Initializing {args[0].__class__.__name__}')
        func(*args, **kwargs)
    return wrapper

from abc import ABC, abstractmethod

class Estimator(ABC):
    @polygraph_module_init
    def __init__(self, stats_dependencies: list, level: str):
        assert level in ['sequence', 'claim', 'token']
        self.level = level
        self.stats_dependencies = stats_dependencies

    @abstractmethod
    def __str__(self):
        raise Exception('Not implemented')

    @abstractmethod
    def __call__(self, stats: Dict[str, np.ndarray]) -> np.ndarray:
        raise Exception('Not implemented')

class MeanConditionalPointwiseMutualInformation(Estimator):
    def __init__(self, tau: float=0.0656, lambd: float=3.599):
        super().__init__(['greedy_log_likelihoods', 'greedy_lm_log_likelihoods', 'entropy'], 'sequence')
        self.tau = tau
        self.lambd = lambd

    def __str__(self):
        return 'MeanConditionalPointwiseMutualInformation'

    def __call__(self, stats: Dict[str, np.ndarray]) -> np.ndarray:
        logprobs = stats['greedy_log_likelihoods']
        lm_logprobs = stats['greedy_lm_log_likelihoods']
        entropies = stats['entropy']
        mi_scores = []
        for lp, lm_lp, ent in zip(logprobs, lm_logprobs, entropies):
            mi_scores.append([])
            for t in range(len(lp)):
                score = lp[t]
                if t > 0 and ent[t] >= self.tau:
                    score -= self.lambd * lm_lp[t]
                mi_scores[-1].append(score)
        return np.array([-np.mean(sc) for sc in mi_scores])

# Setup code
INIT_ARGS = {
    'tau': 0.0656,
    'lambd': 3.599,
}

# Create sample stats with 2 samples, each with 4 tokens
ARGS = {
    'stats': {
        'greedy_log_likelihoods': np.array([
            np.array([-0.5, -0.3, -0.7, -0.2]),
            np.array([-0.4, -0.6, -0.1, -0.8]),
        ], dtype=object),
        'greedy_lm_log_likelihoods': np.array([
            np.array([-1.0, -0.8, -1.2, -0.9]),
            np.array([-0.9, -1.1, -0.7, -1.3]),
        ], dtype=object),
        'entropy': np.array([
            np.array([0.1, 0.08, 0.15, 0.05]),
            np.array([0.12, 0.09, 0.02, 0.11]),
        ], dtype=object),
    }
}

# Construct and call
estimator = MeanConditionalPointwiseMutualInformation(**INIT_ARGS)
result = estimator(**ARGS)
print(f"Estimator: {estimator}")
print(f"Result shape: {result.shape}")
print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
decode Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/bart_file_bpe_decoder.py
code served (permissive licence) · get_code("4e5db0a9eb2ef73f")
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 torch
import numpy as np
from unittest.mock import Mock

torch.manual_seed(0)

# Create a mock BPE tokenizer with a decode method
class MockBPE:
    def __init__(self):
        self.vocab = {
            0: 'h',
            1: 'e',
            2: 'l',
            3: 'o',
        }
    
    def decode(self, tokens):
        """Decode token ids back to text"""
        if isinstance(tokens, torch.Tensor):
            tokens = tokens.tolist()
        return ''.join([self.vocab.get(t, '') for t in tokens])

bpe = MockBPE()
tokens = [0, 1, 2, 2, 3]

ARGS = {
    'bpe': bpe,
    'tokens': tokens,
}
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 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
encode Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/detect_hallucination/process_labels.py
code served (permissive licence) · get_code("62093950a87046d6")
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 numpy as np

class MockBPE:
    """Mock BPE tokenizer that implements the encode method."""
    def encode(self, line):
        # Return a list of token IDs
        # Simple mock: return some integer token IDs based on line length
        return [101, 202, 303, 404][:len(line.split()) + 1]

bpe = MockBPE()
line = "hello world test"

ARGS = {
    "bpe": bpe,
    "line": line,
}
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
extract_lines Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/evaluate_decoding.py
code served (permissive licence) · get_code("a380328ed69263c4")
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 tempfile
import os

# Create a temporary file with some test content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("start_line_1\n")
temp_file.write("other_line\n")
temp_file.write("start_line_2\n")
temp_file.write("another_line\n")
temp_file.write("start_line_3\n")
temp_file.close()

ARGS = {
    'filename': temp_file.name,
    'start': 'start_'
}
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 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
polygraph_module_init Ran
ran; our contract draft was wrong, not the code
iinemo/lm-polygraph/src/lm_polygraph/estimators/conditional_pointwise_mutual_information.py
code served (permissive licence) · get_code("d104b10430234d01")
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) and returned function. 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
import logging

# Set up logging to capture the decorator's behavior
logging.basicConfig(level=logging.INFO)

# The function polygraph_module_init is a decorator that wraps __init__ methods
# It takes a function as input and returns a wrapper function
# The wrapper logs initialization of classes and calls the original function

# To test this decorator, we need to:
# 1. Create a simple class with an __init__ method
# 2. Apply the decorator to that __init__ method
# 3. Instantiate the class to trigger the wrapper

class SimpleModule(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

# Create a test function that will be decorated
def test_init(self, value):
    self.value = value

# The decorator takes a function as its argument
test_func = test_init

ARGS = {
    'func': test_func
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
process_raw Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/detect_hallucination/process_labels.py
code served (permissive licence) · get_code("45525b77cc521f6b")
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


class MockBPE:
    """Mock BPE tokenizer that encodes strings to token IDs."""
    def encode(self, line):
        # Simple mock: map each character to an ID
        return [ord(c) for c in line[:10]]  # Limit to first 10 chars


class MockMorphologicalTokenizer:
    """Mock morphological tokenizer."""
    def tokenize(self, token, return_str=False):
        # Simple mock: just return the token with a prefix
        if return_str:
            return f"tok_{token}"
        return [token]


# Create mock objects
bpe = MockBPE()

# For the mt parameter, we test both None and a tokenizer instance
mt = None  # First case: mt is None, uses bpe.encode()

# Create raw tokens to process
raw = ["hello", "world", "test"]

ARGS = {
    "raw": raw,
    "mt": mt,
    "bpe": bpe
}
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, 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
read_labels Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/evaluate_decoding.py
code served (permissive licence) · get_code("97289c22f4f957e9")
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 tempfile
import os

# Create a temporary file with test data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'test_labels.txt')

# Write test content to the file
with open(temp_file, 'w') as f:
    f.write('1 2 3\n')
    f.write('4 5 6\n')
    f.write('FAIL\n')
    f.write('7 8 9\n')

ARGS = {
    'filename': temp_file
}
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 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
read_lines Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/detect_hallucination/process_labels.py
code served (permissive licence) · get_code("70c754919b846528")
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 2, dtype family int; 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 tempfile
import os

# Create a temporary file with test data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("1 2 3 4\n")
temp_file.write("5 6 7 8\n")
temp_file.write("9 10 11 12\n")
temp_file.close()

ARGS = {
    'filename': temp_file.name,
    'datatype': int
}
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 list, ndim 2, dtype family int — 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
read_lines Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/factCC/generate_json_data.py
code served (permissive licence) · get_code("5685319232b466bb")
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 tempfile
import os

# Create a temporary file with some test content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("line one\n")
temp_file.write("line two with trailing spaces   \n")
temp_file.write("line three\n")
temp_file.close()

filename = temp_file.name

try:
    ARGS = {
        "filename": filename
    }
finally:
    # Clean up will happen after ARGS is defined
    pass
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 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
read_logs Ran
ran on a synthesized input
vanderpoelliam/cpmi/src/evaluate_decoding.py
code served (permissive licence) · get_code("8d2d77ecb104da85")
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 tempfile
import os

# Create a temporary file with test data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_filename = temp_file.name

# Write test data to the file
# Lines starting with "log:" contain values
temp_file.write("log: 0.1 0.2 0.3 0.4 0.5\n")
temp_file.write("log: 0.6 0.7 0.8 0.9\n")
temp_file.write("other: 1.0 2.0 3.0\n")
temp_file.write("log: 0.11 0.22 0.33 0.44 0.55 0.66\n")
temp_file.close()

ARGS = {
    'filename': temp_filename,
    'start': 'log:',
    'type': float,
    'drop_last': True
}
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 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
Estimator Not yet run
unverified (harvested, no recorded run)
iinemo/lm-polygraph/src/lm_polygraph/estimators/conditional_pointwise_mutual_information.py
code served (permissive licence) · get_code("733788d50f9f0f9e")
How it ran

no invocation recorded.

mutual_information_loss Not yet run
unverified (harvested, no recorded run)
ljyflores/loss-library/src/loss_library/utils_mutual_info_loss.py
pointer only (licence: NONE) · get_code("e03b631822bcf5a3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ljyflores/loss-library when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Despite significant progress in the quality of language generated from abstractive summarization models, these models still exhibit the tendency to hallucinate, i.e., output content not supported by the source document. A number of works have tried to fix-or at least uncover the source of-the problem with limited success. In this paper, we identify a simple criterion under which models are significantly more likely to assign more probability to hallucinated content during generation: high model uncertainty. This finding offers a potential explanation for hallucinations: models default to favoring text with high marginal probability, i.e., high-frequency occurrences in the training set, when uncertain about a continuation. It also motivates possible routes for real-time intervention during decoding to prevent such hallucinations. We propose a decoding strategy that switches to optimizing for pointwise mutual information of the source and target token-rather than purely the probability of the target token-when the model exhibits uncertainty. Experiments on the XSUM dataset show that our method decreases the probability of hallucinated tokens while maintaining the ROUGE and BERTS scores of top-performing decoding strategies.

For agents

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

get_harvested_code_for_paper("2210.13210")
get_code_for_paper("2210.13210")
have("2210.13210")

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

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

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

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

Connect an agent — have() is free.