openai / evals

Evals is a framework for evaluating LLMs and LLM systems, and an open-source registry of benchmarks.
Other
14.35k stars 2.54k forks source link

Added Quran Eval & Simple Fact Model-Graded Definition #1511

Open sakher opened 3 months ago

sakher commented 3 months ago

Thank you for contributing an eval! โ™ฅ๏ธ

๐Ÿšจ Please make sure your PR follows these guidelines, failure to follow the guidelines below will result in the PR being closed automatically. Note that even if the criteria are met, that does not guarantee the PR will be merged nor GPT-4 access be granted. ๐Ÿšจ

PLEASE READ THIS:

In order for a PR to be merged, it must fail on GPT-4. We are aware that right now, users do not have access, so you will not be able to tell if the eval fails or not. Please run your eval with GPT-3.5-Turbo, but keep in mind as we run the eval, if GPT-4 gets higher than 90% on the eval, we will likely reject it since GPT-4 is already capable of completing the task.

We plan to roll out a way for users submitting evals to see the eval performance on GPT-4 soon. Stay tuned! Until then, you will not be able to see the eval performance on GPT-4. Starting April 10, the minimum eval count is 15 samples, we hope this makes it easier to create and contribute evals.

Also, please note that we're using Git LFS for storing the JSON files, so please make sure that you move the JSON file to Git LFS before submitting a PR. Details on how to use Git LFS are available here.

Eval details ๐Ÿ“‘

Eval name

Eval Set: quran-evals: evals:

Eval description

This evaluation assesses the comprehension and memorization capabilities of language models regarding Quranic texts. It features four distinct question types: Surah (Chapter) Identification, Meccan vs. Madinan Chapter type Revelation, Quranic Text Recognition (amongst non-Quranic text distractors), and Fill in the Blank. Each type is designed to test the models' abilities to recall, contextualize, and accurately interpret religious texts, providing insights into their potential use in educational and scholarly domains.

What makes this a useful eval?

This eval is valuable because it addresses a niche yet significant area of language model application: religious texts comprehension. It goes beyond general knowledge queries to test specific, detailed understanding and memorization of Quranic verses, challenging the models in a unique way that standard benchmarks may not. Additionally, this evaluation offers a perspective on the sensitivity and respectfulness and exactness required when handling religious texts, contributing to the development of more nuanced and culturally aware AI systems.

Here is a short report alongside the run results with different configurations: https://sakher.notion.site/Using-OpenAI-Evals-for-Quranic-Text-Evaluation-06d8ca52d22449b4b7ac36f582c312e9

Criteria for a good eval โœ…

Below are some of the criteria we look for in a good eval. In general, we are seeking cases where the model does not do a good job despite being capable of generating a good response (note that there are some things large language models cannot do, so those would not make good evals).

Your eval should be:

If there is anything else that makes your eval worth including, please document it below.

Unique eval value

The creation of the this eval represents a unique and crucial endeavor within the sphere of AI language understanding, particularly in relation to the profound significance of the Quran in the lives of hundreds of millions of Muslims worldwide. It's noteworthy to acknowledge that the Quran is not just a religious text; it embodies a tradition of memorization that spans centuries, where individuals, including children under the age of ten, commit its entirety to memory with remarkable precision. This practice underscores the importance of the Quran's literal preservation, where even the slightest deviation from its text is considered unacceptable.

Given this context, it's striking to observe when advanced AI models like those developed by OpenAI struggle with tasks that are second nature to millions, such as accurately identifying the chapter (Surah) a verse (Aya) belongs to or completing a partially provided verse. This isn't just a measure of the models' technical capabilities but a reflection on their understanding of the Quran's critical and sacrosanct nature to the global Muslim community.

Furthermore, this evaluation holds the potential to shed light on the models' proficiency with the Arabic language, particularly the nuanced and diacritic-rich script of the Quranic and other formal Arabic texts. It brings to the forefront the challenges existing tokenization techniques face with Arabic and other non-Latin languages, urging a reevaluation and improvement in how these languages are processed.

Incorporating this evaluation into OpenAI's framework is not merely a step towards enhancing a model's performance in the Arabic language; it's an initiative towards fostering respect, precision, and cultural sensitivity in AI's handling of religious texts. It is a call to recognize and honor the profound tradition of Quranic preservation through the lens of AI, ensuring that these models can approach the Quran with the accuracy and reverence it demands. This effort is not just about improving tokenization or understanding nuances in languageโ€”it's about bridging AI's capabilities with the deep-rooted values and traditions of millions of people worldwide.

