Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
from dataclasses import dataclass | |
from enum import Enum | |
class Task: | |
benchmark: str | |
metric: str | |
col_name: str | |
class Language: | |
col_name: str | |
ln_abb: str | |
bele_abb: str | |
# Init: to update with your specific keys | |
class Tasks(Enum): | |
# task_key in the json file, metric_key in the json file, name to display in the leaderboard | |
task0 = Task("harness|arc_challenge|25", "acc_norm,none", "🇬🇧ARC EN") | |
task1 = Task("harness|truthfulqa_mc2|0", "acc,none", "🇬🇧TruthfulQA EN") | |
task2 = Task("harness|belebele_eng_Latn|5", "acc_norm,none", "🇬🇧Belebele EN") | |
task3 = Task("harness|hellaswag|10", "acc,none", "🇬🇧HellaSwag EN") | |
task4 = Task("harness|hendrycksTest|5", "acc,none", "🇬🇧MMLU EN") | |
task5 = Task("harness|arc_challenge_m_de|25", "acc_norm,none", "🇩🇪ARC DE") | |
task6 = Task("harness|truthfulqa_mc2_m_de|0", "acc,none", "🇩🇪TruthfulQA DE") | |
task7 = Task("harness|belebele_deu_Latn|5", "acc_norm,none", "🇩🇪Belebele DE") | |
task8 = Task("harness|hellaswag_de|10", "acc_norm,none", "🇩🇪HellaSwag DE") | |
task9 = Task("harness|mmlu_m_de|5", "acc,none", "🇩🇪MMLU DE") | |
task10 = Task("harness|arc_challenge_m_fr|25", "acc_norm,none", "🇫🇷ARC FR") | |
task11 = Task("harness|truthfulqa_mc2_m_fr|0", "acc,none", "🇫🇷TruthfulQA FR") | |
task12 = Task("harness|belebele_fra_Latn|5", "acc_norm,none", "🇫🇷Belebele FR") | |
task13 = Task("harness|hellaswag_fr|10", "acc_norm,none", "🇫🇷HellaSwag FR") | |
task14 = Task("harness|mmlu_m_fr|5", "acc,none", "🇫🇷MMLU FR") | |
task15 = Task("harness|arc_challenge_m_it|25", "acc_norm,none", "🇮🇹ARC IT") | |
task16 = Task("harness|truthfulqa_mc2_m_it|0", "acc,none", "🇮🇹TruthfulQA IT") | |
task17 = Task("harness|belebele_ita_Latn|5", "acc_norm,none", "🇮🇹Belebele IT") | |
task18 = Task("harness|hellaswag_it|10", "acc_norm,none", "🇮🇹HellaSwag IT") | |
task19 = Task("harness|mmlu_m_it|5", "acc,none", "🇮🇹MMLU IT") | |
task20 = Task("harness|arc_challenge_m_es|25", "acc_norm,none", "🇪🇸ARC ES") | |
task21 = Task("harness|truthfulqa_mc2_m_es|0", "acc,none", "🇪🇸TruthfulQA ES") | |
task22 = Task("harness|belebele_spa_Latn|5", "acc_norm,none", "🇪🇸Belebele ES") | |
task23 = Task("harness|hellaswag_es|10", "acc_norm,none", "🇪🇸HellaSwag ES") | |
task24 = Task("harness|mmlu_m_es|5", "acc,none", "🇪🇸MMLU ES") | |
# add a new benchmark group for the language | |
task25 = Task("harness|mmlu_m_nl|5", "acc,none", "🇳🇱MMLU NL") | |
task26 = Task("harness|arc_challenge_m_nl|25", "acc_norm,none", "🇳🇱ARC NL") | |
task27 = Task("harness|truthfulqa_mc2_m_nl|0", "acc,none", "🇳🇱TruthfulQA NL") | |
task28 = Task("harness|belebele_nld_Latn|5", "acc_norm,none", "🇳🇱Belebele NL") | |
task29 = Task("harness|hellaswag_nl|10", "acc_norm,none", "🇳🇱HellaSwag NL") | |
class Languages(Enum): | |
lng0 = Language("🇩🇪 DE", "de", "deu") | |
lng1 = Language("🇫🇷 FR", "fr", "fra") | |
lng2 = Language("🇮🇹 IT", "it", "ita") | |
lng3 = Language("🇪🇸 ES", "es", "spa") | |
lng4 = Language("🇬🇧 EN", "", "eng") | |
# add a new language | |
lng5 = Language("🇳🇱 NL", "nl", "nld") | |
# Your leaderboard name | |
TITLE = """<h1 align="center" id="space-title">Occiglot Euro LLM Leaderboard</h1>""" | |
# What does your leaderboard evaluate? | |
INTRODUCTION_TEXT = """ | |
<div border="2px"> | |
<p style="float: left;"><img src="https://huggingface.co/datasets/malteos/images/resolve/main/occiglot.medium.png" alt="Image" style="width:200px; margin-right:10px;" border="2px"/></p> | |
<p border="2px">The Occiglot euro LLM leaderboard evaluates a subset of the tasks from the <a href="https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard" target="_blank">Open LLM Leaderboard</a> machine-translated into the four main languages from the <a href="https://github.com/nlp-uoregon/Okapi" target="_blank">Okapi benchmark</a> and <a href="https://arxiv.org/abs/2308.16884" target="_blank">Belebele </a> (French, Italian, German, Spanish and Dutch). | |
The translated tasks are uploaded to a fork of the great [Eleuther AI Language Model Evaluation Harness](https://github.com/occiglot/euro-lm-evaluation-harness). | |
**UPDATE**: We added a Dutch benchmark to the leaderboard. From now on all models will also be evaluated on Dutch (🇳🇱) benchmarks. However, for better comparison, we exclude those results for now from the Average results. | |
Disclaimer: A language is not represented by a country. Different languages can be spoken and spread in all countries around the globe. For the sake of simplicity, we have used flag emojis (🇬🇧🇮🇹🇫🇷🇪🇸🇩🇪🇳🇱) to represent the language, not the countries.</p> | |
</div> | |
""" | |
# Which evaluations are you running? how can people reproduce what you have? | |
LLM_BENCHMARKS_TEXT = """ | |
## ABOUT | |
Disclaimer: This is a copy of the [Open LLM Leaderbaord](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) from Huggingface with the extension of the translated benchmarks. | |
With the plethora of large language models (LLMs) and chatbots being released week upon week, often with grandiose claims of their performance, it can be hard to filter out the genuine progress that is being made by the open-source community and which model is the current state of the art. | |
🤗 Submit a model for automated evaluation on the 🤗 GPU cluster on the "Submit" page! | |
The leaderboard's backend runs the great [Eleuther AI Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) - read more details below! | |
### Tasks | |
📈 We evaluate models on 5 key benchmarks using a fork of the <a href="https://github.com/EleutherAI/lm-evaluation-harness" target="_blank"> Eleuther AI Language Model Evaluation Harness </a>, a unified framework to test generative language models on a large number of different evaluation tasks. | |
- <a href="https://arxiv.org/abs/1803.05457" target="_blank"> AI2 Reasoning Challenge </a> (25-shot) - a set of grade-school science questions. | |
- <a href="https://arxiv.org/abs/1905.07830" target="_blank"> HellaSwag </a> (10-shot) - a test of commonsense inference, which is easy for humans (~95%) but challenging for SOTA models. | |
- <a href="https://arxiv.org/abs/2009.03300" target="_blank"> MMLU </a> (5-shot) - a test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more. | |
- <a href="https://arxiv.org/abs/2109.07958" target="_blank"> TruthfulQA </a> (0-shot) - a test to measure a model's propensity to reproduce falsehoods commonly found online. Note: TruthfulQA is technically a 6-shot task in the Harness because each example is prepended with 6 Q/A pairs, even in the 0-shot setting. | |
- <a href="https://arxiv.org/abs/2308.16884" target="_blank"> Belebele </a> (5-shot) - a multilingual multiple-choice machine reading comprehension dataset derived from FLORES-200. It evaluates and compares language model performance across 122 languages. | |
For all these evaluations, a higher score is a better score. | |
We chose these benchmarks based on the og Leaderboard from [Huggingface](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) (+Belebele 👀). | |
We used translations of the first 4 benchmarks from the <a href="https://arxiv.org/abs/2308.16884" target="_blank">Evaluation Framework for Multilingual Large Language Models </a> which was released as a part of the <a href="https://arxiv.org/abs/2307.16039" target="_blank"> Okapi </a> framework: a benchmark for multilingual large language models (LLMs) of <a href="https://arxiv.org/abs/1803.05457" target="_blank"> AI2 Reasoning Challenge </a>, <a href="https://arxiv.org/abs/1905.07830" target="_blank"> HellaSwag </a>, <a href="https://arxiv.org/abs/2109.07958" target="_blank"> TruthfulQA </a>, and <a href="https://arxiv.org/abs/2009.03300" target="_blank"> MMLU </a>. | |
### Results | |
You can find: | |
- detailed numerical results in the `results` Hugging Face dataset: https://huggingface.co/datasets/occiglot/euro-llm-leaderboard-results | |
- details on the input/outputs for the models in the `details` of each model, which you can access by clicking the 📄 emoji after the model name | |
- community queries and running status in the `requests` Hugging Face dataset: https://huggingface.co/datasets/occiglot/euro-llm-leaderboard-requests | |
If a model's name contains "Flagged", this indicates it has been flagged by the community, and should probably be ignored! Clicking the link will redirect you to the discussion about the model. | |
--------------------------- | |
## REPRODUCIBILITY | |
To reproduce our results, here are the commands you can run, using [this version](https://github.com/occiglot/euro-lm-evaluation-harness) of fork of the Eleuther AI Harness: | |
`python main.py --model hf --model_args "pretrained=<your_model>" --tasks <task_list> --num_fewshot <n_few_shot> --batch_size auto:4` | |
``` | |
python main.py --model=hf-causal-experimental \ | |
--model_args="pretrained=<your_model>" \ | |
--tasks=<task_list> \ | |
--num_fewshot=<n_few_shot> \ | |
--batch_size=auto:4 \ | |
--output_path=<output_path> | |
``` | |
**Note:** We evaluate all models on a single node of one H100/A100-80GB. | |
*You can expect results to vary slightly for different batch sizes because of padding.* | |
The tasks and few shots parameters are: | |
- ARC: 25-shot, *arc-challenge,arc-challenge_m_de,arc-challenge_m_es,arc-challenge_m_it,arc-challenge_m_fr* (`acc_norm`) | |
- HellaSwag: 10-shot, *hellaswag,hellaswag_es,hellaswag_it,hellaswag_fr,hellaswag_de* (`acc_norm`) | |
- TruthfulQA: 0-shot, *truthfulqa-mc,truthfulqa_mc2_m_de,truthfulqa_mc2_m_fr,truthfulqa_mc2_m_es,truthfulqa_mc2_m_it* (`mc2`) | |
- MMLU: 5-shot, *hendrycksTest-abstract_algebra,hendrycksTest-anatomy,hendrycksTest-astronomy,hendrycksTest-business_ethics,hendrycksTest-clinical_knowledge,hendrycksTest-college_biology,hendrycksTest-college_chemistry,hendrycksTest-college_computer_science,hendrycksTest-college_mathematics,hendrycksTest-college_medicine,hendrycksTest-college_physics,hendrycksTest-computer_security,hendrycksTest-conceptual_physics,hendrycksTest-econometrics,hendrycksTest-electrical_engineering,hendrycksTest-elementary_mathematics,hendrycksTest-formal_logic,hendrycksTest-global_facts,hendrycksTest-high_school_biology,hendrycksTest-high_school_chemistry,hendrycksTest-high_school_computer_science,hendrycksTest-high_school_european_history,hendrycksTest-high_school_geography,hendrycksTest-high_school_government_and_politics,hendrycksTest-high_school_macroeconomics,hendrycksTest-high_school_mathematics,hendrycksTest-high_school_microeconomics,hendrycksTest-high_school_physics,hendrycksTest-high_school_psychology,hendrycksTest-high_school_statistics,hendrycksTest-high_school_us_history,hendrycksTest-high_school_world_history,hendrycksTest-human_aging,hendrycksTest-human_sexuality,hendrycksTest-international_law,hendrycksTest-jurisprudence,hendrycksTest-logical_fallacies,hendrycksTest-machine_learning,hendrycksTest-management,hendrycksTest-marketing,hendrycksTest-medical_genetics,hendrycksTest-miscellaneous,hendrycksTest-moral_disputes,hendrycksTest-moral_scenarios,hendrycksTest-nutrition,hendrycksTest-philosophy,hendrycksTest-prehistory,hendrycksTest-professional_accounting,hendrycksTest-professional_law,hendrycksTest-professional_medicine,hendrycksTest-professional_psychology,hendrycksTest-public_relations,hendrycksTest-security_studies,hendrycksTest-sociology,hendrycksTest-us_foreign_policy,hendrycksTest-virology,hendrycksTest-world_religions,mmlu_m_es,mmlu_m_fr,mmlu_m_it,mmlu_m_de* (average of all the results `acc`) | |
- Belebele: 5-shot, *belebel_eng_Latn,belebel_ita_Latn,belebel_deu_Latn,belebel_fra_Latn,belebel_spa_Latn* (`acc_norm`) | |
**Note:** The number of few shot parameters and the metric is identical for each benchmark across all translations. | |
Side note on the baseline scores: | |
- for log-likelihood evaluation, we select the random baseline | |
--------------------------- | |
## RESOURCES | |
### Quantization | |
To get more information about quantization, see: | |
- 8 bits: [blog post](https://huggingface.co/blog/hf-bitsandbytes-integration), [paper](https://arxiv.org/abs/2208.07339) | |
- 4 bits: [blog post](https://huggingface.co/blog/4bit-transformers-bitsandbytes), [paper](https://arxiv.org/abs/2305.14314) | |
### Useful links | |
- [Community resources](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard/discussions/174) | |
- [Collection of best models](https://huggingface.co/collections/open-llm-leaderboard/llm-leaderboard-best-models-652d6c7965a4619fb5c27a03) | |
### Other cool leaderboards: | |
- [OG Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) | |
- [LLM safety](https://huggingface.co/spaces/AI-Secure/llm-trustworthy-leaderboard) | |
- [LLM performance](https://huggingface.co/spaces/optimum/llm-perf-leaderboard) | |
""" | |
EVALUATION_QUEUE_TEXT = """ | |
## Some good practices before submitting a model | |
### 1) Make sure you can load your model and tokenizer using AutoClasses: | |
```python | |
from transformers import AutoConfig, AutoModel, AutoTokenizer | |
config = AutoConfig.from_pretrained("your model name", revision=revision) | |
model = AutoModel.from_pretrained("your model name", revision=revision) | |
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision) | |
``` | |
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded. | |
Note: make sure your model is public! | |
Note: if your model needs `use_remote_code=True`, we do not support this option yet but we are working on adding it, stay posted! | |
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index) | |
It's a new format for storing weights which is safer and faster to load and use. It will also allow us to add the number of parameters of your model to the `Extended Viewer`! | |
### 3) Make sure your model has an open license! | |
This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗 | |
### 4) Fill up your model card | |
When we add extra information about models to the leaderboard, it will be automatically taken from the model card | |
## In case of model failure | |
If your model is displayed in the `FAILED` category, its execution stopped. | |
Make sure you have followed the above steps first. | |
If everything is done, check you can launch the EleutherAIHarness on your model locally, using the above command without modifications (you can add `--limit` to limit the number of examples per task). | |
## NOTE: For now we only support evaluating models with a size up to 10B parameters. | |
""" | |
OCCIGLOT_SUPPORT = """ | |
Occiglot is an ongoing research collective for open-source language models for and by Europe. | |
We strongly believe in transparent research and exchange of ideas. If you are working on topics | |
relevant to European LLMs or seek to contribute to Occiglot, don't hesitate to get in touch with us or join our [Discord](https://discord.com/invite/wUpvYs4XvM) | |
server. **We are actively seeking collaborations!** | |
""" | |
CITATION_BUTTON_LABEL = """# | |
Copy the following snippet to cite these results: | |
""" | |
CITATION_BUTTON_TEXT = r"""@misc{OcciglotEuroLeaderboard, | |
author = {Barth, Fabio and Brack, Manuel and Kraus, Maurice and Ortiz Suarez, Pedro and Ostendorf, Malte and Schramowski, Patrick}, | |
title = {Occiglot Euro LLM Leaderboard}, | |
month = 3, | |
year = 2024, | |
version = {v0.0.1}, | |
url = {https://huggingface.co/spaces/occiglot/euro-llm-leaderboard} | |
}""" | |