Giter Site home page Giter Site logo

conformal-factual-lm's Introduction

Language Models with Conformal Factuality Guarantees

This is the official repository for the paper Language Models with Conformal Factuality Guarantees by Christopher Mohri and Tatsunori Hashimoto.

Installation

Install the packages in requirements.txt and also run the pre-commit script pre-commit install.

Files

  • main.py: shows an example of running inference on one example
  • sayless.py: core functions necessary for inference (sub-claim splitting + merging)
  • factscore.py: code for FActScore dataset
  • nq.py: code for Natural Questions dataset
  • math_data.py: code for MATH dataset
  • calibrate_thresh.py: code for analyzing each dataset (producing sub-claims for annotation, computing thresholds, producing plots, generating new outputs)

Simple FActScore example

The script factscore.py will first dump a jsonl with sub-claims into out/factscore_subclaims.jsonl. Afterwards, the user will need to copy the file to data/factscore_annotations.jsonl and annotate the correctness entries in the json. Then, the user can compute conformal thresholds, produce any of the plots appearing in the paper, and generate conformally factual outputs by setting the appropriate fields in analyze_dataset. nq.py and math_data.py have the same functionality but for the Natural Questions and MATH datasets.

conformal-factual-lm's People

Stargazers

ShuoLi avatar Edgar Dobriban avatar Zhengping Jiang avatar Ondřej Plátek avatar  avatar Allen Z. Ren avatar Arian Askari avatar

Watchers

Nina Jeliazkova avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.