Why Model Evaluation Is Needed

Model evaluation helps us answer three core questions: How strong is this model? In what areas is it good, and where is it lacking? How do multiple models compare? A scientific evaluation system is the foundation for model selection, optimization, and iteration.

Mainstream Benchmarks

BenchmarkTest DomainQuestion Type
MMLU57 subjects knowledgeMultiple choice
HumanEvalCode generationProgramming problems
C-EvalChinese comprehensive abilityMultiple choice
CMMLUChinese multi-disciplineMultiple choice
GSM8KMathematical reasoningWord problems
MATHCompetition mathematicsSolution problems
HellaSwagCommon sense reasoningCloze test
IFEvalInstruction followingInstruction execution

Running Evaluation in Practice

# Run evaluation using lm-evaluation-harness
pip install lm-eval

# Run MMLU evaluation
lm_eval --model hf \
  --model_args pretrained=deepseek-ai/deepseek-llm-7b-chat \
  --tasks mmlu \
  --batch_size 8 \
  --output_path ./results/mmlu.json

# Run HumanEval code evaluation
lm_eval --model hf \
  --model_args pretrained=deepseek-ai/deepseek-llm-7b-chat \
  --tasks humaneval \
  --batch_size 1

# Run multiple evaluations simultaneously
lm_eval --model hf \
  --model_args pretrained=deepseek-ai/deepseek-llm-7b-chat \
  --tasks mmlu,gsm8k,hellaswag,winogrande \
  --batch_size auto

LLM-as-Judge: Using AI to Evaluate AI

For open-ended generation tasks, traditional benchmarks are insufficient. LLM-as-Judge uses strong models like GPT-4 as judges:

def llm_judge_eval(question, answer, reference):
    prompt = f"""Please evaluate the quality of the following AI answer.

Question: {question}
Reference answer: {reference}
Answer to evaluate: {answer}

Please score on the following dimensions (1-5):
1. Accuracy: Is the answer factually correct?
2. Completeness: Does it cover all key points?
3. Clarity: Is the expression clear and understandable?
4. Usefulness: Is it helpful to the user?

Please output the scores in JSON format."""

    response = judge_llm(prompt)
    return parse_scores(response)

Arena Rankings (Chatbot Arena)

LMSYS Chatbot Arena is currently the most recognized model capability ranking. It compares models through anonymous user voting (blind testing), avoiding cheating and benchmark data contamination issues. The Elo rating system makes rankings fairer.

Building Custom Evaluation Sets

General benchmarks cannot fully reflect your business needs. It is recommended to build domain-specific evaluation sets:

  1. Collect real-world scenario data: Extract real user questions from production logs
  2. Annotate reference answers: Have domain experts annotate high-quality answers
  3. Define evaluation dimensions: Determine metrics such as accuracy, recall, user satisfaction
  4. Automated evaluation: Use LLM-as-Judge or rule engines for automatic scoring
  5. Continuous updates: Regularly add new test cases

Avoiding Common Pitfalls

  • Data contamination: Training data may contain test data, leading to inflated scores
  • Benchmark overfitting: Optimizing for leaderboards without actual capability improvement
  • Single metric: Focusing only on accuracy while ignoring other dimensions like latency and cost
  • Ignoring out-of-distribution capabilities: Capabilities outside benchmarks may vary greatly

Summary

Model evaluation is both a science and an art. It is recommended to use a three-layer evaluation system of "benchmark + LLM-as-Judge + human evaluation" to ensure comprehensive and reliable evaluation results.