
C-Eval
A comprehensive Chinese benchmark suite for foundation models
- Category
- LLM Benchmarks
- Listed on
What is C-Eval?
C-Eval is a multi-level, multi-disciplinary Chinese evaluation suite designed for large language models. Jointly launched in May 2023 by researchers from Shanghai Jiao Tong University, Tsinghua University, and the University of Edinburgh, the benchmark comprises 13,948 multiple-choice questions spanning 52 distinct subjects across four difficulty tiers. It serves as a rigorous testbed for measuring how well LLMs understand and reason in Chinese. Through both zero-shot and few-shot testing modes, C-Eval assesses a model's adaptability and generalization capabilities on unseen tasks, making it a go-to benchmark for evaluating Chinese-language competence in foundation models.
How to use C-Eval
- Download the data from Hugging Face:
- from datasets import load_dataset
- dataset = load_dataset("ceval/ceval-exam", name="computer_network")
- Alternatively, download and extract the ZIP file directly:
- wget https://huggingface.co/datasets/ceval/ceval-exam/resolve/main/ceval-exam.zip
- unzip ceval-exam.zip
- Choose an evaluation mode. Zero-shot: the model answers questions directly without any examples. Few-shot: the model answers questions with a small number of examples (e.g., 5) provided as context.
- Prepare your model. Ensure the model is loaded and ready for inference. For Hugging Face-based models, load it as follows:
- from transformers import AutoModelForCausalLM, AutoTokenizer
- model_name = "your-model-name"
- tokenizer = AutoTokenizer.from_pretrained(model_name)
- model = AutoModelForCausalLM.from_pretrained(model_name)
- Construct the prompt. Zero-shot prompt template:
- The following is a multiple-choice question from a Chinese {subject} exam. Please select the correct answer.
- {test_question}
- A. {option_A}
- B. {option_B}
- C. {option_C}
- D. {option_D}
- Answer:
- Few-shot prompt template:
- The following are multiple-choice questions from a Chinese {subject} exam. Please select the correct answer.
- {question_1}
- A. {option_A}
- B. {option_B}
- C. {option_C}
- D. {option_D}
- Answer: A
- [k-shot examples]
- {test_question}
- A. {option_A}
- B. {option_B}
- C. {option_C}
- D. {option_D}
- Answer:
- Generate responses using your model. Extract the answer option (A, B, C, or D) from the generated text, or compute the probability for each option and select the one with the highest probability.
- inputs = tokenizer(prompt, return_tensors="pt")
- outputs = model.generate(**inputs)
- response = tokenizer.decode(outputs[0], skip_special_tokens=True)
- answer = extract_answer(response) # Custom function to extract the answer option
- Evaluate the model. For the validation set (val), compute accuracy directly. For the test set (test), submit your results to the official C-Eval platform to receive a score.
- from sklearn.metrics import accuracy_score
- # Assuming `predictions` are the model's predictions and `labels` are the ground truth
- accuracy = accuracy_score(labels, predictions)
- print(f"Validation Accuracy: {accuracy:.2f}")
- Submit results. Prepare a JSON file containing predictions for all test questions:
- {
- "chinese_language_and_literature": {
- "0": "A",
- "1": "B",
- ...
- },
- ...
- }
- Log in to the official C-Eval platform and submit your results to obtain the final score.
Key features of C-Eval
- 1
Multi-Disciplinary Coverage
C-Eval includes questions across 52 different subjects, covering STEM, social sciences, humanities, and more, providing a comprehensive assessment of a language model's knowledge base.
- 2
Multi-Level Difficulty Grading
The benchmark features four difficulty levels, from foundational to advanced, enabling fine-grained evaluation of a model's reasoning and generalization abilities at varying levels of complexity.
- 3
Quantitative Assessment with Standardized Testing
With 13,948 multiple-choice questions and a standardized scoring system, C-Eval delivers quantifiable performance metrics that support side-by-side comparisons across different models.
Use cases of C-Eval
- 1
Language Model Performance Evaluation
Measure a language model's knowledge breadth and reasoning capability comprehensively, helping developers identify areas for optimization and improvement.
- 2
Academic Research and Model Comparison
Provide researchers with a standardized testing platform to analyze and compare how different language models perform across disciplines, driving academic progress and technical innovation.
- 3
Educational Application Development
Support the development of intelligent tutoring systems and educational assessment tools that leverage models to generate practice questions and automate grading, advancing smart education solutions.
- 4
Industry Application Optimization
In sectors such as finance, healthcare, and customer service, evaluate and refine a language model's domain-specific knowledge and applied capabilities to enhance industry-specific intelligent solutions.
- 5
Community Collaboration and Technical Benchmarking
As an open platform, C-Eval fosters collaboration within the developer community and provides a fair benchmarking tool for model competitions and technical evaluations.
More in LLM Benchmarks
View allAI Large Model Evaluation Community
Biomedical research QA dataset and model leaderboard
A large language model benchmark from Fudan University's NLP Lab
Stanford's comprehensive evaluation framework for large language models