🤖 AI/ML

Benchmark

Benchmark

A standardized test for measuring performance. Used to evaluate AI models, such as MMLU and HumanEval.

📖 Detailed Explanation

A Benchmark is a standardized test set and evaluation methodology for objectively measuring and comparing the performance of AI models. Because various models can be compared under the same criteria, it serves as an important yardstick for research progress.

The history of AI benchmarks dates back to MNIST (handwritten digit recognition) in the 1990s. In the 2010s, ImageNet drove advances in computer vision, and in the NLP field, GLUE (2018) and SuperGLUE (2019) became the standards for evaluating language understanding. Recently, MMLU, HumanEval, HellaSwag, and others are widely used for LLM evaluation.

A good benchmark must satisfy several conditions. It must be reproducible (the same results under the same conditions), discriminative (able to distinguish performance differences between models), and measure real ability (preventing data contamination or tricks). It must also remain valid over time, but there is also the problem of saturation as models advance.

In practice, benchmarks are essential for model selection, checking development progress, and validating papers. However, you should be wary of overfitting to a single benchmark, and be aware that performance in a real production environment may differ from benchmark scores. There are also benchmark gaming problems, such as the recent controversy over LLM leaderboard manipulation.

💻 Code Example

# LLM 벤치마크 평가 예제 (lm-evaluation-harness 사용)
# pip install lm-eval

# 1. 명령줄로 벤치마크 실행
"""
lm_eval --model hf \
    --model_args pretrained=meta-llama/Llama-2-7b-hf \
    --tasks hellaswag,arc_easy,arc_challenge,winogrande \
    --device cuda:0 \
    --batch_size 8 \
    --output_path results/
"""

# 2. Python API로 실행
from lm_eval import evaluator, tasks

# 모델 로드
results = evaluator.simple_evaluate(
    model="hf",
    model_args="pretrained=gpt2",
    tasks=["hellaswag", "arc_easy"],
    num_fewshot=0,
    batch_size=16,
    device="cuda:0"
)

# 결과 출력
for task_name, task_results in results["results"].items():
    print(f"\n{task_name}:")
    for metric, value in task_results.items():
        print(f"  {metric}: {value:.4f}" if isinstance(value, float) else f"  {metric}: {value}")

# 3. Hugging Face evaluate 라이브러리로 커스텀 평가
from evaluate import load
from datasets import load_dataset

# GLUE 벤치마크의 MRPC 태스크
mrpc = load_dataset("glue", "mrpc", split="validation")
accuracy_metric = load("accuracy")
f1_metric = load("f1")

# 예측 결과 (실제로는 모델 추론 필요)
predictions = [1, 0, 1, 1, 0]  # 예시
references = mrpc["label"][:5]

accuracy = accuracy_metric.compute(predictions=predictions, references=references)
f1 = f1_metric.compute(predictions=predictions, references=references)

print(f"\nMRPC 평가:")
print(f"Accuracy: {accuracy['accuracy']:.4f}")
print(f"F1 Score: {f1['f1']:.4f}")

# 4. 주요 LLM 벤치마크 목록
benchmarks = {
    "MMLU": "57개 주제 다중선택 (지식 평가)",
    "HumanEval": "Python 코딩 문제 (코드 생성)",
    "HellaSwag": "문장 완성 (상식 추론)",
    "TruthfulQA": "사실성 평가 (환각 측정)",
    "GSM8K": "초등 수학 문제 (수학 추론)",
    "MBPP": "기초 프로그래밍 (코드 생성)"
}

for name, desc in benchmarks.items():
    print(f"{name}: {desc}")

🗣️ Examples of Practical Conversations

In a Model Selection Meeting

"Looking only at the MMLU score, Model A is higher, but since code generation is core to our service, we should give more weight to the HumanEval and MBPP scores. Also, since it's a Korean-language service, we need to check Korean benchmark results such as KoBEST as well."

In a Research Paper Review

"This paper claims SOTA, but its few-shot setting differs from other papers and it doesn't specify the evaluation split either. It's not a fair comparison. At the very least, it needs to show results reproducible with the standard settings of lm-eval-harness to be credible."

In a technical interview

"Benchmark contamination is a phenomenon where the evaluation set gets mixed into the training data, inflating scores. In recent research, some of GPT-4's benchmark scores were suspected of being affected by this problem. To prevent it, you need to keep the held-out test set private or use a method that dynamically generates new questions."

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

⚠️ Cautions

1
Benchmark != Real Performance

Even with high benchmark scores, performance in actual use cases may be lower. A benchmark is merely a proxy for a specific ability, and testing with real data before production deployment is essential.

2
Consistency of Evaluation Settings

Results vary greatly depending on the number of few-shot examples, prompt format, and sampling method. When comparing models, be sure to check that the same evaluation settings were used.

3
The Saturation Problem

As models advance, existing benchmarks become saturated and lose their discriminative power. ImageNet is already above 99%, and GLUE has also surpassed human level. Always keep track of the latest benchmark trends.

🔗 Related Terms

📚 Learn More