🚀 TrueTeacher
このモデルは、TrueTeacher paper (Gekhman et al, 2023) で紹介された、事実的一貫性評価を行うモデルです。主に要約における事実的一貫性を評価するために最適化されています。
📚 ドキュメント
モデルの詳細
このモデルは、要約における事実的一貫性を評価するために最適化されています。論文の主要モデル(表1の "T5-11B w. ANLI + TrueTeacher full" を参照)で、T5-11B (Raffel et al., 2020) を以下のデータセットでファインチューニングしたものです。
TrueTeacherデータセットには、CNN/DailyMail データセット (Hermann et al., 2015) の学習分割データから生成された記事の要約が含まれており、FLAN-PaLM 540B (Chung et al.,2022) を使用して事実的一貫性についてアノテーションが付けられています。要約は、XSum データセット (Narayan et al., 2018) で学習された要約モデルを使用して生成されました。
このモデルの入力形式は、"premise: GROUNDING_DOCUMENT hypothesis: HYPOTHESIS_SUMMARY" です。一般的な要約データセットの入力長に対応するために、max_length を 2048 に設定することをおすすめします。
モデルは二値ラベル('1' - 事実的に一致する、'0' - 事実的に一致しない)を予測します。
評価結果
このモデルは、TRUE benchmark (Honovich et al, 2022) の要約サブセットにおいて、以下のROC AUC結果を達成しています。
MNBM |
QAGS-X |
FRANK |
SummEval |
QAGS-C |
Average |
78.1 |
89.4 |
93.6 |
88.5 |
89.4 |
87.8 |
想定される使用方法
このモデルは、英語での研究用途(非商用)を想定しています。推奨される使用例は、要約における事実的一貫性の評価です。
想定外の使用
- cc-by-nc-4.0 ライセンスに違反するすべての使用例
- 英語以外の言語での使用
💻 使用例
基本的な使用法
分類
from transformers import T5ForConditionalGeneration
from transformers import T5Tokenizer
model_path = 'google/t5_11b_trueteacher_and_anli'
tokenizer = T5Tokenizer.from_pretrained(model_path)
model = T5ForConditionalGeneration.from_pretrained(model_path)
premise = 'the sun is shining'
for hypothesis, expected in [('the sun is out in the sky', '1'),
('the cat is shiny', '0')]:
input_ids = tokenizer(
f'premise: {premise} hypothesis: {hypothesis}',
return_tensors='pt',
truncation=True,
max_length=2048).input_ids
outputs = model.generate(input_ids)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f'premise: {premise}')
print(f'hypothesis: {hypothesis}')
print(f'result: {result} (expected: {expected})\n')
スコアリング
from transformers import T5ForConditionalGeneration
from transformers import T5Tokenizer
import torch
model_path = 'google/t5_11b_trueteacher_and_anli'
tokenizer = T5Tokenizer.from_pretrained(model_path)
model = T5ForConditionalGeneration.from_pretrained(model_path)
premise = 'the sun is shining'
for hypothesis, expected in [('the sun is out in the sky', '>> 0.5'),
('the cat is shiny', '<< 0.5')]:
input_ids = tokenizer(
f'premise: {premise} hypothesis: {hypothesis}',
return_tensors='pt',
truncation=True,
max_length=2048).input_ids
decoder_input_ids = torch.tensor([[tokenizer.pad_token_id]])
outputs = model(input_ids=input_ids, decoder_input_ids=decoder_input_ids)
logits = outputs.logits
probs = torch.softmax(logits[0], dim=-1)
one_token_id = tokenizer('1').input_ids[0]
entailment_prob = probs[0, one_token_id].item()
print(f'premise: {premise}')
print(f'hypothesis: {hypothesis}')
print(f'score: {entailment_prob:.3f} (expected: {expected})\n')
📄 ライセンス
このモデルは、cc-by-nc-4.0ライセンスの下で提供されています。
引用
このモデルを研究論文で使用する場合は、以下のBibTeXエントリを使用してTrueTeacher論文を引用し、上記のANLI、CNN/DailyMail、XSum、T5、FLANの論文も引用してください。
@misc{gekhman2023trueteacher,
title={TrueTeacher: Learning Factual Consistency Evaluation with Large Language Models},
author={Zorik Gekhman and Jonathan Herzig and Roee Aharoni and Chen Elkind and Idan Szpektor},
year={2023},
eprint={2305.11171},
archivePrefix={arXiv},
primaryClass={cs.CL}
}