ชิงเฉิน อวี่ 1,* , ซีฟาน เจิ้ง 1,* , ซือเชา ซ่ง 2,* , จือหยู หลี่ 1,† , เฟยหยู่ซีออง 1 , ป๋อถัง 1 , ดิงเฉิน 1
1 สถาบันวิจัยอัลกอริทึมขั้นสูง, เซี่ยงไฮ้, 2 มหาวิทยาลัยเหรินหมินแห่งประเทศจีน
ใครควรให้ความสนใจกับงานของเรา?
สำคัญ
- ติดดาวเรา! ด้วยการนำโปรเจ็กต์ของเราไปแสดงบน GitHub คุณจะได้รับการแจ้งเตือนการเปิดตัวทั้งหมดทันที ขอขอบคุณสำหรับการสนับสนุนของคุณ!
เราสรุปการมีส่วนร่วมหลักของเราดังนี้:
ดังที่แสดงในภาพ ตัวอย่างที่เฟรมเวิร์กการประเมิน เช่น LM Eval Harness และ OpenCompass ไม่สามารถแยกคำตอบที่สำคัญได้จะถูกแสดงให้เห็น โดยเฉพาะ A/T/C/M เป็นตัวแทนงานด้วยตัวเลือกตัวอักษร / ข้อความสั้น / ป้ายหมวดหมู่ / คณิตศาสตร์ ตามลำดับ
สร้างชุดข้อมูลเบนช์มาร์ก : เพื่อปรับปรุงกระบวนการประเมินผลโดยใช้ xFinder เราได้กำหนดมาตรฐานชุดข้อมูลเบนช์มาร์กกระแสหลักต่างๆ ให้อยู่ในรูปแบบ JSON แบบรวม สำหรับรายละเอียดการใช้งาน โปรดดูที่ create_benchmark_dataset.py หากคุณต้องการประเมินชุดข้อมูลของคุณเองโดยใช้ xFinder โปรดดูเทมเพลตสคริปต์benchmark_dataset_template.py ที่เราให้ไว้สำหรับคำแนะนำในการแปลงรูปแบบ
เตรียมคู่ QA และเอาต์พุต LLM : รวบรวมเอาต์พุต LLM ที่คุณต้องการประเมิน ตรวจสอบให้แน่ใจว่าข้อมูลของคุณมีองค์ประกอบต่อไปนี้:
ปรับใช้โมเดล xFinder : เลือกหนึ่งในโมเดลต่อไปนี้เพื่อใช้งาน:
หลังจากปรับใช้โมเดล xFinder แล้ว ให้ทำตามขั้นตอนเหล่านี้เพื่อรันการประเมิน:
# Install xfinder
conda create -n xfinder_env python=3.10 -y
conda activate xfinder_env
pip install xfinder
# Perform an evaluation with xFinder (a built-in example)
CUDA_VISIBLE_DEVICES=0 python -m xfinder.eval --run-example --model-name xFinder-qwen1505 --inference-mode local --model-path-or-url /path/to/anonymized/model/xFinder-qwen1505
เมธอดนี้ช่วยให้คุณประเมินตัวอย่างต่างๆ ที่จัดเก็บไว้ในไฟล์ JSON ได้
# Initialize Evaluator object
evaluator = Evaluator (
model_name = "xFinder-qwen1505" , # Model name
inference_mode = "api" , # Inference mode, 'local' or 'api'
model_path_or_url = "http://your-anonymized-url/generate" , # Anonymized model path or URL
)
# Perform batch evaluation
data_path = "/path/to/your/data/example.json" # User needs to provide their own data path
accuracy = evaluator . evaluate ( data_path )
print ( f"Batch evaluation accuracy: { accuracy } " )
วิธีการนี้ช่วยให้คุณสามารถประเมินแต่ละตัวอย่าง ซึ่งสามารถรวมเข้ากับกรอบงานการประเมิน LLM ได้
# Initialize Evaluator object
evaluator = Evaluator (
model_name = "xFinder-qwen1505" , # Model name
inference_mode = "local" , # Inference mode, 'local' or 'api'
model_path_or_url = "IAAR-Shanghai/xFinder-qwen1505" , # Anonymized model path or URL
)
# Define input for a single evaluation
question = "What is the capital of France?"
llm_output = "The capital of France is Paris."
standard_answer_range = "[ " Paris " , " Lyon " , " Marseille " ]"
key_answer_type = "short_text"
correct_answer = "Paris"
# Perform single example evaluation
result = evaluator . evaluate_single_example (
question ,
llm_output ,
standard_answer_range ,
key_answer_type ,
correct_answer
)
เคล็ดลับ
demo.ipynb
สำหรับตัวอย่างโดยละเอียดเพิ่มเติมexport HF_ENDPOINT=https://hf-mirror.com
เพื่อใช้มิเรอร์ภาษาจีน หากคุณไม่สามารถเชื่อมต่อกับ Hugging Face ได้เราสาธิตตัวอย่างคำถามสี่ประเภทที่ RegEx ไม่สามารถแยกคำตอบหรือแยกคำตอบที่ไม่ถูกต้องบ่อยครั้ง ในขณะที่ xFinder แยกคำตอบที่สำคัญอย่างแม่นยำ
{
"key_answer_type" : " alphabet option " ,
"question" : " A man is seen playing guitar on a stage with others playing instruments behind him. The man grabs a guitar from the audience and begins playing both one after the other ... " ,
"llm_output" : " Option A is the correct choice as it describes ... " ,
"standard_answer_range" : " [['A', 'strums the guitar in the end, continues playing the guitar with the crowd following him as well as lining up next to him.'], ['B', 'continues playing the instruments and ends by waving to the crowd and walking off stage.'], ['C', 'then turns to the audience and gives a stuffed toy to the audience and continues playing.'], ['D', 'finally stops playing and moves his hands for the crowd to see.']] " ,
"gold_label" : " A " ,
"xFinder_output" : " A " ,
},
{
"key_answer_type" : " short text " ,
"question" : " If you really wanted a grape, where would you go to get it? Answer Choices: winery / fruit stand / field / kitchen / food " ,
"llm_output" : " The answer is winery / fruit stand / field / kitchen / food ... " ,
"standard_answer_range" : " [ " winery " , " fruit stand " , " field " , " kitchen " , " food " ] " ,
"gold_label" : " [No valid answer] " ,
"xFinder_output" : " [No valid answer] " ,
},
{
"key_answer_type" : " categorical label " ,
"question" : " How tall is the Sears Building ? " ,
"llm_output" : " The Sears Building is a specific structure, so the answer would be a Location ... " ,
"standard_answer_range" : " ['Abbreviation', 'Entity', 'Description', 'Person', 'Location', 'Number'] " ,
"gold_label" : " Location " ,
"xFinder_output" : " Location " ,
},
{
"key_answer_type" : " math " ,
"question" : " Mike made 69 dollars mowing lawns over the summer. If he spent 24 dollars buying new mower blades, how many 5 dollar games could he buy with the money he had left? " ,
"llm_output" : " To find out how many 5 dollar ... Let's calculate that: nn $45 / $5 = 9 nn So, Mike could buy 9 5 dollar games with the money he had left. " ,
"standard_answer_range" : " a(n) number / set / vector / matrix / interval / expression / function / equation / inequality " ,
"gold_label" : " 9 " ,
"xFinder_output" : " 9 " ,
}
พื้นฐาน : OpenCompass, LM Eval Harness, UltraEval, GPT-4 วิธีการของเรา : xFinder-qwen1505, xFinder-qwen1518, xFinder-gemma7, xFinder-chatglm36base, xFinder-llama38, xFinder-llama38it
เราประเมินความแม่นยำในการแยกคำตอบที่สำคัญจากทั้งชุดทดสอบ KAF และชุดลักษณะทั่วไป ตัวชี้วัดในตารางมีความแม่นยำ
@article{xFinder,
title={xFinder: Robust and Pinpoint Answer Extraction for Large Language Models},
author={Qingchen Yu and Zifan Zheng and Shichao Song and Zhiyu Li and Feiyu Xiong and Bo Tang and Ding Chen},
journal={arXiv preprint arXiv:2405.11874},
year={2024},
}
?กลับไปด้านบน