Skip to content

A streamlined and customizable framework for efficient large model evaluation and performance benchmarking

License

Notifications You must be signed in to change notification settings

modelscope/evalscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation



δΈ­ζ–‡ Β  | Β  English Β 

PyPI version PyPI - Downloads Documentation Status

πŸ“– δΈ­ζ–‡ζ–‡ζ‘£ Β  | Β  πŸ“– English Documents

⭐ If you like this project, please click the "Star" button at the top right to support us. Your support is our motivation to keep going!

πŸ“‹ Contents

πŸ“ Introduction

EvalScope is ModelScope's official framework for model evaluation and benchmarking, designed for diverse assessment needs. It supports various model types including large language models, multimodal, embedding, reranker, and CLIP models.

The framework accommodates multiple evaluation scenarios such as end-to-end RAG evaluation, arena mode, and inference performance testing. It features built-in benchmarks and metrics like MMLU, CMMLU, C-Eval, and GSM8K. Seamlessly integrated with the ms-swift training framework, EvalScope enables one-click evaluations, offering comprehensive support for model training and assessment πŸš€


EvalScope Framework.

Framework Description

The architecture includes the following modules:

  1. Model Adapter: The model adapter is used to convert the outputs of specific models into the format required by the framework, supporting both API call models and locally run models.
  2. Data Adapter: The data adapter is responsible for converting and processing input data to meet various evaluation needs and formats.
  3. Evaluation Backend:
    • Native: EvalScope’s own default evaluation framework, supporting various evaluation modes, including single model evaluation, arena mode, baseline model comparison mode, etc.
    • OpenCompass: Supports OpenCompass as the evaluation backend, providing advanced encapsulation and task simplification, allowing you to submit tasks for evaluation more easily.
    • VLMEvalKit: Supports VLMEvalKit as the evaluation backend, enabling easy initiation of multi-modal evaluation tasks, supporting various multi-modal models and datasets.
    • RAGEval: Supports RAG evaluation, supporting independent evaluation of embedding models and rerankers using MTEB/CMTEB, as well as end-to-end evaluation using RAGAS.
    • ThirdParty: Other third-party evaluation tasks, such as ToolBench.
  4. Performance Evaluator: Model performance evaluation, responsible for measuring model inference service performance, including performance testing, stress testing, performance report generation, and visualization.
  5. Evaluation Report: The final generated evaluation report summarizes the model's performance, which can be used for decision-making and further model optimization.
  6. Visualization: Visualization results help users intuitively understand evaluation results, facilitating analysis and comparison of different model performances.

☎ User Groups

Please scan the QR code below to join our community groups:

Discord Group WeChat Group DingTalk Group

πŸŽ‰ News

  • πŸ”₯ [2024.12.13] Model evaluation optimization: no need to pass the --template-type parameter anymore; supports starting evaluation with evalscope eval --args. Refer to the πŸ“– User Guide for more details.
  • πŸ”₯ [2024.11.26] The model inference service performance evaluator has been completely refactored: it now supports local inference service startup and Speed Benchmark; asynchronous call error handling has been optimized. For more details, refer to the πŸ“– User Guide.
  • πŸ”₯ [2024.10.31] The best practice for evaluating Multimodal-RAG has been updated, please check the πŸ“– Blog for more details.
  • πŸ”₯ [2024.10.23] Supports multimodal RAG evaluation, including the assessment of image-text retrieval using CLIP_Benchmark, and extends RAGAS to support end-to-end multimodal metrics evaluation.
  • πŸ”₯ [2024.10.8] Support for RAG evaluation, including independent evaluation of embedding models and rerankers using MTEB/CMTEB, as well as end-to-end evaluation using RAGAS.
  • πŸ”₯ [2024.09.18] Our documentation has been updated to include a blog module, featuring some technical research and discussions related to evaluations. We invite you to πŸ“– read it.
  • πŸ”₯ [2024.09.12] Support for LongWriter evaluation, which supports 10,000+ word generation. You can use the benchmark LongBench-Write to measure the long output quality as well as the output length.
  • πŸ”₯ [2024.08.30] Support for custom dataset evaluations, including text datasets and multimodal image-text datasets.
  • πŸ”₯ [2024.08.20] Updated the official documentation, including getting started guides, best practices, and FAQs. Feel free to πŸ“–read it here!
  • πŸ”₯ [2024.08.09] Simplified the installation process, allowing for pypi installation of vlmeval dependencies; optimized the multimodal model evaluation experience, achieving up to 10x acceleration based on the OpenAI API evaluation chain.
  • πŸ”₯ [2024.07.31] Important change: The package name llmuses has been changed to evalscope. Please update your code accordingly.
  • πŸ”₯ [2024.07.26] Support for VLMEvalKit as a third-party evaluation framework to initiate multimodal model evaluation tasks.
  • πŸ”₯ [2024.06.29] Support for OpenCompass as a third-party evaluation framework, which we have encapsulated at a higher level, supporting pip installation and simplifying evaluation task configuration.
  • πŸ”₯ [2024.06.13] EvalScope seamlessly integrates with the fine-tuning framework SWIFT, providing full-chain support from LLM training to evaluation.
  • πŸ”₯ [2024.06.13] Integrated the Agent evaluation dataset ToolBench.

