taagarwa commited on
Commit
c4d14fb
Β·
1 Parent(s): 343cf48

πŸ› Change from a simple to a weighted average

Browse files
Files changed (2) hide show
  1. src/display/text_blocks.py +1 -1
  2. src/leaderboard.py +3 -3
src/display/text_blocks.py CHANGED
@@ -49,5 +49,5 @@ Each benchmark measures the performance of the coding agent on different tasks:
49
 
50
  Higher scores indicate better performance on the benchmarks.
51
  If an agent scores better on a given benchmark than another, it can be generally considered to be better at those kinds of tasks.
52
- We take a simple average of these scores so you can quickly compare the performance of different coding agents, but this is a relative score and the average itself is meaningless on its own.
53
  """
 
49
 
50
  Higher scores indicate better performance on the benchmarks.
51
  If an agent scores better on a given benchmark than another, it can be generally considered to be better at those kinds of tasks.
52
+ We take a weighted average of these scores so you can quickly compare the performance of different coding agents, but this is a relative score and the average itself is meaningless on its own.
53
  """
src/leaderboard.py CHANGED
@@ -35,7 +35,7 @@ def get_leaderboard_df():
35
  model_lookup[result.model.repo] = result.model
36
  if pair not in benchmark_lookup:
37
  benchmark_lookup[pair] = {}
38
- benchmark_lookup[pair][result.benchmark.name] = round(result.metrics.score * 100, 1)
39
 
40
  # Collect results into df rows
41
  rows = []
@@ -43,7 +43,7 @@ def get_leaderboard_df():
43
  for pair, benchmarks in benchmark_lookup.items():
44
  model = model_lookup[pair[0]]
45
  harness = harness_lookup[pair[1]]
46
- avg_score = sum(benchmarks.values()) / len(benchmarks)
47
  row = {
48
  " ": "🟠" if model.is_oss and harness.is_oss else "πŸ”Ά",
49
  "Model": f'[{model.repo}]({model.url})',
@@ -55,7 +55,7 @@ def get_leaderboard_df():
55
  "Avg Score": round(avg_score, 1),
56
  }
57
  for benchmark_name in sorted(benchmark_names, key=lambda x: (0 if x == "swe-bench-verified" else 1)):
58
- row[benchmark_name] = benchmarks.get(benchmark_name, "")
59
  rows.append(row)
60
 
61
  leaderboard_df = pd.DataFrame(rows).sort_values("Avg Score", ascending=False).fillna("")
 
35
  model_lookup[result.model.repo] = result.model
36
  if pair not in benchmark_lookup:
37
  benchmark_lookup[pair] = {}
38
+ benchmark_lookup[pair][result.benchmark.name] = (round(result.metrics.score * 100, 1), result.benchmark.num_tasks)
39
 
40
  # Collect results into df rows
41
  rows = []
 
43
  for pair, benchmarks in benchmark_lookup.items():
44
  model = model_lookup[pair[0]]
45
  harness = harness_lookup[pair[1]]
46
+ avg_score = sum([score * size for score, size in benchmarks.values()]) / sum([size for _, size in benchmarks.values()])
47
  row = {
48
  " ": "🟠" if model.is_oss and harness.is_oss else "πŸ”Ά",
49
  "Model": f'[{model.repo}]({model.url})',
 
55
  "Avg Score": round(avg_score, 1),
56
  }
57
  for benchmark_name in sorted(benchmark_names, key=lambda x: (0 if x == "swe-bench-verified" else 1)):
58
+ row[benchmark_name] = benchmarks.get(benchmark_name, "")[0]
59
  rows.append(row)
60
 
61
  leaderboard_df = pd.DataFrame(rows).sort_values("Avg Score", ascending=False).fillna("")