Home

Awesome

Evaluating Hallucinations in Chinese Large Language Models

This repository contains data and evaluation scripts of HalluQA (Chinese Hallucination Question-Answering) benchmark. The full data of HalluQA is in HalluQA.json. The paper introducing HalluQA and detailed experimental results of many Chinese large language models is here.

Update

2024.2.28: We add the multiple-choice task for HalluQA. The test data for multiple-choice task is in HalluQA_mc.json. The multiple-choice QA prompt is in prompts/Chinese_QA_prompt_mc.txt .

Data Collection Pipeline

HalluQA contains 450 meticulously designed adversarial questions, spanning multiple domains, and takes into account Chinese historical culture, customs, and social phenomena. The pipeline of data collection is shown above. At step 1, we write questions which we think may induce model hallucinations. At step 2, we use ChatGPT3.5/Puyu/GLM-130B to generate answers and collect adversarial questions. At step 3, we write multiple correct and wrong answers for each adversarial question and add support evidence. At step 4, we check all annotated question-answer pairs and remove low quality samples.

Data Examples

We show some data examples of HalluQA here.

Metric & Evaluation Method

We use non-hallucination rate as the metric of HalluQA, which represents the percentage of answers that do not exhibit hallucinations out of all model generated answers.
For automated evaluation, we use GPT-4 as the evaluator. GPT-4 will judge whether a generated answer exhibit hallucinations based on the given criterias and reference correct answers.
The prompt for GPT-4 based evaluation is in calculate_metrics.py

Run evaluation for your models

  1. Install requirements
pip install openai
  1. Run evaluation using our script.
python calculate_metrics.py --response_file_name gpt-4-0613_responses.json("replace with your own responses") --api_key "your openai api key" --organization "organization of your openai account"
  1. The results and metric will be saved in results.json and non_hallucination_rate.txt respectively.

Multiple-choice task

We also provide a multiple-choice task for HalluQA. You need to first generate answers for each question using the model to be tested, using our multiple-choice prompt, and then calculate the accuracy of the multiple-choice task using the following script.

python calculate_metrics_mc.py --response_file_name <your_results_file_name>

Results

Leaderboard

Non-hallucination rate of each model for different types of questions:

ModelMisleadingMisleading-hardKnowledgeTotal
Retrieval-Augmented Chat Model
ERNIE-Bot70.8646.3875.7369.33
Baichuan2-53B59.4343.4883.9868.22
ChatGLM-Pro64.0034.7867.9661.33
SparkDesk59.4327.5471.3660.00
Chat Model
abab5.5-chat60.5739.1357.7756.00
gpt-4-061376.0057.9732.0453.11
Qwen-14B-chat75.4323.1930.5846.89
Baichuan2-13B-chat61.7124.6432.0442.44
Baichuan2-7B-chat54.8628.9932.5240.67
gpt-3.5-turbo-061366.2930.4319.4239.33
Xverse-13B-chat65.1423.1922.3339.11
Xverse-7B-chat64.0013.0421.8436.89
ChatGLM2-6B55.4323.1921.3634.89
Qwen-7B-chat55.4314.4917.4831.78
Baichuan-13B-chat49.718.7023.3031.33
ChatGLM-6b52.5720.2915.0530.44
Pre-Trained Model
Qwen-14B54.8623.1924.7636.22
Baichuan2-13B-base23.4324.6445.6333.78
Qwen-7B48.5720.2916.9929.78
Xverse-13B18.8624.6432.5227.33
Baichuan-13B-base9.7118.8440.7825.33
Baichuan2-7B-base8.0021.7441.2625.33
Baichuan-7B-base6.8615.9437.3822.22
Xverse-7B12.0013.0429.6120.22

Detailed results

Each model's generated answers and the corresponding judgement of GPT-4 are in Chinese_LLMs_outputs/.

Multiple-choice task results

Here we report accuracy of the multiple-choice task for seven representative models.

Acknowledgements

Citation

@article{DBLP:journals/corr/abs-2310-03368,
  author       = {Qinyuan Cheng and
                  Tianxiang Sun and
                  Wenwei Zhang and
                  Siyin Wang and
                  Xiangyang Liu and
                  Mozhi Zhang and
                  Junliang He and
                  Mianqiu Huang and
                  Zhangyue Yin and
                  Kai Chen and
                  Xipeng Qiu},
  title        = {Evaluating Hallucinations in Chinese Large Language Models},
  journal      = {CoRR},
  volume       = {abs/2310.03368},
  year         = {2023},
  url          = {https://doi.org/10.48550/arXiv.2310.03368},
  doi          = {10.48550/arXiv.2310.03368},
  eprinttype    = {arXiv},
  eprint       = {2310.03368},
  timestamp    = {Thu, 19 Oct 2023 13:12:52 +0200},
  biburl       = {https://dblp.org/rec/journals/corr/abs-2310-03368.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}