Chapter 3. Evaluating the model
If you want to measure the improvements of your new model, you can compare its performance to the base model with the evaluation process. You can also chat with the model directly to qualitatively identify whether the new model has learned the knowledge you created. If you want more quantitative results of the model improvements, you can run the evaluation process in the RHEL AI CLI.
3.1. Evaluating your new model Copy linkLink copied to clipboard!
You can run the evaluation process in the RHEL AI CLI with the following procedure.
Prerequisites
- You installed RHEL AI with the bootable container image.
-
You created a custom
qna.yamlfile with skills or knowledge. - You ran the synthetic data generation process.
- You trained the model using the RHEL AI training process.
-
You downloaded the
prometheus-8x7b-v2-0judge model. - You have root user access on your machine.
Procedure
-
Navigate to your working Git branch where you created your
qna.yamlfile. You can now run the evaluation process on different benchmarks. Each command needs the path to the trained
samplesmodel to evaluate, you can access these checkpoints in your~/.local/share/instructlab/checkpointsfolder.MMLU_BRANCH benchmark - If you want to measure how your knowledge contributions have impacted your model, run the
mmlu_branchbenchmark by executing the following command:ilab model evaluate --benchmark mmlu_branch --model ~/.local/share/instructlab/phased/phase2/checkpoints/hf_format/<checkpoint> \ --tasks-dir ~/.local/share/instructlab/datasets/<generation-date>/<node-dataset> \ --base-model ~/.cache/instructlab/models/granite-7b-starter$ ilab model evaluate --benchmark mmlu_branch --model ~/.local/share/instructlab/phased/phase2/checkpoints/hf_format/<checkpoint> \ --tasks-dir ~/.local/share/instructlab/datasets/<generation-date>/<node-dataset> \ --base-model ~/.cache/instructlab/models/granite-7b-starterCopy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <checkpoint>
- Specify the best scored checkpoint file generated during multi-phase training
- <node-dataset>
Specify the
node_datasetsdirectory that was generated during SDG, in the~/.local/share/instructlab/datasets/<generation-date>directory, with the same timestamps as the.jsonl files used for training the model.Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
MT_BENCH_BRANCH benchmark - If you want to measure how your skills contributions have impacted your model, run the
mt_bench_branchbenchmark by executing the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <checkpoint>
- Specify the best scored checkpoint file generated during multi-phase training.
- <worker-branch>
- Specify the branch you used when adding data to your taxonomy tree.
- <num-gpus>
Specify the number of GPUs you want to use for evaluation.
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Optional: You can manually evaluate each checkpoint using the MMLU and MT_BENCH benchmarks. You can evaluate any model against the standardized set of knowledge or skills, allowing you to compare the scores of your own model against other LLMs.
MMLU - If you want to see the evaluation score of your new model against a standardized set of knowledge data, set the
mmlubenchmark by running the following command:ilab model evaluate --benchmark mmlu --model ~/.local/share/instructlab/phased/phase2/checkpoints/hf_format/samples_665 --skip-server
$ ilab model evaluate --benchmark mmlu --model ~/.local/share/instructlab/phased/phase2/checkpoints/hf_format/samples_665 --skip-serverCopy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <checkpoint>
Specify one of the checkpoint files generated during multi-phase training.
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
MT_BENCH - If you want to see the evaluation score of your new model against a standardized set of skills, set the
mt_benchbenchmark by running the following command:ilab model evaluate --benchmark mt_bench --model ~/.local/share/instructlab/phased/phases2/checkpoints/hf_format/samples_665
$ ilab model evaluate --benchmark mt_bench --model ~/.local/share/instructlab/phased/phases2/checkpoints/hf_format/samples_665Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <checkpoint>
Specify one of the checkpoint files generated during multi-phase training.
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.1. Domain-Knowledge benchmark evaluation Copy linkLink copied to clipboard!
Domain-Knowledge benchmark evaluation is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
The current knowledge evaluation benchmark in RHEL AI, MMLU and MMLU_branch, evaluates models on their ability to answer multiple choice questions. There was no way to give the model credit on moderately correct or incorrect answers.
The Domain-Knowledge benchmark (DK-bench) evaluation provides the ability to bring custom evaluation questions and score the models answers on a scale.
Each response given is compared to the reference answer and graded on the following scale by the judge model:
| Score | Criteria |
|---|---|
| 1 | The response is entirely incorrect, irrelevant, or does not align with the reference in any meaningful way. |
| 2 | The response partially matches the reference but contains major errors, significant omissions, or irrelevant information. |
| 3 | The response aligns with the reference overall but lacks sufficient detail, clarity, or contains minor inaccuracies. |
| 4 | The response is mostly accurate, aligns closely with the reference, and contains only minor issues or omissions. |
| 5 | The response is fully accurate, completely aligns with the reference, and is clear, thorough, and detailed. |
Prerequisites
- You installed RHEL AI with the bootable container image.
- You trained the model using the RHEL AI training process.
- You downloaded the prometheus-8x7b-v2-0 judge model.
- You have root user access on your machine.
Procedure
To utilize custom evaluation, you must create a
jsonlfile that includes every question you want to ask a model to answer and evaluate.Example DK-bench
jsonlfile{"user_input":"What is the capital of Canada?","reference":"The capital of Canada is Ottawa."}{"user_input":"What is the capital of Canada?","reference":"The capital of Canada is Ottawa."}Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- user_input
- Contains the question for the model.
- reference
- Contains the answer to the question.
To run the DK-bench benchmark with your custom evaluation questions, run the following command:
ilab model evaluate --benchmark dk_bench --input-questions <path-to-jsonl-file> --model <path-to-model>
$ ilab model evaluate --benchmark dk_bench --input-questions <path-to-jsonl-file> --model <path-to-model>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
- <path-to-jsonl-file>
-
Specify the path to your
jsonlfile that contains your questions and answers. - <path-to-model>
Specify the path to the model you want to evaluate.
Example command
ilab model evaluate --benchmark dk_bench --input-questions /home/use/path/to/questions.jsonl --model ~/.cache/instructlab/models/instructlab/granite-7b-lab
$ ilab model evaluate --benchmark dk_bench --input-questions /home/use/path/to/questions.jsonl --model ~/.cache/instructlab/models/instructlab/granite-7b-labCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of domain-Knowledge benchmark evaluation
Copy to Clipboard Copied! Toggle word wrap Toggle overflow