pavlichenko commited on
Commit
3ba832b
1 Parent(s): 7a4dfa1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ from collections import defaultdict
4
+ import pandas as pd
5
+
6
+ description = """The Toloka LLM leaderboard provides a human evaluation framework. Here, we invite annotators from the [Toloka](https://toloka.ai/) crowdsourcing platform to assess the model's responses. For this purpose, responses are generated by open-source LLMs based on a dataset of real-world user prompts. These prompts are categorized as per the [InstructGPT paper](https://arxiv.org/abs/2203.02155). Subsequently, annotators evaluate these responses in the manner of [AlpacaEval](https://tatsu-lab.github.io/alpaca_eval/). It's worth noting that we employ [Guanaco 13B](https://huggingface.co/timdettmers/guanaco-13b) instead of text-davinci-003. This is because Guanaco 13B is the closest counterpart to the now-deprecated text-davinci-003 in AlpacaEval.
7
+ The metrics on the leaderboard represent the win rate of the respective model in comparison to Guanaco 13B across various prompt categories. The "all" category denotes the aggregation of all prompts and is not a mere average of metrics from individual categories."""
8
+
9
+ leaderboard_results = requests.get("https://llmleaderboard.blob.core.windows.net/llmleaderboard/evaluation_resuls.json").json()
10
+ categories = list(leaderboard_results.keys())
11
+ categories.sort()
12
+ models = set()
13
+
14
+ model_ratings = defaultdict(dict)
15
+ for category in categories:
16
+ for entry in leaderboard_results[category]:
17
+ model = entry['model']
18
+ models.add(model)
19
+ model_ratings[model][category] = entry['rating']
20
+
21
+
22
+ table = []
23
+
24
+ for model in models:
25
+ row = [model]
26
+ for category in categories:
27
+ if category not in model_ratings[model]:
28
+ row.append(0.0)
29
+ else:
30
+ row.append(model_ratings[model][category] * 100)
31
+ table.append(row)
32
+
33
+ table = pd.DataFrame(table, columns=['Model'] + categories)
34
+ table = table.sort_values(by=['all'], ascending=False)
35
+
36
+ for category in categories:
37
+ table[category] = table[category].map('{:,.2f}%'.format)
38
+
39
+ st.set_page_config(layout="wide")
40
+ st.title('Toloka LLM Leaderboard')
41
+ st.dataframe(table)
42
+ st.markdown(description)