I am also working on other evals related to Arabic language and other similar aspects.

Eval structure ๐Ÿ—๏ธ

Your eval should

(For now, we will only be approving evals that use one of the existing eval classes. You may still write custom eval classes for your own cases, and we may consider merging them in the future.)

Final checklist ๐Ÿ‘€

Submission agreement

By contributing to Evals, you are agreeing to make your evaluation logic and data under the same MIT license as this repository. You must have adequate rights to upload any data used in an Eval. OpenAI reserves the right to use this data in future service improvements to our product. Contributions to OpenAI Evals will be subject to our usual Usage Policies (https://platform.openai.com/docs/usage-policies).

Email address validation

If your submission is accepted, we will be granting GPT-4 access to a limited number of contributors. Access will be given to the email address associated with the commits on the merged pull request.

Limited availability acknowledgment

We know that you might be excited to contribute to OpenAI's mission, help improve our models, and gain access to GPT-4. However, due to the requirements mentioned above and the high volume of submissions, we will not be able to accept all submissions and thus not grant everyone who opens a PR GPT-4 access. We know this is disappointing, but we hope to set the right expectation before you open this PR.

Submit eval

Failure to fill out all required fields will result in the PR being closed.

Eval JSON data

Since we are using Git LFS, we are asking eval submitters to add in as many Eval Samples (at least 5) from their contribution here:

View evals in JSON ### Eval ```jsonl {"input": [{"role": "system", "content": "Identify the Surah (in Arabic) of the following Quranic text: ุงู„ู†ูŽู‘ุงุฑู ุฐูŽุงุชู ุงู„ู’ูˆูŽู‚ููˆุฏู"}, {"role": "user", "content": "Please provide the answer, and ONLY the answer without any extra commentary"}], "ideal": "ุงู„ุจุฑูˆุฌ"} {"input": [{"role": "system", "content": "ุญุฏุฏ ุงุณู… ุงู„ุณูˆุฑุฉ ู„ู„ู†ุต ุงู„ู‚ุฑุขู†ูŠ ุงู„ุชุงู„ูŠ: ูˆูŽู„ูŽู‡ูŽุฏูŽูŠู’ู†ูŽุงู‡ูู…ู’ ุตูุฑูŽุงุทู‹ุง ู…ูุณู’ุชูŽู‚ููŠู…ู‹ุง"}, {"role": "user", "content": "ูŠุฑุฌู‰ ุชู‚ุฏูŠู… ุงู„ุฅุฌุงุจุฉ. ูˆูู‚ุท ุงู„ุฅุฌุงุจุฉ ุฏูˆู† ุฃูŠ ุชุนู„ูŠู‚ ุฅุถุงููŠ"}], "ideal": "ุงู„ู†ุณุงุก"} {"input": [{"role": "system", "content": "Determine if the Surah of the following Quranic aya text is meccan or madinan: ุงู„ู†ูŽู‘ุงุฑู ุฐูŽุงุชู ุงู„ู’ูˆูŽู‚ููˆุฏู answer only with either 'meccan' or 'madinan'"}, {"role": "user", "content": "Please provide the answer, and ONLY the answer without any extra commentary"}], "ideal": "meccan"} {"input": [{"role": "system", "content": "ุญุฏุฏ ุฅุฐุง ูƒุงู†ุช ุงู„ุณูˆุฑุฉ ู„ู„ู†ุต ุงู„ู‚ุฑุขู†ูŠ ุงู„ุชุงู„ูŠ ู…ูƒูŠุฉ ุฃูˆ ู…ุฏู†ูŠุฉ: ูŠูŽุชูŽู†ูŽุงุฒูŽุนููˆู†ูŽ ูููŠู‡ูŽุง ูƒูŽุฃู’ุณู‹ุง ู„ูŽุง ู„ูŽุบู’ูˆูŒ ูููŠู‡ูŽุง ูˆูŽู„ูŽุง ุชูŽุฃู’ุซููŠู…ูŒ ุฃุฌุจ ูู‚ุท ุจู€ 'ู…ูƒูŠุฉ' ุฃูˆ 'ู…ุฏู†ูŠุฉ'"}, {"role": "user", "content": "ูŠุฑุฌู‰ ุชู‚ุฏูŠู… ุงู„ุฅุฌุงุจุฉ. ูˆูู‚ุท ุงู„ุฅุฌุงุจุฉ ุฏูˆู† ุฃูŠ ุชุนู„ูŠู‚ ุฅุถุงููŠ"}], "ideal": "ู…ูƒูŠุฉ"} {"input": [{"role": "system", "content": "Which of the following is a text from the Quran? A. ู…ูŽู†ู’ ูŠูŽุฏู’ุนููˆ ุจูู‚ูŽู„ู’ุจู ุฎูŽุงุดูุนู ูููŠ ุธูู„ูŽู…ูŽุงุชู ุงู„ู„ูŽู‘ูŠู„ูุŒ ูŠูŽุฌูุฏู ู†ููˆุฑูŽ ุงู„ู’ุฅูุฌูŽุงุจูŽุฉู ูููŠ ููŽุฌู’ุฑู ุงู„ู’ุฃูŽู…ูŽู„ู; B. ุงู„ู’ุญูŽูŠูŽุงุฉู ุฏูŽุฑู’ุจูŒ ู…ูŽู…ู’ู„ููˆุกูŒ ุจูุงู„ุงุจู’ุชูู„ุงุกูุŒ ูˆูŽู„ูŽูƒูู†ูŽู‘ ู…ูŽุนูŽ ูƒูู„ูู‘ ุนูุณู’ุฑู ูŠูุณู’ุฑู‹ุง ู„ูู…ูŽู†ู’ ูŠูŽุตู’ุจูุฑู; C. ุงู„ู†ูŽู‘ุงุฑู ุฐูŽุงุชู ุงู„ู’ูˆูŽู‚ููˆุฏู; D. ูˆูŽู…ูŽู† ูŠูŽุชูŽูˆูŽูƒูŽู‘ู„ู’ ุนูŽู„ู‰ ุงู„ู„ู‡ู ููŽู‚ูŽุฏู’ ุงู‡ุชูŽุฏู‰ ุฅู„ู‰ ุทูŽุฑูŠู‚ู ู…ูุจูŠู†, please answer with the letter of the correct option (A, B, C, D) only"}, {"role": "user", "content": "Please provide the answer by selecting the correct letter (A, B, C, or D) without any extra commentary"}], "ideal": "C"} {"input": [{"role": "system", "content": "ุฃูŠ ู…ู† ุงู„ุชุงู„ูŠ ู‡ูˆ ู†ุต ู…ู† ุงู„ู‚ุฑุขู†ุŸ A. ูˆูŽู…ูู† ุฏูุนุงุกู ุงู„ู„ูŽู‘ูŠู„ู ููŽู‡ููˆูŽ ู‚ูุฑุจุงู†ูŒ ู„ูุฑุจูู‘ูƒูู…ุŒ ูˆูŽู†ููˆุฑูŒ ูŠูŽู‚ุทูŽุนู ุธูู„ู…ุฉูŽ ุงู„ุดูŽู‘ูƒู; B. ุงุนู’ู„ูŽู…ููˆุง ุฃูŽู†ูŽู‘ ูููŠ ุงู„ุตูŽู‘ุจู’ุฑู ุนูŽู„ูŽู‰ ุงู„ู’ู…ูุตูŽุงุฆูุจู ุชูŽุฒู’ูƒููŠูŽุฉูŒ ู„ูู„ู†ูู‘ูููˆุณูุŒ ูˆูŽู‚ูุฑู’ุจูŒ ู…ูู†ูŽ ุงู„ู’ุฎูŽุงู„ูู‚ู; C. ูƒูŽุฃูŽู†ูŽู‘ู‡ูู…ู’ ูŠูŽูˆู’ู…ูŽ ูŠูŽุฑูŽูˆู’ู†ูŽู‡ูŽุง ู„ูŽู…ู’ ูŠูŽู„ู’ุจูŽุซููˆุง ุฅูู„ูŽู‘ุง ุนูŽุดููŠูŽู‘ุฉู‹ ุฃูŽูˆู’ ุถูุญูŽุงู‡ูŽุง; D. ูˆูŽูŠูŽุจู’ุนูŽุซู ุงู„ู„ูŽู‘ู‡ู ุงู„ุฑูู‘ูŠูŽุงุญูŽ ุจูุดู’ุฑูŽู‰ู‹ ู‚ูŽุจู’ู„ูŽ ุฑูŽุญู’ู…ูŽุชูู‡ูุŒ ู…ูŽุงุกู‹ ูŠูุญู’ูŠููŠ ุงู„ุฃูŽุฑู’ุถูŽ ุจูŽุนู’ุฏูŽ ู…ูŽูˆู’ุชูู‡ูŽุง, ูŠุฑุฌู‰ ุงู„ุฅุฌุงุจุฉ ุจุญุฑู ุงู„ุฎูŠุงุฑ ุงู„ุตุญูŠุญ (A, B, C, D) ูู‚ุท"}, {"role": "user", "content": "ูŠุฑุฌู‰ ุชู‚ุฏูŠู… ุงู„ุฅุฌุงุจุฉ. ูˆูู‚ุท ุงู„ุฅุฌุงุจุฉ ุฏูˆู† ุฃูŠ ุชุนู„ูŠู‚ ุฅุถุงููŠ"}], "ideal": "C"} {"input": [{"role": "system", "content": "Fill in the blank of the following Quranic text: ((________ ุฐูŽุงุชู ุงู„ู’ูˆูŽู‚ููˆุฏู)) to complete the full verse. This text is from Surah ุงู„ุจุฑูˆุฌ (Chapter 85, Verse 5).. The answer may be one or more words."}, {"role": "user", "content": "Please provide the answer, and ONLY the answer without any extra commentary"}], "ideal": "ุงู„ู†ูŽู‘ุงุฑู"} {"input": [{"role": "system", "content": "Fill in the blank of the following Quranic text: ((ูˆูŽู…ูŽุง ู†ูŽู‚ูŽู…ููˆุง ู…ูู†ู’ู‡ูู…ู’ ุฅูู„ูŽู‘ุง ________)) to complete the full verse.. The answer may be one or more words."}, {"role": "user", "content": "Please provide the answer, and ONLY the answer without any extra commentary"}], "ideal": "ุฃูŽู†ู’ ูŠูุคู’ู…ูู†ููˆุง ุจูุงู„ู„ูŽู‘ู‡ู ุงู„ู’ุนูŽุฒููŠุฒู ุงู„ู’ุญูŽู…ููŠุฏู"} {"input": [{"role": "system", "content": "ุงู…ู„ุฃ ุงู„ูุฑุงุบ ููŠ ุงู„ู†ุต ุงู„ู‚ุฑุขู†ูŠ ุงู„ุชุงู„ูŠ: ((ูŠูŽุชูŽู†ูŽุงุฒูŽุนููˆู†ูŽ ________)) ู„ุฅุชู…ุงู… ุงู„ุขูŠุฉ ูƒุงู…ู„ุฉ. ู‡ุฐุง ุงู„ู†ุต ุงู„ู‚ุฑุขู†ูŠ ู…ู† ุณูˆุฑุฉ ุงู„ุทูˆุฑ (ุงู„ุณูˆุฑุฉ 52ุŒ ุงู„ุขูŠุฉ 23).. ู‚ุฏ ุชูƒูˆู† ุงู„ุฅุฌุงุจุฉ ุนุจุงุฑุฉ ุนู† ูƒู„ู…ุฉ ูˆุงุญุฏุฉ ุฃูˆ ุฃูƒุซุฑ."}, {"role": "user", "content": "ูŠุฑุฌู‰ ุชู‚ุฏูŠู… ุงู„ุฅุฌุงุจุฉ. ูˆูู‚ุท ุงู„ุฅุฌุงุจุฉ ุฏูˆู† ุฃูŠ ุชุนู„ูŠู‚ ุฅุถุงููŠ"}], "ideal": "ูููŠู‡ูŽุง ูƒูŽุฃู’ุณู‹ุง ู„ูŽุง ู„ูŽุบู’ูˆูŒ ูููŠู‡ูŽุง ูˆูŽู„ูŽุง ุชูŽุฃู’ุซููŠู…ูŒ"} {"input": [{"role": "system", "content": "ุงู…ู„ุฃ ุงู„ูุฑุงุบ ููŠ ุงู„ู†ุต ุงู„ู‚ุฑุขู†ูŠ ุงู„ุชุงู„ูŠ: ((________ ุนูŽุฐูŽุงุจูŽ ุฑูŽุจูู‘ูƒูŽ ู„ูŽูˆูŽุงู‚ูุนูŒ)) ู„ุฅุชู…ุงู… ุงู„ุขูŠุฉ ูƒุงู…ู„ุฉ.. ู‚ุฏ ุชูƒูˆู† ุงู„ุฅุฌุงุจุฉ ุนุจุงุฑุฉ ุนู† ูƒู„ู…ุฉ ูˆุงุญุฏุฉ ุฃูˆ ุฃูƒุซุฑ."}, {"role": "user", "content": "ูŠุฑุฌู‰ ุชู‚ุฏูŠู… ุงู„ุฅุฌุงุจุฉ. ูˆูู‚ุท ุงู„ุฅุฌุงุจุฉ ุฏูˆู† ุฃูŠ ุชุนู„ูŠู‚ ุฅุถุงููŠ"}], "ideal": "ุฅูู†ูŽู‘"} ```
sakher commented 2 months ago

I've made the code for generating this eval public to aid with reviewing this PR.

https://github.com/sakher/open-ai-quran-eval-generation

Thanks in advance!

sakher commented 2 months ago

@andrew-openai @etr2460 @katyhshi

Is there anything I can do to help aiding the review of this PR? I appreciate that it is from a domain and a language that can be challenging to review.

I made the repo for the generation public which contains some hopefully useful comments - and happy to do more.

sakher commented 1 month ago
  1. The "ModelGraded" evaluation method isn't suitable for this kind of prompt. That method is used when there is a subjective answer to a prompt. For these evals, the "Match" or "Include" evaluation method should be used.
  2. When using the "Match" or "Include" evaluation method, the ideal answer should be a list of possible answers, i.e., the ideal answer should contain the correct answer with all possible variations, like "ideal": ["ุณุจุงุก","ุณูŽุจูŽุงุก"]. Also, add instructions to provide an answer without airaab to avoid any mismatch between the model-provided answer and the ideal answer.

I agree that ModelGraded is an overkill for guess_surah_name and guess_surah_type, as well as guess which text is quranic and that match or include would give very similar results, much cheaper. But the as for the latest eval (guess masked text), I have done many tests, the model guided is much better in spotting mistakes that can seem simple (e.g. differences in diacritics that severely change the meaning). Also, you can't really include add all possible variations given the model can output more or less diacritics while keeping the meaning valid. I will make the changes and test and report the results.

EDIT 1: After looking into the guess_sourah_name - the variations are too many to capture in the list of potential ideal answers, and I think keeping model-guided is warranted, for example, we need to account for the following cases:

I will change the guess_sourah_type and guess_which_text_is_from_quran to include but will keep the others as model-guided, I hope you don't mind.

sakher commented 1 month ago

@usama-openai - I have done all of the changes and updated the documentation about the results (including the raw results and log files) here: https://sakher.notion.site/Using-OpenAI-Evals-for-Quranic-Text-Evaluation-06d8ca52d22449b4b7ac36f582c312e9

As mentioned earlier, I have changed the evaluation method only for 2 of the 4 evals to use 'includes' instead of 'model-guided'. I hope this works!

P.S. I applied for some credits via the research program earlier but didn't get any response, this is largely self-funded. I would appreciate if you can help with this! Also, I am very keen to help improving evaluation and training on the Arabic language; if you guys have any valuable evals in mind, please let me know (I have a few I am looking into already).

And sorry for bundling a few changes in one PR - I am more than happy to separate if you prefer.

sakher commented 2 weeks ago

The PR looks in good shape now. Kindly keep only evaluation-related changes in this PR and create a new PR for GPT-4o-related changes.

Thanks @usama-openai - I removed all code changes related to adding gpt-4o (my changes have been incorporated into another PR https://github.com/openai/evals/pull/1530 which I reviewed and happy with).

Kindly look into this once you have a second.

sakher commented 2 weeks ago

I have a few evals in mind to add related to Arabic language - but wanted to ensure that they would be valuable and likely accepted before putting the effort - is there a way to communicate with the evals team at OpenAI (e.g. chat or email)? Happy to provide my email here if needed.

sakher commented 1 week ago

@usama-openai - the unit tests fail on this PR as well as on main (not sure why they are being skipped for some other recent PRs!). I created an issue and a PR to resolve all unit test failures: https://github.com/openai/evals/pull/1537

Please merge the fix, once done, I will rebase into this PR and re-run the unit tests which hopefully would make this eval ready to merge.