# Benchmark相關資料
Source:
1. Paper - Evaluation of RAG: survey
2. Scholar
## 統整
常見的評估指標:
Accuracy、EM、Recall、Precision、R-Rate、Cosine Similarity、Hit Rate、F1 score
N-gram指標:
NDCG(Normalized Discounted Cumulative Gain)、MRR(Mean Reciprocal Rank):衡量檢索結果的排序質量。Context Relevance
ROUGE(Recall-Oriented Understudy for Gisting Evaluation)主要用於文本摘要的質量評估 ROUGE 通過計算生成文本與參考文本之間的重疊程度(如 n-gram、長度一致的子序列等)來評估生成質量。
他們不利用語意理解來評估生成內容的準確性 與人類判斷之間的相關性相當低
基於模型的指標:
BERTScore
BLEURT
BARTScore
常見數據集
BioASQ、BoolQ、CoQA、CosmosQA、HAGRID、HotpotQA、MSMARCO、MultiSpanQA、NarrativeQA、NewsQA、NQ、PopQA、QuAC、SearchQA、SleepQA、 SQuAD、ToolQA、TriviaQA、TruthfulQA
WikiEval EventKG UJ MultiRC ReCoRD WoW
工具tool:僅只提供評估目標、定義算法及軟體工具
RAGAs、Trulens、 LangChain Bench、Databricks Eval
基準benchmark: 包含一組資料集、評估指標和參考結果
RAGAs(WikiEval)、RECALL(EventKG、UJ)、ARES(NQ、Hotpot、FEVER、WoW、MultiRC、ReCoRD)、MedRAG(MIRAGE)、FEB4RAG(FeB4RAG、BEIR)、CDQA(Generation (Source: News), Labeller)、DomainRAG(Generation (Source: College Admission Information))、ReEval(RealTimeQA、NQ)
需要自行構建數據集的基準:Generated(Source:News)
RGB、MultiHop-RAG、CRUD-RAG(UHGEval)
評估的對象: Retreival Generation
常見的評估目標、方面:
Context Relevance、Answer Relevance、Groundedness、Accuracy、Faithfulness、Execution Time、Correctness、Readability...
額外附加的評估方面(RGB):
Information Integration、Noise Robustness、Negative Rejection(Rejection Rate)、Counterfactual Robustness(Error Detection Rate)、Latency(Single Query Latency)、Diversity(Cosine Similarity / Cosine Distance)
對Generation更細微的評估指標(Generation Metrics):
ROUGE、BLEU、BertScore(比ROUGE、BLEU好,有考慮到上下文忠的意思,對語意更敏感)、BARTScore
對Retrieval更細微的評估指標:
MRR(Mean Reciprocal Rank)、MAP(Mean Average Precision)、NDGC
## Evaluation of RAG: survey提到的評估工具
1. [TruEra RAG Triad(Trulens)](https://www.trulens.org/trulens_eval/getting_started/core_concepts/rag_triad/): **38次提及**,一個用於評估和追蹤LLM的app,在RAG評估中,建立了不參考ground-truth answer的評估模組,包含context relevance, groundeness, answer relevance,[詳細可參考這裡](https://hackmd.io/@YungHuiHsu/H16Y5cdi6)。

2. [LangChain Bench](https://langchain-ai.github.io/langchain-benchmarks/notebooks/retrieval/langchain_docs_qa.html): LangChain是一個用來創建、管理、擴展語言模型的套件,可用於RAG資料處理,也有提供一些評估RAG的內建指標,因為很多RAG模型使用LangChain進行資料處理,但不做為評估指標,可能造成引用次數很多但實驗的引用只占一小部分,因此最後再來看這個指標的引用。

*LangChain評估套件的輸出*
3. [Databricks Eval](https://www.databricks.com/blog/LLM-auto-eval-best-practices-RAG): The grades are a composite score of Correctness (weighted: 60%), Comprehensiveness (weighted: 20%) and Readability (weighted: 20%)
4. [RAGAs](https://arxiv.org/abs/2309.15217): **引用87次** [[Experiments list]](https://hackmd.io/@KSLab-M0/BJx4bdsO0),常用指標: faithfulness, context relavancy, answer relevancy。
5. [RECALL](https://arxiv.org/abs/2311.08147): **引用3次**,探討反事實的外部資料對RAG模型造成的影響,引用的另外兩篇論文旨在研究LLM robustness,與RAG無關。
6. [ARES](https://arxiv.org/abs/2311.09476): **引用29次**,皆無使用ARES評估RAG。
7. [RGB](https://arxiv.org/abs/2309.01431): **引用98次**,[RGB dataset](https://arxiv.org/abs/2407.12101),僅被使用1次
8. [MultiHop-RAG](https://arxiv.org/abs/2401.15391): **引用11次**,旨在處理更複雜的多跳問題,及需要多步推理,而不是照Query字面的意思就可以檢索到相關文件的問題。
- [Evaluating LLMs' Inherent Multi-hop Reasoning Ability](https://arxiv.org/abs/2402.11924): 用EM, F1等指標評估
- [GRAG: Graph Retrieval-Augmented Generation](https://arxiv.org/pdf/2405.16506): 優化RAG以應對multi-hop QA,使用的指標是F1, Hit@1, Recall, Accuracy
9. [CRUD-RAG](https://arxiv.org/abs/2401.17043): **引用19次**,裡面大多只提到有這個方法,沒有進階的實驗去評估RAG。
10. [MedRAG](https://arxiv.org/abs/2402.13178): **引用22次**
- [MIRAGE](https://github.com/Teddy-XiongGZ/MIRAGE) : 評估醫學領域的 RAG 的 benchmark
- [MEDRAG](https://github.com/Teddy-XiongGZ/MedRAG?tab=readme-ov-file) : 評估 medical RAG toolkit
11. [FeB4RAG](https://arxiv.org/abs/2402.11891): **引用2次**,一個專門為RAG框架內的聯合搜尋所設計的資料集,基於這個資料集模擬了兩種不同搜尋系統,分別為naive-fed和best-fed,用LLM-judges針對Coverage, Consistency, Correctness, Clarity四個方面做評估,看起來不是給通用RAG模型的benchmark。
12. [CDQA](https://arxiv.org/abs/2402.19248): **引用1次**,中文動態QA資料集。
13. [FiD-Light](https://dl.acm.org/doi/10.1145/3539618.3591687): **引用34次**,FiD-Light 不是專門的RAG評估工具,而是被設計來提高RAG系統性能的模型。FiD-Light 通過壓縮輸入數據並使用源指示重新排序功能來減少計算需求,提升 RAG 系統在查詢延遲和生成效果方面的表現,是一種模型增強工具。
14. [Diversity Reranker](https://towardsdatascience.com/enhancing-rag-pipelines-in-haystack-45f14e2bc9f5): **引用2次**,一樣是一個RAG的增強工具,提高生成回答的覆蓋率和質量。
## Paper
1. [From Local to Global: A Graph RAG Approach to Query-Focused Summarization](https://arxiv.org/abs/2404.16130)
- 評估方式: **LLM-judges**,定義四個指標,由LLM決定是Graphic Rag(C1~C3三個不同level還是Naive Rag回答的答案比較好;每次評估會提供LLM問題、指標、Rag生成的答案,考慮到LLM可能的隨機性,每次評估會被執行五次,並採用多數有效的決定作為最終答案。
`全面性`: 答案涵蓋了問題的多少細節
`多樣性`: 答案提供多少不同觀點或答案的豐富程度
`賦權性`: 答案如何幫助讀者理解問題並做出判斷
`直接性`: 答案是否清晰、具體
- Dataset:
1. Podcast transcripts: 論文中無提供資料集出處,microsoft CTO和其他科技領導對話的Podcast
2. News articles: 論文中無提供資料集出處,應該是一個multi-hop queries dataset
- 論文中稍微提及的QA benchmark dataset:
a. [MultiHop-RAG: Benchmarking retrieval-augmented generation for
multi-hop querie](https://arxiv.org/pdf/2401.15391)
- Multi-hop Queries: Require retrieving and reasoning over multiple pieces of documents/supporting evidence,且建立一個專門蒐集這種問題的QA資料集。
- 
- 因為RGB, RECALL等benchmark皆沒有辦法評估multi-hop問題之間複雜的檢索和推理能力,因此設計了兩個實驗和一些指標,類似precision和recall,來檢測Multi-hot RAG引用的retriever模型和LLM生成模型的能力(比較GPT4, Llama等哪個好)。
b. [HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering](https://arxiv.org/abs/1809.09600)
- 屬於multi-hop QA dataset
c. [Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena](https://arxiv.org/abs/2306.05685)
d. Ragas
2. [Adaptive-RAG: Learning to Adapt Retrieval-Augmented Large Language Models through Question Complexity](https://arxiv.org/pdf/2403.14403)
- 有F1, EM, Accuracy, Step, Time這五個評估指標
- F1, EM, Accuracy: 檢測response和ground-truth answer之間的關係性[(應該是出自這裡)](https://aclanthology.org/2023.acl-long.546.pdf)
- steps: retrieval and generated steps
- time: 上述steps花費的平均時間
3. [RAGBench: Explainable Benchmark for Retrieval-Augmented Generation Systems](https://arxiv.org/abs/2407.11005)
- 提及的Benchmark: Ragas(context relevance, answer relevance, faithfulness), ARES
- 提及的Dataset:

- 實驗結果

## Dataset(RAG評估常用資料集)
1. Wikipedia-based external knowledge base
2. [2WikiMultiHopQA](https://aclanthology.org/2020.coling-main.580/): [github](https://github.com/Alab-NII/2wikimultihop)
3. [HotpotQA](https://aclanthology.org/D18-1259/)
4. [PubMed](https://huggingface.co/datasets/ncbi/pubmed)
5. [SQuAD v1.1](https://aclanthology.org/D16-1264/)
8. [Natural Questions](https://aclanthology.org/2021.eacl-main.74/)
6. Gorilla datasets
## Ragas使用dataset
1. [FinanceBench](https://arxiv.org/abs/2311.11944)
2. [MTSamples](https://mtsamples.com/)
3.
## Network Community