FusionBench Evaluation Framework
June 18, 2025 ยท View on GitHub
This directory contains the evaluation framework for FusionBench, a comprehensive benchmark for evaluating language model performance across various tasks.
Overview
The evaluation framework supports multiple types of tasks and metrics:
- Mathematical Reasoning: GSM8K, MATH
- Code Generation: MBPP, HumanEval
- Commonsense Reasoning: CommonsenseQA, OpenBookQA, ARC Challenge, HellaSwag
- World Knowledge: Natural Questions, TriviaQA
- Reading Comprehension: SQuAD, BoolQ
- Popular Benchmarks: MMLU, GPQA
Key Components
Main Evaluation Script (response_eval.py)
The main evaluation script that processes model outputs and calculates performance metrics across different tasks. It supports:
- Task-specific evaluation metrics
- Category-wise performance aggregation
- Detailed per-task performance reporting
- Sample count statistics
Utility Functions (utils.py)
Contains essential helper functions for:
- Text normalization and preprocessing
- Various evaluation metrics (F1, Exact Match, BERT Score)
- Code evaluation utilities
- Model prompting and embedding functions
- File I/O operations
Math Evaluation (math_eval.py)
Specialized functions for evaluating mathematical reasoning tasks:
- LaTeX equation normalization
- Mathematical expression comparison
- Boxed answer extraction and validation
Task-Specific Evaluators
human_eval/: Evaluation framework for HumanEval code generation tasksmbpp/: Evaluation framework for MBPP code generation tasks
Usage
-
Prepare your model outputs in a CSV file with the following columns:
output: Model's responseground_truth: Correct answertask_name: Name of the taskmetric: Evaluation metric to usetask_id: Task identifier (required for code evaluation)
-
Run the evaluation:
python response_eval.py
The script will process the outputs and provide:
- Category-wise performance metrics
- Individual task performance
- Sample counts per task
Supported Metrics
em: Exact Matchcem: Contains Exact Matchem_mc: Exact Match for Multiple Choicebert_score: BERT-based semantic similarityf1_score: F1 score for text matchingcode_eval: Code execution-based evaluation- Task-specific metrics for GSM8K and MATH
Dependencies
- Python 3.x
- PyTorch
- NumPy
- Pandas
- SentenceTransformers
- BERT-Score
- LiteLLM
- Transformers (Longformer)
Notes
- The framework uses CUDA when available for faster processing
- Code evaluation includes timeout protection
- Mathematical expressions are normalized for fair comparison
- BERT-Score is used for semantic similarity evaluation