SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.02271 · EMNLP · 2023

FAMESUMM: Investigating and Improving Faithfulness of Medical Summarization

Rui Zhang, Prasenjit Mitra, Yusen Zhang, Nan Zhang, Wu Guo

arXiv · PDF · Open in the Atlas

Code that ran

3 of 6 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; 3 no recorded run), measured 2026-11-23; 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/2311.02271.json · badge: /api/ran/2311.02271.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
psunlpgroup/FaMeSumm canonical (classifier label)
classifier basis: census
3 ran · 3 no recorded run
FunctionStatusWhere it lives
get_dataset Ran
ran; our contract draft was wrong, not the code
psunlpgroup/FaMeSumm/train_BioBART_HQS.py
code served (permissive licence) · get_code("1e2ebb819a8fa6f4")
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 OwnData. 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 argparse
import json
from torch.utils.data import Dataset, DataLoader

torch.manual_seed(0)

class MockTokenizer:
    def batch_encode_plus(self, texts, max_length, padding, truncation, return_tensors):
        batch_size = len(texts)
        return {
            'input_ids': torch.randint(0, 1000, (batch_size, max_length)),
            'attention_mask': torch.ones((batch_size, max_length))
        }

class MockArgs:
    def __init__(self):
        self.max_input_length = 512
        self.max_output_length = 128

# Create a temporary dataset file
import tempfile
import os

temp_dir = tempfile.mkdtemp()
dataset_dir = os.path.join(temp_dir, 'HQS_dataset')
os.makedirs(dataset_dir, exist_ok=True)

# Write sample data
sample_file = os.path.join(dataset_dir, 'train.txt')
with open(sample_file, 'w') as f:
    f.write(json.dumps({'question': 'What is the treatment for diabetes?', 'summary': 'Diabetes treatment includes insulin'}) + '\n')
    f.write(json.dumps({'question': 'How to prevent heart disease?', 'summary': 'Exercise and diet prevention'}) + '\n')

# Change to temp directory so relative path works
original_cwd = os.getcwd()
os.chdir(temp_dir)

tokenizer = MockTokenizer()
type_path = 'train'
num_samples = 2
args = MockArgs()

ARGS = {
    'tokenizer': tokenizer,
    'type_path': type_path,
    'num_samples': num_samples,
    'args': args
}
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 OwnData — a OwnData output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OwnData 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_dataset Ran
ran; our contract draft was wrong, not the code
psunlpgroup/FaMeSumm/train_mt5_MDS.py
code served (permissive licence) · get_code("aefc015a9e203048")
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 OwnData. 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 argparse
import json
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a minimal tokenizer mock that implements the required methods
class MockTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self.eos_token_id = 1
    
    def batch_encode_plus(self, texts, max_length, padding, truncation, return_tensors):
        # Return mock encoded tensors
        batch_size = len(texts)
        return {
            'input_ids': torch.zeros((batch_size, max_length), dtype=torch.long),
            'attention_mask': torch.ones((batch_size, max_length), dtype=torch.long)
        }

# Create mock args with required attributes
args_dict = {
    'output_dir': 'mT5-finetune',
    'model_name_or_path': 'google/mt5-small',
    'tokenizer_name_or_path': 'google/mt5-small',
    'max_input_length': 512,
    'max_output_length': 84,
    'freeze_encoder': False,
    'freeze_embeds': False,
    'learning_rate': 0.0005,
    'weight_decay': 0.1,
    'adam_epsilon': 1e-07,
    'warmup_steps': 1000,
    'train_batch_size': 4,
    'eval_batch_size': 8,
    'num_train_epochs': 40,
    'gradient_accumulation_steps': 16,
    'n_gpu': 1,
    'resume_from_checkpoint': None,
    'val_check_interval': 0.05,
    'n_val': 1000,
    'n_train': -1,
    'n_test': -1,
    'early_stop_callback': False,
    'fp_16': False,
    'opt_level': 'O1',
    'max_grad_norm': 1.0,
    'seed': 42,
    'tau': 1.0,
    'lambda_CL': 1.0,
    'lambda_medical': 0.0014,
    'lambda_negation': 0.0014
}

args = argparse.Namespace(**args_dict)

# Create a mock tokenizer
tokenizer = MockTokenizer()

# Create a minimal mock dataset file by monkey-patching the file opening
# We'll mock the file I/O to avoid actual file access
original_open = open

def mock_open_fn(file, mode='r'):
    if 'MDS_dataset/' in file:
        mock_file = MagicMock()
        # Create minimal mock data
        sample_json = json.dumps({
            'content': [
                {'utterance': 'Patient speaks'},
                {'utterance': 'Doctor responds'}
            ],
            'summary': {'type-B': 'Summary text'}
        })
        mock_file.__enter__.return_value = iter([sample_json])
        mock_file.__exit__.return_value = False
        return mock_file
    return original_open(file, mode)

