Downloads · 30 days
1.5K
3% of all-time downloads
CogComp/bart-faithful-summary-detector
bart-faithful-summary-detector is a text classification model from CogComp. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as cc-by-sa-4.0.
A BART (base) model trained to classify whether a summary is faithful to the original article. See our paper in NAACL'21 for details.
Downloads · 30 days
1.5K
3% of all-time downloads
All-time downloads
58.9K
Public
Repo size
1.7 GB
Likes
4
Public
Click a slice to open those files.
.bin560 MB · 50%
From the Hugging Face model README
A BART (base) model trained to classify whether a summary is faithful to the original article. See our paper in NAACL'21 for details.
Concatenate a summary and a source document as input (note that the summary needs to be the first sentence).
Here's an example usage (with PyTorch)
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("CogComp/bart-faithful-summary-detector")
model = AutoModelForSequenceClassification.from_pretrained("CogComp/bart-faithful-summary-detector")
article = "Ban Ki-Moon was re-elected for a second term by the UN General Assembly, unopposed and unanimously, on 21 June 2011."
bad_summary = "Ban Ki-moon was elected for a second term in 2007."
good_summary = "Ban Ki-moon was elected for a second term in 2011."
bad_pair = tokenizer(text=bad_summary, text_pair=article, return_tensors='pt')
good_pair = tokenizer(text=good_summary, text_pair=article, return_tensors='pt')
bad_score = model(**bad_pair)
good_score = model(**good_pair)
print(good_score[0][:, 1] > bad_score[0][:, 1]) # True, label mapping: "0" -> "Hallucinated" "1" -> "Faithful"
@inproceedings{CZSR21,
author = {Sihao Chen and Fan Zhang and Kazoo Sone and Dan Roth},
title = {{Improving Faithfulness in Abstractive Summarization with Contrast Candidate Generation and Selection}},
booktitle = {NAACL},
year = {2021}
}