πŸ› οΈ Installation

Method 1: Install Using pip

We recommend using conda to manage your environment and installing dependencies with pip:

  1. Create a conda environment (optional)

    # It is recommended to use Python 3.10
    conda create -n evalscope python=3.10
    # Activate the conda environment
    conda activate evalscope
  2. Install dependencies using pip

    pip install evalscope                # Install Native backend (default)
    # Additional options
    pip install evalscope[opencompass]   # Install OpenCompass backend
    pip install evalscope[vlmeval]       # Install VLMEvalKit backend
    pip install evalscope[rag]           # Install RAGEval backend
    pip install evalscope[perf]          # Install Perf dependencies
    pip install evalscope[all]           # Install all backends (Native, OpenCompass, VLMEvalKit, RAGEval)

Warning

As the project has been renamed to evalscope, for versions v0.4.3 or earlier, you can install using the following command:

pip install llmuses<=0.4.3

To import relevant dependencies using llmuses:

from llmuses import ...

Method 2: Install from Source

  1. Download the source code

    git clone https://github.com/modelscope/evalscope.git
  2. Install dependencies

    cd evalscope/
    pip install -e .                  # Install Native backend
    # Additional options
    pip install -e '.[opencompass]'   # Install OpenCompass backend
    pip install -e '.[vlmeval]'       # Install VLMEvalKit backend
    pip install -e '.[rag]'           # Install RAGEval backend
    pip install -e '.[perf]'          # Install Perf dependencies
    pip install -e '.[all]'           # Install all backends (Native, OpenCompass, VLMEvalKit, RAGEval)

πŸš€ Quick Start

To evaluate a model on specified datasets using default configurations, this framework supports two ways to initiate evaluation tasks: using the command line or using Python code.

Method 1. Using Command Line

Execute the eval command in any directory:

evalscope eval \
 --model Qwen/Qwen2.5-0.5B-Instruct \
 --datasets gsm8k arc \
 --limit 5

Method 2. Using Python Code

When using Python code for evaluation, you need to submit the evaluation task using the run_task function, passing a TaskConfig as a parameter. It can also be a Python dictionary, yaml file path, or json file path, for example:

Using Python Dictionary

from evalscope.run import run_task

task_cfg = {
    'model': 'Qwen/Qwen2.5-0.5B-Instruct',
    'datasets': ['gsm8k', 'arc'],
    'limit': 5
}

run_task(task_cfg=task_cfg)
More Startup Methods

Using TaskConfig

from evalscope.run import run_task
from evalscope.config import TaskConfig

task_cfg = TaskConfig(
    model='Qwen/Qwen2.5-0.5B-Instruct',
    datasets=['gsm8k', 'arc'],
    limit=5
)

run_task(task_cfg=task_cfg)

Using yaml file

config.yaml:

model: Qwen/Qwen2.5-0.5B-Instruct
datasets:
  - gsm8k
  - arc
limit: 5
from evalscope.run import run_task

run_task(task_cfg="config.yaml")

Using json file

config.json:

{
    "model": "Qwen/Qwen2.5-0.5B-Instruct",
    "datasets": ["gsm8k", "arc"],
    "limit": 5
}
from evalscope.run import run_task

run_task(task_cfg="config.json")

Basic Parameter

  • --model: Specifies the model_id of the model in ModelScope, which can be automatically downloaded, e.g., Qwen/Qwen2.5-0.5B-Instruct; or use the local path of the model, e.g., /path/to/model
  • --datasets: Dataset names, supports inputting multiple datasets separated by spaces. Datasets will be automatically downloaded from modelscope. For supported datasets, refer to the Dataset List
  • --limit: Maximum amount of evaluation data for each dataset. If not specified, it defaults to evaluating all data. Can be used for quick validation

