Skip to main content

QAFactEval: Improved QA-Based Factual Consistency Evaluation for Summarization

This is the official code repository for the NAACL 2022 paper QAFactEval: Improved QA-Based Factual Consistency Evaluation for Summarization by Alexander R. Fabbri, Chien-Sheng Wu, Wenhao Liu, and Caiming Xiong.

In our paper, we conduct an extensive comparison of the components of QA-based metrics for factual consistency evaluation in summarization. Our optimized metric builds on QAEval with question consistency filtering and an improved answer overlap metric, leading to a 14% average improvement over previous QA-based metrics on the SummaC factual consistency benchmark.

Table of Contents

  1. Updates
  2. Using QAFactEval
  3. Citation
  4. License

Updates

5/2/2022 - Initial commit! :)

Using QAFactEval

You can install qafacteval via pip:

pip install qafacteval

You can also install from source:

git clone https://github.com/salesforce/QAFactEval
cd QAFactEval
pip install -e .

For use in scripts

Download the required pretrained models using download_models.sh.

See run.py for an example of using the QAFactEval metric:

from qafacteval import QAFactEval
kwargs = {"cuda_device": 0, "use_lerc_quip": True, \
        "verbose": True, "generation_batch_size": 32, \
        "answering_batch_size": 32, "lerc_batch_size": 8}

model_folder = "" # path to models downloaded with download_models.sh
metric = QAFactEval(
    lerc_quip_path=f"{model_folder}/quip-512-mocha",
    generation_model_path=f"{model_folder}/generation/model.tar.gz",
    answering_model_dir=f"{model_folder}/answering",
    lerc_model_path=f"{model_folder}/lerc/model.tar.gz",
    lerc_pretrained_model_path=f"{model_folder}/lerc/pretraining.tar.gz",
    **kwargs
)

results = metric.score_batch(["This is a source document"], [["This is a summary."]], return_qa_pairs=True)
score = results[0][0]['qa-eval']['lerc_quip']

Citation

When referencing this repository, please cite this paper:

@misc{fabbri-etal-2022-qafacteval,
  title = {QAFactEval: Improved QA-Based Factual Consistency Evaluation for Summarization},
  author = {Alexander R. Fabbri and Chien-Sheng Wu and Wenhao Liu and Caiming Xiong},
  year={2022},
  eprint={2112.08542},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url = {https://arxiv.org/abs/2112.08542},
}

License

This repository is released under the BSD-3 License.

Metadata

Release files for qafacteval 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qafacteval 0.10
File Size Uploaded Provenance Actions
qafacteval-0.10.tar.gz 3.4 kB Without provenance Details for qafacteval-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qafacteval 0.10
File Interpreter ABI Platform Actions
qafacteval-0.10-py3-none-any.whl Python 3 none any Details for qafacteval-0.10-py3-none-any.whl

Total release size: 6.7 kB

Release files / qafacteval-0.10.tar.gz

Download URL qafacteval-0.10.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
69885aab0c5d4226e3a946492c6c49e73f45720e6d664b5e28010f1991bb7cb0
BLAKE2b-256 checksum
How to use checksums
f77055e5e6606cfe35250210627ac18aba4d7e68eadb2dd8f06ef7e8fb32bd4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.8

Release files / qafacteval-0.10-py3-none-any.whl

Download URL qafacteval-0.10-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13341e5a75712c90c9bb30d42ff854c99e67684b7b9c2602957c67218f132c40
BLAKE2b-256 checksum
How to use checksums
2bfb7e623879338a42f4e983d3fac580aeb25fa1c101d1fbc3c8fea995a770c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.8

Security for qafacteval 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page