Skip to content

PROJECT TEMPLATE: LLM Evaluation Benchmark

โฑ 1 min readยท๐Ÿ“… Last updated: 2026-10-08

Comprehensive evaluation framework for LLMs.

Project Structure

llm-evaluation-benchmark/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ uv.lock
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ models_config.yaml
โ”‚   โ”œโ”€โ”€ benchmarks_config.yaml
โ”‚   โ””โ”€โ”€ metrics_config.yaml
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ huggingface.py
โ”‚   โ”‚   โ”œโ”€โ”€ openai.py
โ”‚   โ”‚   โ””โ”€โ”€ local.py
โ”‚   โ”œโ”€โ”€ benchmarks/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ mmlu.py          # MMLU benchmark
โ”‚   โ”‚   โ”œโ”€โ”€ truthfulqa.py    # TruthfulQA
โ”‚   โ”‚   โ”œโ”€โ”€ gsm8k.py         # Math reasoning
โ”‚   โ”‚   โ””โ”€โ”€ custom.py        # Custom benchmarks
โ”‚   โ”œโ”€โ”€ metrics/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ perplexity.py
โ”‚   โ”‚   โ”œโ”€โ”€ bleu.py
โ”‚   โ”‚   โ”œโ”€โ”€ rouge.py
โ”‚   โ”‚   โ””โ”€โ”€ accuracy.py
โ”‚   โ”œโ”€โ”€ evaluators/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ single_model.py
โ”‚   โ”‚   โ””โ”€โ”€ comparison.py
โ”‚   โ”œโ”€โ”€ reporters/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ console.py
โ”‚   โ”‚   โ”œโ”€โ”€ html.py
โ”‚   โ”‚   โ””โ”€โ”€ json.py
โ”‚   โ””โ”€โ”€ runner.py            # Evaluation runner
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ benchmarks/
โ”‚   โ””โ”€โ”€ results/
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ run_benchmark.py
โ”‚   โ”œโ”€โ”€ compare_models.py
โ”‚   โ””โ”€โ”€ generate_report.py
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_evaluation.py

Features

  • Multiple benchmark support
  • Various metrics
  • Model comparison
  • HTML reports
  • Leaderboard generation

Quick Start

Run Single Benchmark

from src.runner import EvaluationRunner
from src.models.huggingface import HuggingFaceModel

model = HuggingFaceModel("gpt2")
runner = EvaluationRunner(model)

results = runner.run_benchmark("mmlu")
print(results)

Compare Models

python scripts/compare_models.py \
  --models gpt2,phi-2,distilgpt2 \
  --benchmarks mmlu,gsm8k \
  --output results/comparison.json

Custom Benchmark

from src.benchmarks.custom import CustomBenchmark

benchmark = CustomBenchmark(
    name="my_benchmark",
    questions=question_list,
    evaluator=answer_checker
)

results = benchmark.evaluate(model)

Available Benchmarks

  • MMLU: General knowledge
  • TruthfulQA: Truthfulness
  • GSM8K: Math reasoning
  • HellaSwag: Common sense
  • PIQA: Physical reasoning
  • Custom: Your own benchmarks

Metrics

Category Metrics
Language Model Perplexity, BPC
Generation BLEU, ROUGE, METEOR
Classification Accuracy, F1, Precision/Recall
Reasoning Exact match, Step accuracy

Reports

Generate HTML report:

python scripts/generate_report.py \
  --input results/ \
  --output report.html \
  --format html

Configuration

config/models_config.yaml:

models:
  - name: "gpt2"
    type: "huggingface"
    path: "gpt2"

  - name: "gpt-4"
    type: "openai"
    model: "gpt-4"

config/benchmarks_config.yaml:

benchmarks:
  mmlu:
    subjects: ["math", "cs", "history"]
    num_shots: 5

  gsm8k:
    grade_school_math: true
    show_work: true

Leaderboard

from src.evaluators.comparison import ModelComparison

comparison = ModelComparison(
    models=["gpt2", "phi-2", "distilgpt2"],
    benchmarks=["mmlu", "gsm8k", "truthfulqa"]
)

leaderboard = comparison.run()
comparison.print_leaderboard(leaderboard)

Difficulty: โญโญ Intermediate

Estimated Time: 6-10 hours

Skills: Evaluation, Metrics, Benchmarking