Skip to main content

GenAIEval

Evaluation, benchmark, and scorecard, targeting for performance on throughput and latency, accuracy on popular evaluation harness, safety, and hallucination

Installation

  • Install from Pypi
pip install -r requirements.txt
pip install opea-eval

notes: We have to install requirements.txt at first, cause Pypi can't have direct dependency with specific commit.

  • Build from Source
git clone https://github.com/opea-project/GenAIEval
cd GenAIEval
pip install -r requirements.txt
pip install -e .

Evaluation

lm-evaluation-harness

For evaluating the models on text-generation tasks, we follow the lm-evaluation-harness and provide the command line usage and function call usage. Over 60 standard academic benchmarks for LLMs, with hundreds of subtasks and variants implemented, such as ARC, HellaSwag, MMLU, TruthfulQA, Winogrande, GSM8K and so on.

command line usage

Gaudi2
# pip install --upgrade-strategy eager optimum[habana]
cd evals/evaluation/lm_evaluation_harness/examples
python main.py \
    --model gaudi-hf \
    --model_args pretrained=EleutherAI/gpt-j-6B \
    --tasks hellaswag \
    --device hpu \
    --batch_size 8
CPU
cd evals/evaluation/lm_evaluation_harness/examples
python main.py \
    --model hf \
    --model_args pretrained=EleutherAI/gpt-j-6B \
    --tasks hellaswag \
    --device cpu \
    --batch_size 8

function call usage

from evals.evaluation.lm_evaluation_harness import LMEvalParser, evaluate

args = LMevalParser(
    model="hf",
    user_model=user_model,
    tokenizer=tokenizer,
    tasks="hellaswag",
    device="cpu",
    batch_size=8,
)
results = evaluate(args)

remote service usage

  1. setup a separate server with GenAIComps

    # build cpu docker
    docker build -f Dockerfile.cpu -t opea/lm-eval:latest .
    
    # start the server
    docker run -p 9006:9006 --ipc=host  -e MODEL="hf" -e MODEL_ARGS="pretrained=Intel/neural-chat-7b-v3-3" -e DEVICE="cpu" opea/lm-eval:latest
    
  2. evaluate the model

    • set base_url, tokenizer and --model genai-hf

      cd evals/evaluation/lm_evaluation_harness/examples
      
      python main.py \
          --model genai-hf \
          --model_args "base_url=http://{your_ip}:9006,tokenizer=Intel/neural-chat-7b-v3-3" \
          --tasks  "lambada_openai" \
          --batch_size 2
      

bigcode-evaluation-harness

For evaluating the models on coding tasks or specifically coding LLMs, we follow the bigcode-evaluation-harness and provide the command line usage and function call usage. HumanEval, HumanEval+, InstructHumanEval, APPS, MBPP, MBPP+, and DS-1000 for both completion (left-to-right) and insertion (FIM) mode are available.

command line usage

cd evals/evaluation/bigcode_evaluation_harness/examples
python main.py \
    --model "codeparrot/codeparrot-small" \
    --tasks "humaneval" \
    --n_samples 100 \
    --batch_size 10 \
    --allow_code_execution

function call usage

from evals.evaluation.bigcode_evaluation_harness import BigcodeEvalParser, evaluate

args = BigcodeEvalParser(
    user_model=user_model,
    tokenizer=tokenizer,
    tasks="humaneval",
    n_samples=100,
    batch_size=10,
    allow_code_execution=True,
)
results = evaluate(args)

Kubernetes platform optimization

Node resource management helps optimizing AI container performance and isolation on Kubernetes nodes. See Platform optimization.

Benchmark

We provide a OPEA microservice benchmarking tool which is designed for microservice performance testing and benchmarking. It allows you to define test cases for various services based on YAML configurations, run load tests using stresscli, built on top of locust, and analyze the results for performance insights.

Features

  • Services load testing: Simulates high concurrency levels to test services like LLM, reranking, ASR, E2E and more.
  • YAML-based configuration: Easily define test cases, service endpoints, and parameters.
  • Service metrics collection: Optionally collect service metrics to analyze performance bottlenecks.
  • Flexible testing: Supports a variety of tests like chatqna, codegen, codetrans, faqgen, audioqna, and visualqna.
  • Data analysis and visualization: Visualize test results to uncover performance trends and bottlenecks.

How to use

Define Test Cases: Configure your tests in the benchmark.yaml file.

Increase File Descriptor Limit (if running large-scale tests):

ulimit -n 100000

This ensures the system can handle high concurrency by allowing more open files and connections.

Run the benchmark script:

cd evals/benchmark/
python benchmark.py

NOTE: benchmark.py will take benchmark.yaml file as test case data.
By giving a --yaml argument with a custom yaml file, benchmark.py could take a custom test case data.

e.g. Test data for the examples starting by docker compose on HPU.

cd evals/benchmark/
python benchmark.py --yaml docker.hpu.benchmark.yaml

Results will be saved in the directory specified by test_output_dir in the configuration.

For more details on configuring test cases, refer to the README.

Grafana Dashboards

Prometheus metrics collected during the tests can be used to create Grafana dashboards for visualizing performance trends and monitoring bottlenecks. For more information, refer to the Grafana README

tgi microservice dashboard

Additional Content

Metadata

Release files for opea-eval 1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opea-eval 1.5
File Size Uploaded
opea_eval-1.5.tar.gz 117.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opea-eval 1.5
File Interpreter ABI Platform
opea_eval-1.5-py3-none-any.whl Python 3 none any Details

Total release size: 269.6 kB

Release files / opea_eval-1.5.tar.gz

Download URL opea_eval-1.5.tar.gz
Size 117.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bb98ce9717e746efdff5b09f1b6f7767a06b81e47c436c439a5e60ac504829d1
BLAKE2b-256 checksum
How to use checksums
74fefd57ad217f11ab46bf54bd07c1586c6d473ff9c0f3939cfe5bb1bbd6ae5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / opea_eval-1.5-py3-none-any.whl

Download URL opea_eval-1.5-py3-none-any.whl
Size 151.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a88fecfd20fbc3bfe59422f11c5a68688bbab169affa024e49d59b4b3322ac12
BLAKE2b-256 checksum
How to use checksums
143f41e192c8b58f8904d844d698d0fc1f31d6ed8cbe7915ae9e68cab444215d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release history Release notifications | RSS feed

This release

1.5 This release

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.9

2 release files

0.8

2 release files

0.7

1 release file

0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page