รหัส, ชุดข้อมูล, โมเดลสำหรับกระดาษ "การประเมินอัตโนมัติของการระบุแหล่งที่มาโดยแบบจำลองภาษาขนาดใหญ่"

26 มิถุนายน 2023 : 1) ผลการประเมินของแบบจำลองเพิ่มเติมรวมถึง GPT-4 2) การตรวจสอบชุดข้อมูล Attreval-GenSearch อีกครั้งอย่างละเอียดและแก้ไขปัญหาคำอธิบายประกอบบางอย่าง อัปเดตชุดข้อมูลที่เผยแพร่ 3) รหัสการฝึกอบรมและการประเมินผลรวมถึงจุดตรวจสอบที่เปิดตัว
เราปล่อยชุดข้อมูลของเรา (รวมถึงการฝึกอบรมและชุดการประเมินผลสองชุด: การจำลองการจำลองและ 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" )เราแสดงผลลัพธ์ของเราสำหรับทั้ง LLMS และการปรับแต่ง LLMs บนข้อมูล repurposed จากงานที่เกี่ยวข้อง
| การจำลอง | การค้นหา | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| การตั้งค่า | รุ่น (ขนาด) | attr. | ในทางตรงกันข้าม | พิเศษ. | โดยรวม | attr. | ในทางตรงกันข้าม | พิเศษ. | โดยรวม |
| เป็นศูนย์ | Alpaca (7b) | 50.0 | 4.0 | 1.4 | 33.6 | 50.7 | 8.6 | 3.6 | 34.3 |
| Alpaca (13b) | 48.3 | 5.6 | 2.2 | 33.5 | 50.6 | 6.1 | 19.3 | 34.7 | |
| Vicuna (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 | |
| ช็อต | Alpaca (7b) | 45.4 | 8.2 | 9.6 | 31.9 | 49.6 | 5.2 | 13.5 | 37.2 |
| Alpaca (13b) | 38.9 | 20.1 | 2.2 | 33.1 | 50.5 | 10.3 | 5.6 | 34.8 | |
| Vicuna (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 | |
| ปรับแต่ง | Roberta (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 | |
| Llama (7b) | 62.2 | 50.7 | 74.6 | 62.8 | 77.9 | 41.1 | 78.3 | 72.5 | |
| Alpaca (7b) | 66.8 | 41.1 | 76.8 | 64.5 | 73.0 | 30.2 | 80.0 | 72.5 | |
| Alpaca (13b) | 63.6 | 48.9 | 75.8 | 63.6 | 77.5 | 34.5 | 79.4 | 73.3 | |
| Vicuna (13b) | 66.2 | 49.1 | 78.6 | 66.0 | 69.4 | 37.7 | 79.9 | 72.1 |
เราสามารถแจ้ง LLMS เช่น CHATGPT และ GPT-4 เพื่อประเมินการระบุแหล่งที่มา อินพุตคือพรอมต์งานประเมินผลการเรียกร้อง (การต่อเนื่องของ การสืบค้น + คำตอบ ) และการอ้างอิง ตัวอย่างเช่น,
ตรวจสอบว่าการอ้างอิงที่กำหนดสามารถสนับสนุนการเรียกร้องได้หรือไม่ ตัวเลือก: agentable, extrapolatory หรือ contradictory หมายถึงการอ้างอิงอย่างเต็มที่สนับสนุนการเรียกร้องการ extrapolatory หมายถึงการอ้างอิงขาดข้อมูลที่เพียงพอในการตรวจสอบการเรียกร้องและความขัดแย้งหมายถึงการเรียกร้องที่ขัดแย้งกับข้อมูลที่นำเสนอในการอ้างอิง
การเรียกร้อง: ใครคือซีอีโอปัจจุบันของ Twitter? ซีอีโอคนปัจจุบันของ Twitter คือ Elon Musk
การอ้างอิง: Elon Musk เป็นซีอีโอของ Twitter มัสค์เข้ารับตำแหน่งซีอีโอในเดือนตุลาคม 2565 หลังจากมีความสัมพันธ์ย้อนกลับไปมาซึ่งมหาเศรษฐีเสนอให้ซื้อ บริษัท โซเชียลมีเดียในราคา 44 พันล้านดอลลาร์พยายามที่จะถอยออกไปจากนั้นในที่สุดก็ผ่านการซื้อกิจการ หลังจากเป็นซีอีโออดีต CEO Parag Agrawal, CFO Ned Segal และฝ่ายกฎหมายและหัวหน้านโยบาย Vijaya Gadde ทั้งหมดถูกไล่ออกจาก บริษัท
หากต้องการทำซ้ำหมายเลขในตาราง prompt_chatgpt_gpt4.ipynb chatgpt/gpt4 โปรดคัดลอกคีย์ OpenAI API ของคุณใน "./api_key.txt"
หากต้องการแจ้งให้ Llama/Alpaca/Vicuna โปรดดูด้านล่างสำหรับวิธีการอนุมานในรุ่นเหล่านี้
คุณสามารถปรับแต่ง LMS ใด ๆ ในชุดข้อมูล repurposed ของเราเพื่อประเมินการระบุแหล่งที่มา
ที่นี่เรายกตัวอย่างสำหรับการปรับแต่ง Llama/Alpaca/Vicuna คุณสามารถใช้ --model_name_or_path กับโมเดลครอบครัว Llama ใด ๆ เราทำการปรับแต่งอย่างละเอียดของ LLAMA/Alpaca/Vicuna 7B/13B รุ่นที่มี 4 A100 80GB GPU
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
คุณสามารถโหลดโมเดลที่ปรับแต่งได้เพื่อประเมิน เรามีจุดตรวจสอบต่อไปนี้ที่เราได้รับการฝึกฝนในชุดข้อมูล combined_train ในโมเดล HuggingFace:
ตัวอย่างเช่น,
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'เราแสดงสคริปต์การอนุมานและการประเมินผลสำหรับโมเดลที่ใช้ Llama:
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ชุดข้อมูลทั้งหมดในโครงการนี้มีไว้สำหรับการใช้งานเพื่อวัตถุประสงค์ในการวิจัยเท่านั้น เรารวบรวมและใส่คำอธิบายประกอบข้อมูลสำหรับการประเมินผลโดยใช้ข้อมูลที่เปิดเผยต่อสาธารณะบนเว็บด้วยความช่วยเหลือของเครื่องมือค้นหากำเนิด Bing ใหม่ เรารับทราบว่า LLM มีศักยภาพในการทำซ้ำและขยายข้อมูลที่เป็นอันตรายที่มีอยู่ในข้อมูล เราพยายามลดความเสี่ยงนี้โดยเลือกข้อมูลการประเมินของเราอย่างรอบคอบและดำเนินการวิเคราะห์เพื่อระบุและลดความเสี่ยงที่อาจเกิดขึ้นในกระบวนการ
ชุดการประเมินผลประกอบการของเรา Attreval-Gensearch นั้นได้มาจากใหม่ Bing ซึ่งใช้ GPT-4 เป็นกระดูกสันหลัง เป็นสิ่งสำคัญที่จะต้องทราบว่าเรายังใช้ GPT-4 สำหรับการประเมินการระบุแหล่งที่มาของ Attreval-Gensearch ซึ่งได้รับประสิทธิภาพที่ดีที่สุดด้วยความแม่นยำโดยรวมประมาณ 85% อคติบางอย่างอาจมาจาก GPT-4 ทั้งสองสร้างตัวอย่างการทดสอบและการประเมินการระบุแหล่งที่มาซึ่งอาจทำให้เราเข้าใจถึงประสิทธิภาพที่แท้จริงของโมเดล ดังนั้นเราจึงระมัดระวังต่อการมองโลกในแง่ดี นอกจากนี้เรายังรับทราบว่าขนาดของ Attreval-Gensearch อยู่ในระดับปานกลางซึ่งอาจไม่ได้แสดงถึงการตั้งค่าการใช้งานจริงของ LLM อย่างแท้จริง
นอกจากนี้ชุดข้อมูลการจำลองของ Attreval ยังคงมีช่องว่างจากสถานการณ์จริง รูปแบบข้อผิดพลาดในชุดข้อมูลจำลองนี้อาจง่ายเกินไปและขาดความหลากหลายซึ่งสามารถจำกัดความสามารถของแบบจำลองในการจัดการกับข้อผิดพลาดในโลกแห่งความจริงที่ซับซ้อนและหลากหลายมากขึ้น นอกจากนี้ยังเป็นที่น่าสังเกตว่าชุดข้อมูลจำลองนี้อาจมีสัญญาณรบกวนและฉลากที่ผิดพลาดซึ่งอาจขัดขวางการเรียนรู้ของแบบจำลองและประสิทธิภาพที่ตามมา วิธีการรับข้อมูลการฝึกอบรมที่มีคุณภาพสูงสำหรับการประเมินผลการเข้ามาในระดับอาจเป็นจุดสนใจที่สำคัญสำหรับการพัฒนาในอนาคต
หากคุณพบว่ารหัสหรือชุดข้อมูลนี้มีประโยชน์โปรดพิจารณาอ้างถึงบทความของเรา:
@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