mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-08-31 03:50:23 +00:00
26 lines
898 B
Markdown
26 lines
898 B
Markdown
![]() |
# Chapter 7: Instruction and Preference Finetuning
|
||
|
|
||
|
This folder contains utility code that can be used for model evaluation.
|
||
|
|
||
|
Install the additional package requirements via:
|
||
|
|
||
|
```bash
|
||
|
pip install -r requirements-extra.txt
|
||
|
```
|
||
|
|
||
|
|
||
|
|
||
|
## Evaluating Instruction Responses Using the OpenAI API
|
||
|
|
||
|
- The [llm-instruction-eval-openai.ipynb](llm-instruction-eval-openai.ipynb) notebook uses OpenAI's GPT-4 to evaluate responses generated by instruction finetuned models. It works with a JSON file in the following format:
|
||
|
|
||
|
```python
|
||
|
{
|
||
|
"instruction": "What is the atomic number of helium?",
|
||
|
"input": "",
|
||
|
"output": "The atomic number of helium is 2.", # <-- The target given in the test set
|
||
|
"model 1 response": "\nThe atomic number of helium is 2.0.", # <-- Response by an LLM
|
||
|
"model 2 response": "\nThe atomic number of helium is 3." # <-- Response by a 2nd LLM
|
||
|
},
|
||
|
```
|