Repository: open-compass/opencompass
Issue: [Feature] data contamination analysis supports - 添加对测试集数据泄露的分析
Root cause: Unimplemented Feature Gap

### Describe the feature

Data contamination (数据泄露) is now the most significant crisis in the LLMs evaluation community.

Most of modern LLMs will provide a _data contamination analysis_ in their paper or technical reports. Such as: [GPT-3](arxiv.org/abs/2005.14165)，[GPT-4](arxiv.org/abs/2303.08774)，[Llama-2](arxiv.org/abs/2307.09288).

It seems that data contamination will be a must component for a reliable and robust model evaluation. The community has spent much efforts addressing this challenge. Like the upcoming data contamination workshop at ACL next year. And [this project](https://hitz-zentroa.github.io/lm-contamination/) summarising well known contamination sources. The Cohere is attempting to add contamination analysis in there evaluation collections.

I love the OpenCompass project and I am really appreciated for your efforst. I'd like to ask your plan on supporting data contamination analysis. **I am willing to contribute if you have a plan to do this.** Please check out this [zhihu(知乎) article](https://zhuanlan.zhihu.com/p/666490713) where I briefly introduce my approach to identify potential data contamination.

I have done contamination analysis for 6 popular Multi-Choice QA benchmark，including C-Eval，MMLU，CommonsenseQA，ARC, etc. see [this](https://github.com/liyucheng09/Contamination_Detector/tree/master/reports) for more details.

更多信息参见[知乎文章](https://zhuanlan.zhihu.com/p/666490713)!

### Will you implement it?

- [X] I would like to implement this feature and create a PR!

Great works! We sincerely aspire to integrate data contamination detection into OpenCompass, enhancing its overall functionality and reliability. Most definitely, we encourage you to contribute your idea into opencompass. Alternatively, we can briefly explore the implementation concept in this discussion.

Most of existing approach for data contamination detection reply on the access of the full training data. That's why data contamination analysis nowadays are mostly internal - done by LLMs developpers.

So to do a thrid-party contamination detection, we have to bypass the need for training data. My current method in [zhihu(知乎) article](https://zhuanlan.zhihu.com/p/666490713) is to find potential leaked test samples by checking whether we can find the exact inputs and labels via Bing search.

For example, check the contamination analysis for [C-Eval](https://github.com/liyucheng09/Contamination_Detector/blob/master/reports/ceval_report.json), test samples are considered to be leaked if we found a webpage that has over 80% overlap with the question and answer.

We categorise test samples into three classes:

1. 干净样例：网络上找不到对应测试样例的题目或答案。
2. 题目泄漏样例：网络上能够找到原题，但答案并没有一起出现。
3. 题目-答案同时泄漏样例：测试样例的原题和答案同时出现在同一网页上。

Then we shall be able to test models on these three splits. Let's take C-Eval as an example:

Model | Average | Clean | All Dirty | Input-and-Label Contaminated
-- | -- | -- | -- | --
qwen-7b-hf | 58.73% | 56.19% (↓ 2.54%) | 61.69% (↑ 5.50%) | 62.89% (↑ 6.70%)
baichuan2-7b-base-hf | 55.73% | 55.08% (↓ 0.65%) | 56.49% (↑ 1.41%) | 58.87% (↑ 3.79%)


This could provide insights on model's true generalisation capability. And how they gain extra advantage by memorising test samples found online (dirty test samples).

Added #639. Will do CommonsenseQA, Hellaswag, MMLU, ARC, and Winogrande shortly.