import builtins
builtins.open = mock_open_fn

ARGS = {
    'tokenizer': tokenizer,
    'type_path': 'train',
    'num_samples': 2,
    'args': args
}
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 OwnData — a OwnData output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OwnData 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_dataset Ran
ran on a synthesized input
psunlpgroup/FaMeSumm/train_pega_HQS.py
code served (permissive licence) · get_code("0ba05c51d5e75fa5")
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 OwnData. 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 argparse
import json
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a minimal tokenizer mock that implements the required methods
class MockTokenizer:
    def __init__(self):
        self.pad_token_id = 0
    
    def batch_encode_plus(self, texts, max_length, padding, truncation, return_tensors):
        batch_size = len(texts)
        # Return tensors with shape (batch_size, max_length)
        input_ids = torch.zeros((batch_size, max_length), dtype=torch.long)
        attention_mask = torch.ones((batch_size, max_length), dtype=torch.long)
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask
        }

# Create args namespace with required parameters
args_dict = dict(
    output_dir='PEGA-finetune',
    model_name_or_path='google/pegasus-large',
    tokenizer_name_or_path='google/pegasus-large',
    max_input_length=512,
    max_output_length=84,
    freeze_encoder=False,
    freeze_embeds=False,
    learning_rate=3e-05,
    weight_decay=0.0,
    adam_epsilon=1e-08,
    warmup_steps=600,
    train_batch_size=4,
    eval_batch_size=16,
    num_train_epochs=60,
    gradient_accumulation_steps=8,
    n_gpu=2,
    resume_from_checkpoint=None,
    val_check_interval=0.05,
    n_val=1000,
    n_train=-1,
    n_test=-1,
    early_stop_callback=False,
    fp_16=False,
    opt_level='O1',
    max_grad_norm=1.0,
    seed=42,
    tau=1.0,
    lambda_CL=1.0,
    lambda_medical=0.001
)

args = argparse.Namespace(**args_dict)

# Create a mock tokenizer
tokenizer = MockTokenizer()

# Mock the file to be read by OwnData
import os
import tempfile

# Create a temporary directory and file with sample data
temp_dir = tempfile.mkdtemp()
os.makedirs('HQS_dataset', exist_ok=True)
test_file_path = 'HQS_dataset/train.txt'

with open(test_file_path, 'w') as f:
    for i in range(5):
        json_obj = {
            'question': f'What is the treatment for condition {i}?',
            'summary': f'Treatment summary {i}'
        }
        f.write(json.dumps(json_obj) + '\n')

# Define ARGS dictionary with all parameters for get_dataset
ARGS = {
    'tokenizer': tokenizer,
    'type_path': 'train',
    'num_samples': 2,
    'args': args
}
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 OwnData — a OwnData output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OwnData 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_dataset Not yet run
unverified (harvested, no recorded run)
psunlpgroup/FaMeSumm/train_bart_HQS.py
code served (permissive licence) · get_code("5b2b3cf5fa2ba68e")
How it ran

no invocation recorded.

get_dataset Not yet run
unverified (harvested, no recorded run)
psunlpgroup/FaMeSumm/train_pega_RRS.py
code served (permissive licence) · get_code("0720dc4ed40173aa")
How it ran

no invocation recorded.

get_dataset Not yet run
unverified (harvested, no recorded run)
psunlpgroup/FaMeSumm/train_t5_HQS.py
code served (permissive licence) · get_code("b88daf37a564369f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 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-23.

Repositories linked to this paper

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

Abstract

Summaries of medical text shall be faithful by being consistent and factual with source inputs, which is an important but understudied topic for safety and efficiency in healthcare. In this paper, we investigate and improve faithfulness in summarization on a broad range of medical summarization tasks. Our investigation reveals that current summarization models often produce unfaithful outputs for medical input text. We then introduce FAMESUMM, a framework to improve faithfulness by fine-tuning pre-trained language models based on medical knowledge. FAMESUMM performs contrastive learning on designed sets of faithful and unfaithful summaries, and it incorporates medical terms and their contexts to encourage faithful generation of medical terms. We conduct comprehensive experiments on three datasets in two languages: health question and radiology report summarization datasets in English, and a patient-doctor dialogue dataset in Chinese. Results demonstrate that FAMESUMM is flexible and effective by delivering consistent improvements over mainstream language models such as BART, T5, mT5, and PEGASUS, yielding state-of-the-art performances on metrics for faithfulness and general quality. Human evaluation by doctors also shows that FAMESUMM generates more faithful outputs. Our code is available at https: //github.com/psunlpgroup/FaMeSumm.

For agents

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

get_harvested_code_for_paper("2311.02271")
get_code_for_paper("2311.02271")
have("2311.02271")

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

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

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

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

Connect an agent — have() is free.