Output Results

+-----------------------+-------------------+-----------------+
| Model                 | ai2_arc           | gsm8k           |
+=======================+===================+=================+
| Qwen2.5-0.5B-Instruct | (ai2_arc/acc) 0.6 | (gsm8k/acc) 0.6 |
+-----------------------+-------------------+-----------------+

βš™οΈ Complex Evaluation

For more customized evaluations, such as customizing model parameters or dataset parameters, you can use the following command. The evaluation startup method is the same as simple evaluation. Below shows how to start the evaluation using the eval command:

evalscope eval \
 --model Qwen/Qwen2.5-0.5B-Instruct \
 --model-args revision=master,precision=torch.float16,device_map=auto \
 --generation-config do_sample=true,temperature=0.5 \
 --dataset-args '{"gsm8k": {"few_shot_num": 0, "few_shot_random": false}}' \
 --datasets gsm8k \
 --limit 10

Parameter

  • --model-args: Model loading parameters, separated by commas in key=value format. Default parameters:
    • revision: Model version, default is master
    • precision: Model precision, default is auto
    • device_map: Model device allocation, default is auto
  • --generation-config: Generation parameters, separated by commas in key=value format. Default parameters:
    • do_sample: Whether to use sampling, default is false
    • max_length: Maximum length, default is 2048
    • max_new_tokens: Maximum length of generation, default is 512
  • --dataset-args: Configuration parameters for evaluation datasets, passed in json format. The key is the dataset name, and the value is the parameters. Note that it needs to correspond one-to-one with the values in the --datasets parameter:
    • few_shot_num: Number of few-shot examples
    • few_shot_random: Whether to randomly sample few-shot data, if not set, defaults to true

Reference: Full Parameter Description

Evaluation Backend

EvalScope supports using third-party evaluation frameworks to initiate evaluation tasks, which we call Evaluation Backend. Currently supported Evaluation Backend includes:

  • Native: EvalScope's own default evaluation framework, supporting various evaluation modes including single model evaluation, arena mode, and baseline model comparison mode.
  • OpenCompass: Initiate OpenCompass evaluation tasks through EvalScope. Lightweight, easy to customize, supports seamless integration with the LLM fine-tuning framework ms-swift. πŸ“– User Guide
  • VLMEvalKit: Initiate VLMEvalKit multimodal evaluation tasks through EvalScope. Supports various multimodal models and datasets, and offers seamless integration with the LLM fine-tuning framework ms-swift. πŸ“– User Guide
  • RAGEval: Initiate RAG evaluation tasks through EvalScope, supporting independent evaluation of embedding models and rerankers using MTEB/CMTEB, as well as end-to-end evaluation using RAGAS: πŸ“– User Guide
  • ThirdParty: Third-party evaluation tasks, such as ToolBench and LongBench-Write.

Model Serving Performance Evaluation

A stress testing tool focused on large language models, which can be customized to support various dataset formats and different API protocol formats.

Reference: Performance Testing πŸ“– User Guide

Supports wandb for recording results

wandb sample

Supports Speed Benchmark

It supports speed testing and provides speed benchmarks similar to those found in the official Qwen reports:

Speed Benchmark Results:
+---------------+-----------------+----------------+
| Prompt Tokens | Speed(tokens/s) | GPU Memory(GB) |
+---------------+-----------------+----------------+
|       1       |      50.69      |      0.97      |
|     6144      |      51.36      |      1.23      |
|     14336     |      49.93      |      1.59      |
|     30720     |      49.56      |      2.34      |
+---------------+-----------------+----------------+

Custom Dataset Evaluation

EvalScope supports custom dataset evaluation. For detailed information, please refer to the Custom Dataset Evaluation πŸ“–User Guide

Arena Mode

The Arena mode allows multiple candidate models to be evaluated through pairwise battles, and can choose to use the AI Enhanced Auto-Reviewer (AAR) automatic evaluation process or manual evaluation to obtain the evaluation report.

Refer to: Arena Mode πŸ“– User Guide

TO-DO List

  • RAG evaluation
  • VLM evaluation
  • Agents evaluation
  • vLLM
  • Distributed evaluating
  • Multi-modal evaluation
  • Benchmarks
    • GAIA
    • GPQA
    • MBPP
  • Auto-reviewer
    • Qwen-max

Star History

Star History Chart

About

A streamlined and customizable framework for efficient large model evaluation and performance benchmarking

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages