Skip to main content

Evaluation

Project description

eval

Lint Build Release License

Python Library for Evaluation

What is Evaluation?

Evaluation allows us to assess how a given model is performing against a set of specific tasks. This is done by running a set of standardized benchmark tests against the model. Running evaluation produces numerical scores across these various benchmarks, as well as logs excerpts/samples of the outputs the model produced during these benchmarks. Using a combination of these artifacts as reference, along with a manual smoke test, allows us to get the best idea about whether or not a model has learned and improved on something we are trying to teach it. There are 2 stages of model evaluation in the InstructLab process:

Inter-checkpoint Evaluation

This step occurs during multi-phase training. Each phase of training produces multiple different “checkpoints” of the model that are taken at various stages during the phase. At the end of each phase, we evaluate all the checkpoints in order to find the one that provides the best results. This is done as part of the InstructLab Training library.

Full-scale final Evaluation

Once training is complete, and we have picked the best checkpoint from the output of the final phase, we can run full-scale evaluation suite which runs MT-Bench, MMLU, MT-Bench Branch and MMLU Branch.

Methods of Evaluation

Below are more in-depth explanations of the suite of benchmarks we are using as methods for evaluation of models.

Multi-turn benchmark (MT-Bench)

tl;dr Full model evaluation of performance on skills

MT-Bench is a type of benchmarking that involves asking a model 80 multi-turn questions - i.e.

<Question 1> → <model’s answer 1> → <Follow-up question> → <model’s answer 2>

A “judge” model reviews the given multi-turn question, the provided model answer, and rate the answer with a score out of 10. The scores are then averaged out and the final score produced is the “MT-bench score” for that model. This benchmark assumes no factual knowledge on the model’s part. The questions are static, but do not get obsolete with time.

You can read more about MT-Bench here

MT-Bench Branch

MT-Bench Branch is an adaptation of MT-Bench that is designed to test custom skills that are added to the model with the InstructLab project. These new skills come in the form of question/answer pairs in a Git branch of the taxonomy.

MT-Bench Branch uses the user supplied seed questions to have the candidate model generate answers to, which are then judged by the judge model using the user supplied seed answers as a reference.

Massive Multitask Language Understanding (MMLU)

tl;dr Full model evaluation of performance on knowledge

MMLU is a type of benchmarking that involves a series of fact-based multiple choice questions, along with 4 options for answers. It tests if a model is able to interpret the questions correctly, along the answers, formulate its own answer, then selects the correct option out of the provided ones. The questions are designed as a set of 57 “tasks”, and each task has a given domain. The domains cover a number of topics ranging from Chemistry and Biology to US History and Math.

The performance number is then compared against the set of known correct answers for each question to determine how many the model got right. The final MMLU score is the average of its scores. This benchmark does not involve any reference/critic model, and is a completely objective benchmark. This benchmark does assume factual knowledge on the model’s part. The questions are static, therefore MMLU cannot be used to gauge the model’s knowledge on more recent topics.

InstructLab uses an implementation found here for running MMLU.

You can read more about MMLU here

MMLU Branch

MMLU Branch is an adaptation of MMLU that is designed to test custom knowledge that is being added to the model via a Git branch of the taxonomy.

A teacher model is used to generate new multiple choice questions based on the knowledge document included in the taxonomy Git branch. A “task” is then constructed that references the newly generated answer choices. These tasks are then used to score the model’s grasp on new knowledge the same way MMLU works. Generation of these tasks are done as part of the InstructLab SDG library.

MT-Bench / MT-Bench Branch Testing Steps

⚠️ Note: Must use Python version 3.10 or later.

# Optional: Use cloud-instance.sh (https://github.com/instructlab/instructlab/tree/main/scripts/infra) to launch and setup the instance
scripts/infra/cloud-instance.sh ec2 launch -t g5.4xlarge
scripts/infra/cloud-instance.sh ec2 setup-rh-devenv
scripts/infra/cloud-instance.sh ec2 install-rh-nvidia-drivers
scripts/infra/cloud-instance.sh ec2 ssh sudo reboot
scripts/infra/cloud-instance.sh ec2 ssh


# Regardless of how you setup your instance
git clone https://github.com/instructlab/taxonomy.git && pushd taxonomy && git branch rc && popd
git clone --bare https://github.com/instructlab/eval.git && git clone eval.git/ && cd eval && git remote add syncrepo ../eval.git
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
pip install vllm
python -m vllm.entrypoints.openai.api_server --model instructlab/granite-7b-lab --tensor-parallel-size 1

In another shell window

export INSTRUCTLAB_EVAL_FIRST_N_QUESTIONS=10 # Optional if you want to shorten run times
# Commands relative to eval directory
python3 tests/test_gen_answers.py
python3 tests/test_branch_gen_answers.py

Example output tree

eval_output/
├── mt_bench
│   └── model_answer
│       └── instructlab
│           └── granite-7b-lab.jsonl
└── mt_bench_branch
    ├── main
       ├── model_answer
          └── instructlab
              └── granite-7b-lab.jsonl
       ├── question.jsonl
       └── reference_answer
           └── instructlab
               └── granite-7b-lab.jsonl
    └── rc
        ├── model_answer
           └── instructlab
               └── granite-7b-lab.jsonl
        ├── question.jsonl
        └── reference_answer
            └── instructlab
                └── granite-7b-lab.jsonl
python3 tests/test_judge_answers.py
python3 tests/test_branch_judge_answers.py

Example output tree

eval_output/
├── mt_bench
│   ├── model_answer
│      └── instructlab
│          └── granite-7b-lab.jsonl
│   └── model_judgment
│       └── instructlab
│           └── granite-7b-lab_single.jsonl
└── mt_bench_branch
    ├── main
       ├── model_answer
          └── instructlab
              └── granite-7b-lab.jsonl
       ├── model_judgment
          └── instructlab
              └── granite-7b-lab_single.jsonl
       ├── question.jsonl
       └── reference_answer
           └── instructlab
               └── granite-7b-lab.jsonl
    └── rc
        ├── model_answer
           └── instructlab
               └── granite-7b-lab.jsonl
        ├── model_judgment
           └── instructlab
               └── granite-7b-lab_single.jsonl
        ├── question.jsonl
        └── reference_answer
            └── instructlab
                └── granite-7b-lab.jsonl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instructlab_eval-0.3.0.tar.gz (100.9 kB view details)

Uploaded Source

Built Distribution

instructlab_eval-0.3.0-py3-none-any.whl (65.3 kB view details)

Uploaded Python 3

File details

Details for the file instructlab_eval-0.3.0.tar.gz.

File metadata

  • Download URL: instructlab_eval-0.3.0.tar.gz
  • Upload date:
  • Size: 100.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for instructlab_eval-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d7e355ca67e7639cd8f2e35950618d885c141ef9e3857e9b96074e0ce14e8a3b
MD5 431d23c517d1d8c7de794a06b54bdd24
BLAKE2b-256 d7c739626a2659ffa1cf99ab45badafb8d26f540cdfcdb9e9e85e2cdced2830d

See more details on using hashes here.

File details

Details for the file instructlab_eval-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for instructlab_eval-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abc7c3f71f0c6cb9ec802f18bd4dc78e5d25557b918be74ad49df0d86d655fec
MD5 d0579366c46cd82250b13b48a1c40f40
BLAKE2b-256 dc42fe05f901867c72090842cffae48de4e38e0594effa34c05efb369f3dee9b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page