Views
No views yet
google/flan-t5-large (Chung et al., 2022)
on the combination of 35K data:
pip install "minicheck @ git+https://github.com/Liyan06/MiniCheck.git@main"1from minicheck.minicheck import MiniCheck
2import os
3os.environ["CUDA_VISIBLE_DEVICES"] = "0"
4
5doc = "A group of students gather in the school library to study for their upcoming final exams."
6claim_1 = "The students are preparing for an examination."
7claim_2 = "The students are on vacation."
8
9# model_name can be one of ['roberta-large', 'deberta-v3-large', 'flan-t5-large', 'Bespoke-MiniCheck-7B']
10scorer = MiniCheck(model_name='flan-t5-large', cache_dir='./ckpts')
11pred_label, raw_prob, _, _ = scorer.score(docs=[doc, doc], claims=[claim_1, claim_2])
12
13print(pred_label) # [1, 0]
14print(raw_prob) # [0.9805923700332642, 0.007121307775378227]1import pandas as pd
2from datasets import load_dataset
3from minicheck.minicheck import MiniCheck
4import os
5os.environ["CUDA_VISIBLE_DEVICES"] = "0"
6
7# load 29K test data
8df = pd.DataFrame(load_dataset("lytang/LLM-AggreFact")['test'])
9docs = df.doc.values
10claims = df.claim.values
11
12scorer = MiniCheck(model_name='flan-t5-large', cache_dir='./ckpts')
13pred_label, raw_prob, _, _ = scorer.score(docs=docs, claims=claims) # ~ 500 docs/min, depending on hardware1from sklearn.metrics import balanced_accuracy_score
2
3df['preds'] = pred_label
4result_df = pd.DataFrame(columns=['Dataset', 'BAcc'])
5for dataset in df.dataset.unique():
6 sub_df = df[df.dataset == dataset]
7 bacc = balanced_accuracy_score(sub_df.label, sub_df.preds) * 100
8 result_df.loc[len(result_df)] = [dataset, bacc]
9
10result_df.loc[len(result_df)] = ['Average', result_df.BAcc.mean()]
11result_df.round(1)@InProceedings{tang-etal-2024-minicheck,
title = {MiniCheck: Efficient Fact-Checking of LLMs on Grounding Documents},
author = {Liyan Tang and Philippe Laban and Greg Durrett},
booktitle = {Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing},
year = {2024},
publisher = {Association for Computational Linguistics},
url = {https://arxiv.org/pdf/2404.10774}
}