kaikaidai commited on
Commit
37040ff
·
1 Parent(s): 977a9af

Sunset Judge Arena :)

Browse files
__pycache__/db.cpython-311.pyc ADDED
Binary file (2.59 kB). View file
 
__pycache__/gen_api_answer.cpython-311.pyc ADDED
Binary file (22.5 kB). View file
 
__pycache__/leaderboard.cpython-311.pyc ADDED
Binary file (5.29 kB). View file
 
__pycache__/prompts.cpython-311.pyc ADDED
Binary file (9.41 kB). View file
 
__pycache__/utils.cpython-311.pyc ADDED
Binary file (1.36 kB). View file
 
app.py CHANGED
@@ -245,9 +245,8 @@ def get_current_votes():
245
 
246
  # Update the refresh_leaderboard function
247
  def refresh_leaderboard(show_preliminary):
248
- """Refresh the leaderboard data and stats."""
249
- voting_data = get_current_votes()
250
- leaderboard = get_leaderboard(model_data, voting_data, show_preliminary)
251
  data = [
252
  [
253
  entry["Model"],
@@ -259,7 +258,7 @@ def refresh_leaderboard(show_preliminary):
259
  ]
260
  for entry in leaderboard
261
  ]
262
- stats = get_leaderboard_stats(model_data, voting_data)
263
  return [gr.update(value=data), gr.update(value=stats)]
264
 
265
 
@@ -308,7 +307,8 @@ with gr.Blocks(theme="default", css=CSS_STYLES) as demo:
308
  )
309
 
310
  with gr.Tabs():
311
- with gr.TabItem("Judge Arena"):
 
312
  with gr.Row():
313
  # Left side - Input section
314
  with gr.Column(scale=1):
 
245
 
246
  # Update the refresh_leaderboard function
247
  def refresh_leaderboard(show_preliminary):
248
+ """Refresh the leaderboard data and stats (now using static data)."""
249
+ leaderboard = get_leaderboard(show_preliminary=show_preliminary)
 
250
  data = [
251
  [
252
  entry["Model"],
 
258
  ]
259
  for entry in leaderboard
260
  ]
261
+ stats = get_leaderboard_stats()
262
  return [gr.update(value=data), gr.update(value=stats)]
263
 
264
 
 
307
  )
308
 
309
  with gr.Tabs():
310
+ # Judge Arena tab hidden - voting has been sunset
311
+ with gr.TabItem("Judge Arena", visible=False):
312
  with gr.Row():
313
  # Left side - Input section
314
  with gr.Column(scale=1):
common.py CHANGED
@@ -3,7 +3,7 @@ MAIN_TITLE = "# Judge Arena: Benchmarking LLMs as Evaluators"
3
 
4
  # How it works section
5
  HOW_IT_WORKS = """
6
- Vote to help the community find the best LLM-as-a-judge to use!
7
  """
8
 
9
  BATTLE_RULES = """
 
3
 
4
  # How it works section
5
  HOW_IT_WORKS = """
6
+ Benchmarking LLMs as evaluators. Voting has been sunset — the leaderboard below reflects the final community rankings.
7
  """
8
 
9
  BATTLE_RULES = """
data/leaderboard_static.json ADDED
File without changes
leaderboard.py CHANGED
@@ -1,116 +1,60 @@
1
- from collections import defaultdict
2
- from datetime import datetime, timezone
3
  from typing import Dict, List
4
 
5
- # Constants
6
  DEFAULT_ELO = 1200 # Starting ELO for new models
7
  K_FACTOR = 32 # Standard chess K-factor
8
 
9
- def get_leaderboard(model_data: Dict, voting_data: List, show_preliminary=True):
10
- """Generate leaderboard data using votes from MongoDB."""
11
- # Initialize dictionaries for tracking
12
- ratings = defaultdict(lambda: DEFAULT_ELO)
13
- matches = defaultdict(int)
14
-
15
- # Process each vote
16
- for vote in voting_data:
17
- try:
18
- model_a = vote.get("model_a")
19
- model_b = vote.get("model_b")
20
- winner = vote.get("winner")
21
-
22
- # Skip if models aren't in current model_data
23
- if (
24
- not all([model_a, model_b, winner])
25
- or model_a not in model_data
26
- or model_b not in model_data
27
- ):
28
- continue
29
-
30
- # Update match counts
31
- matches[model_a] += 1
32
- matches[model_b] += 1
33
-
34
- # Calculate ELO changes
35
- elo_a = ratings[model_a]
36
- elo_b = ratings[model_b]
37
-
38
- # Expected scores
39
- expected_a = 1 / (1 + 10 ** ((elo_b - elo_a) / 400))
40
- expected_b = 1 - expected_a
41
-
42
- # Actual scores
43
- score_a = 1 if winner == "A" else 0 if winner == "B" else 0.5
44
- score_b = 1 - score_a
45
-
46
- # Update ratings
47
- ratings[model_a] += K_FACTOR * (score_a - expected_a)
48
- ratings[model_b] += K_FACTOR * (score_b - expected_b)
49
-
50
- except Exception as e:
51
- print(f"Error processing vote: {e}")
52
- continue
53
-
54
- # Generate leaderboard data
55
- leaderboard = []
56
- for model in model_data.keys():
57
- votes = matches[model]
58
- # Skip models with < 300 votes if show_preliminary is False
59
- if not show_preliminary and votes < 300:
60
- continue
61
-
62
- elo = ratings[model]
63
- ci = 1.96 * (400 / (votes + 1) ** 0.5) if votes > 0 else 0
64
- data = {
65
- "Model": model,
66
- "ELO Score": f"{int(elo)}",
67
- "95% CI": f"±{int(ci)}",
68
- "# Votes": votes,
69
- "Organization": model_data[model]["organization"],
70
- "License": model_data[model]["license"],
71
- }
72
- leaderboard.append(data)
73
-
74
- # Sort leaderboard by ELO score in descending order
75
- leaderboard.sort(key=lambda x: float(x["ELO Score"]), reverse=True)
76
-
77
  return leaderboard
