코드, 데이터 세트, 논문의 모델 "대형 언어 모델에 의한 속성의 자동 평가"

2023 년 6 월 26 일 : 1) GPT-4를 포함한 더 많은 모델의 평가 결과. 2) Attreval-Gensearch 데이터 세트의 철저한 재검토 및 일부 주석 문제를 수정합니다. 업데이트 된 데이터 세트가 출시되었습니다. 3) 훈련 및 평가 코드뿐만 아니라 모델 체크 포인트가 출시되었습니다.
우리는 데이터 세트 (교육 및 두 가지 평가 세트 포함 : Attreval-Simulation 및 Attreval-Gensearch) : Huggingface 데이터 세트 (자세한 내용은 데이터 세트 페이지에서 찾을 수 있음)
#loading dataset
from datasets import load_dataset
# training
attr_train = load_dataset ( "osunlp/AttrScore" , "combined_train" )
# test
# attr_eval_simulation = load_dataset("osunlp/AttrScore", "attreval_simulation")
attr_eval_gensearch = load_dataset ( "osunlp/AttrScore" , "attreval_gensearch" )우리는 관련 작업의 용도 변경 데이터에 대한 LLM과 미세 조정 LLM에 대한 결과를 보여줍니다.
| 시뮬레이션 | 세대 검색 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| 환경 | 모델 (크기) | att. | 콘트라. | 추가의. | 전반적인 | att. | 콘트라. | 추가의. | 전반적인 |
| 제로 샷 | 알파카 (7b) | 50.0 | 4.0 | 1.4 | 33.6 | 50.7 | 8.6 | 3.6 | 34.3 |
| 알파카 (13b) | 48.3 | 5.6 | 2.2 | 33.5 | 50.6 | 6.1 | 19.3 | 34.7 | |
| 비쿠나 (13b) | 46.3 | 8.3 | 21.6 | 34.6 | 54.4 | 13.3 | 26.1 | 41.4 | |
| chatgpt | 45.7 | 17.9 | 52.7 | 43.2 | 61.2 | 20.6 | 53.3 | 55.0 | |
| GPT-4 | 58.7 | 23.2 | 61.5 | 55.6 | 87.3 | 45.0 | 89.6 | 85.1 | |
| 소수의 샷 | 알파카 (7b) | 45.4 | 8.2 | 9.6 | 31.9 | 49.6 | 5.2 | 13.5 | 37.2 |
| 알파카 (13b) | 38.9 | 20.1 | 2.2 | 33.1 | 50.5 | 10.3 | 5.6 | 34.8 | |
| 비쿠나 (13b) | 35.4 | 37.2 | 0.3 | 32.6 | 50.6 | 9.1 | 8.4 | 34.1 | |
| chatgpt | 46.6 | 27.6 | 35.8 | 39.2 | 62.6 | 26.8 | 49.5 | 53.3 | |
| GPT-4 | 61.1 | 31.3 | 68.8 | 60.0 | 85.2 | 53.3 | 88.9 | 84.3 | |
| 미세 조정 | 로베르타 (330m) | 62.5 | 54.6 | 74.7 | 65.0 | 47.2 | 25.2 | 62.3 | 49.8 |
| GPT2 (1.5B) | 63.6 | 54.6 | 71.9 | 63.5 | 51.1 | 18.6 | 60.7 | 47.4 | |
| T5 (770m) | 45.9 | 57.1 | 71.6 | 59.1 | 58.5 | 24.3 | 72.5 | 61.6 | |
| FLAN-T5 (770m) | 57.3 | 50.1 | 70.5 | 59.3 | 64.3 | 27.6 | 72.9 | 64.5 | |
| FLAN-T5 (3B) | 48.1 | 48.7 | 67.1 | 55.7 | 77.7 | 44.4 | 80.0 | 75.2 | |
| FLAN-T5 (11B) | 48.4 | 49.9 | 66.5 | 55.4 | 81.6 | 38.9 | 76.9 | 72.7 | |
| 라마 (7b) | 62.2 | 50.7 | 74.6 | 62.8 | 77.9 | 41.1 | 78.3 | 72.5 | |
| 알파카 (7b) | 66.8 | 41.1 | 76.8 | 64.5 | 73.0 | 30.2 | 80.0 | 72.5 | |
| 알파카 (13b) | 63.6 | 48.9 | 75.8 | 63.6 | 77.5 | 34.5 | 79.4 | 73.3 | |
| 비쿠나 (13b) | 66.2 | 49.1 | 78.6 | 66.0 | 69.4 | 37.7 | 79.9 | 72.1 |
우리는 Chatgpt 및 GPT-4와 같은 LLM을 통해 속성을 평가할 수 있습니다. 입력은 평가 작업 프롬프트, 클레임 ( 쿼리 + 답변 의 연결) 및 참조입니다. 예를 들어,
주어진 참조가 청구를 뒷받침 할 수 있는지 확인하십시오. 옵션 : 귀속, 외삽 적 또는 모순. 귀속은 참조가 주장을 전적으로지지한다는 것을 의미하며, 외삽제는 참조가 청구를 검증하기에 충분한 정보가 부족하다는 것을 의미하며, 모순은 클레임이 참조에 제시된 정보와 모순된다는 것을 의미합니다.
클레임 : 현재 트위터의 CEO는 누구입니까? 트위터의 현재 CEO는 Elon Musk입니다
참조 : Elon Musk는 Twitter의 CEO입니다. Musk는 2022 년 10 월 CEO로 인수하여 억만 장자가 소셜 미디어 회사를 440 억 달러에 구매하고 물러나려고 시도한 후 궁극적으로 인수를 진행했습니다. 전 CEO, 전 CEO Parag Agrawal, CFO Ned Segal 및 법무 및 정책 책임자 Vijaya Gadde가 모두 회사에서 해고되었습니다.
chatgpt/gpt4 테이블의 번호를 복제하려면 OpenAI API 키 "./api_key.txt" 를 복사 한 다음 노트북 예제 prompt_chatgpt_gpt4.ipynb 실행하십시오.
Llama/Alpaca/Vicuna를 프롬프트하려면이 모델에서 추론을 실행하는 방법은 아래를 참조하십시오.
용도가 변경된 데이터 세트의 LMS를 미세 조정하여 속성을 평가할 수 있습니다.
여기에서 우리는 미세 조정 라마/알파카/비쿠나에 대한 예를 제시합니다. Llama Family 모델과 함께 --model_name_or_path 사용할 수 있습니다. 우리는 4 A100 80GB GPU를 사용하여 LLAMA/ALPACA/VICUNA 7B/13B 모델의 전체 미세 조정을 수행합니다.
torchrun --nproc_per_node 4 train_alpaca.py
--model_name_or_path chavinlo/alpaca-13b
--data_path osunlp/AttrScore
--train_subset ' combined_train '
--input_has_query True
--num_train_samples -1
--bf16 True
--output_dir tmp/alpaca_13b_combined_train/
--evaluation_strategy steps
--eval_steps 500
--num_train_epochs 1
--model_max_length 512
--per_device_train_batch_size 2
--per_device_eval_batch_size 2
--gradient_accumulation_steps 8
--save_strategy steps
--save_steps 5000
--save_total_limit 1
--learning_rate 2e-5
--weight_decay 0.
--warmup_ratio 0.03
--lr_scheduler_type cosine
--logging_steps 1
--fsdp ' full_shard auto_wrap '
--fsdp_transformer_layer_cls_to_wrap ' LlamaDecoderLayer '
--tf32 True
미세 조정 모델을로드하여 평가할 수도 있습니다. 우리는 Huggingface 모델에서 combined_train 데이터 세트에 대해 다음과 같은 체크 포인트를 제공합니다.
예를 들어,
from transformers import AutoTokenizer , AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer . from_pretrained ( "osunlp/attrscore-flan-t5-xl" )
model = AutoModelForSeq2SeqLM . from_pretrained ( "osunlp/attrscore-flan-t5-xl" )
input = "As an Attribution Validator, your task is to verify whether a given reference can support the given claim. A claim can be either a plain sentence or a question followed by its answer. Specifically, your response should clearly indicate the relationship: Attributable, Contradictory or Extrapolatory. A contradictory error occurs when you can infer that the answer contradicts the fact presented in the context, while an extrapolatory error means that you cannot infer the correctness of the answer based on the information provided in the context. n n Claim: Who is the current CEO of Twitter? The current CEO of Twitter is Elon Musk n Reference: Elon Musk is the CEO of Twitter. Musk took over as CEO in October 2022 following a back-and-forth affair in which the billionaire proposed to purchase the social media company for $44 billion, tried to back out, and then ultimately went through with the acquisition. After becoming CEO, former CEO Parag Agrawal, CFO Ned Segal, and legal affairs and policy chief Vijaya Gadde were all dismissed from the company."
input_ids = tokenizer . encode ( input , return_tensors = "pt" )
outputs = model . generate ( input_ids )
output = tokenizer . decode ( outputs [ 0 ], skip_special_tokens = True )
print ( output ) #'Attributable' 또는 단순히 pipeline 사용합니다
from transformers import pipeline
model = pipeline ( "text2text-generation" , "osunlp/attrscore-flan-t5-xl" )
input = "As an Attribution Validator, your task is to verify whether a given reference can support the given claim. A claim can be either a plain sentence or a question followed by its answer. Specifically, your response should clearly indicate the relationship: Attributable, Contradictory or Extrapolatory. A contradictory error occurs when you can infer that the answer contradicts the fact presented in the context, while an extrapolatory error means that you cannot infer the correctness of the answer based on the information provided in the context. n n Claim: Who is the current CEO of Twitter? The current CEO of Twitter is Elon Musk n Reference: Elon Musk is the CEO of Twitter. Musk took over as CEO in October 2022 following a back-and-forth affair in which the billionaire proposed to purchase the social media company for $44 billion, tried to back out, and then ultimately went through with the acquisition. After becoming CEO, former CEO Parag Agrawal, CFO Ned Segal, and legal affairs and policy chief Vijaya Gadde were all dismissed from the company."
output = model ( input )[ 0 ][ 'generated_text' ]
print ( output ) #'Attributable'우리는 라마 기반 모델에 대한 추론 및 평가 스크립트를 보여줍니다.
python inference_alpaca.py
--model_name_or_path osunlp/attrscore-vicuna-13b
--test_data_path osunlp/AttrScore
--subset_name attreval_simulation
--model_max_length 512이 프로젝트의 모든 데이터 세트는 연구 목적으로 만 사용됩니다. 우리는 생성 검색 엔진 인 New Bing의 도움을 받아 웹에서 공개적으로 이용 가능한 정보를 사용하여 평가를 위해 데이터를 수집하고 주석을 달았습니다. 우리는 LLM이 데이터에 존재하는 유해한 정보를 재현하고 증폭시킬 가능성이 있음을 인정합니다. 우리는 평가 데이터를 신중하게 선택하고 프로세스의 잠재적 위험을 식별하고 완화하기 위해 분석을 수행 하여이 위험을 완화하기 위해 노력했습니다.
우리의 주석이 달린 평가 세트 인 Attreval-Gensearch는 GPT-4를 백본으로 사용하는 New Bing에서 파생됩니다. Attreval-Gensearch에서의 속성을 평가하기 위해 GPT-4를 사용하여 전반적인 정확도로 약 85%의 성능을 달성합니다. 일부 편견은 GPT-4에서 발생할 수 있으며, 테스트 예제를 생성하고 속성을 평가하는 데있어 모델의 진정한 성능에 대한 이해가 비뚤어 질 수 있습니다. 그러므로 우리는 과도한 최적화에 대한주의를 기울입니다. 우리는 또한 Attreval-Gensearch의 크기가 중간 정도이며, 이는 LLM의 실제 사용 설정을 완전히 나타내지 않을 수 있음을 인정합니다.
게다가 Attreval-Simulation 데이터 세트는 여전히 실제 시나리오의 차이가 있습니다. 이 시뮬레이션 된 데이터 세트의 오류 패턴은 지나치게 단순하고 다양성이 부족할 수 있으며, 이는보다 복잡하고 다양한 실제 오류를 효과적으로 처리하는 모델의 능력을 제한 할 수 있습니다. 이 시뮬레이션 된 데이터 세트에는 노이즈 및 잘못된 레이블이 포함되어있어 모델의 학습 및 후속 성능을 더욱 방해 할 수 있습니다. 기여 평가를위한 고품질 교육 데이터를 확장하는 방법은 미래의 개발에 중점을 둘 수 있습니다.
이 코드 나 데이터 세트가 유용하다고 생각되면 당사 논문을 인용하는 것을 고려하십시오.
@article { yue2023automatic ,
title = { Automatic Evaluation of Attribution by Large Language Models } ,
author = { Yue, Xiang and Wang, Boshi and Zhang, Kai and Chen, Ziru and Su, Yu and Sun, Huan } ,
journal = { arXiv preprint arXiv:2305.06311 } ,
year = { 2023 }
}궁금한 점이 있으면 자유롭게 연락하십시오. Xiang Yue, Yu Su, Huan Sun