78
 
79
- def get_leaderboard_stats(model_data: Dict, voting_data: List) -> str:
80
- """Get summary statistics for the leaderboard."""
81
- now = datetime.now(timezone.utc)
82
- total_votes = len(voting_data)
83
- total_models = len(model_data)
84
- # last_updated = now.strftime("%B %d, %Y at %H:%M:%S UTC")
85
-
86
- last_updated = now.replace(minute=0, second=0, microsecond=0).strftime(
87
- "%B %d, %Y at %H:00 UTC"
88
- )
89
 
90
  return f"""
91
  ### Leaderboard Stats
92
  - **Total Models**: {total_models}
93
  - **Total Votes**: {total_votes}
94
  - **Last Updated**: {last_updated}
95
- """
96
 
97
- def calculate_elo_change(rating_a: float, rating_b: float, winner: str) -> tuple[float, float]:
98
- """Calculate ELO rating changes for both players."""
99
- expected_a = 1 / (1 + 10 ** ((rating_b - rating_a) / 400))
100
- expected_b = 1 - expected_a
101
-
102
- if winner == "A":
103
- score_a, score_b = 1, 0
104
- elif winner == "B":
105
- score_a, score_b = 0, 1
106
- else: # Handle ties
107
- score_a, score_b = 0.5, 0.5
108
-
109
- change_a = K_FACTOR * (score_a - expected_a)
110
- change_b = K_FACTOR * (score_b - expected_b)
111
-
112
- return change_a, change_b
113
 
114
  def get_model_rankings(leaderboard: List[Dict]) -> Dict[str, int]:
115
  """Get current rankings of all models from leaderboard data."""
116
- return {entry["Model"]: idx + 1 for idx, entry in enumerate(leaderboard)}
 
1
+ import json
 
2
  from typing import Dict, List
3
 
4
+ # Constants (kept for backwards compatibility)
5
  DEFAULT_ELO = 1200 # Starting ELO for new models
6
  K_FACTOR = 32 # Standard chess K-factor
7
 
8
+ # Load static leaderboard data
9
+ def load_static_leaderboard():
10
+ """Load the static leaderboard from JSON file."""
11
+ try:
12
+ with open("data/leaderboard_static.json", "r") as f:
13
+ return json.load(f)
14
+ except FileNotFoundError:
15
+ print("Warning: leaderboard_static.json not found")
16
+ return {"leaderboard": [], "total_models": 0, "total_votes": 0, "last_updated": "Unknown"}
17
+
18
+ _static_data = load_static_leaderboard()
19
+
20
+ def get_leaderboard(model_data: Dict = None, voting_data: List = None, show_preliminary=True):
21
+ """Return the static leaderboard data.
22
+
23
+ Note: model_data and voting_data parameters are kept for backwards compatibility
24
+ but are no longer used. The leaderboard is now loaded from static data.
25
+ """
26
+ leaderboard = _static_data.get("leaderboard", [])
27
+
28
+ # Ensure ELO Score is string format for consistency
29
+ for entry in leaderboard:
30
+ if isinstance(entry.get("ELO Score"), (int, float)):
31
+ entry["ELO Score"] = str(int(entry["ELO Score"]))
32
+
33
+ if not show_preliminary:
34
+ # Filter out models with less than 300 votes
35
+ leaderboard = [entry for entry in leaderboard if entry.get("# Votes", 0) >= 300]
36
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  return leaderboard
38
 
39
+ def get_leaderboard_stats(model_data: Dict = None, voting_data: List = None) -> str:
40
+ """Get summary statistics for the leaderboard.
41
+
42
+ Note: model_data and voting_data parameters are kept for backwards compatibility
43
+ but are no longer used. Stats are now loaded from static data.
44
+ """
45
+ total_models = _static_data.get("total_models", 0)
46
+ total_votes = _static_data.get("total_votes", 0)
47
+ last_updated = _static_data.get("last_updated", "Unknown")
 
48
 
49
  return f"""
50
  ### Leaderboard Stats
51
  - **Total Models**: {total_models}
52
  - **Total Votes**: {total_votes}
53
  - **Last Updated**: {last_updated}
 
54
 
55
+ *Note: Voting has been sunset. This leaderboard reflects the final standings.*
56
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  def get_model_rankings(leaderboard: List[Dict]) -> Dict[str, int]:
59
  """Get current rankings of all models from leaderboard data."""
60
+ return {entry["Model"]: idx + 1 for idx, entry in enumerate(leaderboard)}