CP Legendre commited on
Commit
34b4c37
·
1 Parent(s): 74ce0bc

Address leaderboard review feedback

Browse files
.gitignore CHANGED
@@ -11,4 +11,5 @@ eval-results/
11
  eval-queue-bk/
12
  eval-results-bk/
13
  logs/
14
- uv.lock.venv/
 
 
11
  eval-queue-bk/
12
  eval-results-bk/
13
  logs/
14
+ uv.lock
15
+ .venv/
app.py CHANGED
@@ -1,11 +1,11 @@
1
  import os
2
- import re
3
  from pathlib import Path
4
 
5
 
6
  def patch_gradio_leaderboard():
7
  """Patch gradio_leaderboard JS to fix crash on tab switch with Gradio 5.x."""
8
  import gradio_leaderboard
 
9
  pkg_dir = Path(gradio_leaderboard.__file__).parent
10
  js_file = pkg_dir / "templates" / "component" / "Index-CzS_eGV6.js"
11
  if not js_file.exists():
@@ -57,7 +57,7 @@ from src.display.text_blocks import (
57
  INTRODUCTION_TEXT,
58
  LLM_BENCHMARKS_TEXT,
59
  )
60
- from src.leaderboard import get_benchmark_run_df, get_leaderboard_df, get_score_vs_cost_df
61
 
62
  REPO_ID = "taagarwa/coding-agent-leaderboard"
63
  TOKEN = os.environ.get("HF_TOKEN")
@@ -69,30 +69,12 @@ def restart_space():
69
  API.restart_space(repo_id=REPO_ID)
70
 
71
 
72
- LEADERBOARD_DF = get_leaderboard_df()
 
73
  BENCHMARK_RUN_DF = get_benchmark_run_df()
74
  SCORE_VS_COST_DF = get_score_vs_cost_df()
75
 
76
 
77
- def extract_body(s: str):
78
- match = re.match(r"\[(.*?)\]", str(s))
79
- return match.group(1) if match else str(s)
80
-
81
-
82
- def get_leaderboard_benchmark_names(dataframe):
83
- meta_columns = {
84
- " ",
85
- "Harness",
86
- "Model",
87
- "Harness License",
88
- "Model License",
89
- "Model Num Params (B)",
90
- "Precision",
91
- "Avg Score",
92
- }
93
- return [col for col in dataframe.columns if col not in meta_columns]
94
-
95
-
96
  def render_leaderboard_benchmark_plot(benchmark_name, color_by):
97
  return create_leaderboard_benchmark_plot(
98
  BENCHMARK_RUN_DF,
@@ -101,9 +83,10 @@ def render_leaderboard_benchmark_plot(benchmark_name, color_by):
101
  )
102
 
103
 
104
- def render_score_vs_cost_plot(color_by):
105
  return create_score_vs_cost_plot(
106
  SCORE_VS_COST_DF,
 
107
  color_by=color_by,
108
  )
109
 
@@ -111,8 +94,8 @@ def render_score_vs_cost_plot(color_by):
111
  def build_header_html(df):
112
  n_results = len(df)
113
  n_models = df["Model"].nunique()
114
- n_harnesses = df["Harness"].apply(lambda s: extract_body(s)).nunique()
115
- n_benchmarks = df["Benchmark"].apply(lambda s: extract_body(s)).nunique()
116
 
117
  return f"""
118
  <base target="_blank">
@@ -137,42 +120,14 @@ def build_header_html(df):
137
  """
138
 
139
 
140
- def init_leaderboard(dataframe):
141
- if dataframe is None or dataframe.empty:
142
- raise ValueError("Leaderboard DataFrame is empty or None.")
143
-
144
- label_choices = [("🟠 Fully FOSS", "🟠"), ("🔶 Proprietary", "🔶")]
145
- meta_columns = [" ", "Harness", "Model", "Harness License", "Model License", "Model Num Params (B)", "Precision"]
146
- benchmark_columns = [col for col in dataframe.columns if col not in meta_columns]
147
- model_choices = sorted({(extract_body(v), v) for v in dataframe["Model"]})
148
- harness_choices = sorted({(extract_body(v), v) for v in dataframe["Harness"]})
149
-
150
- default_columns = [" ", "Harness", "Model"] + benchmark_columns
151
- return Leaderboard(
152
- value=dataframe,
153
- select_columns=SelectColumns(
154
- default_selection=default_columns,
155
- label="Select Columns to Display:",
156
- ),
157
- datatype="markdown",
158
- search_columns=["Harness", "Model"],
159
- filter_columns=[
160
- ColumnFilter(label="Category", column=" ", type="checkboxgroup", choices=label_choices),
161
- ColumnFilter(label="Model", column="Model", type="checkboxgroup", choices=model_choices),
162
- ColumnFilter(label="Harness", column="Harness", type="checkboxgroup", choices=harness_choices),
163
- ColumnFilter(label="Number of Parameters (B)", column="Model Num Params (B)", type="slider"),
164
- ColumnFilter(label="Precision", column="Precision", type="checkboxgroup"),
165
- ],
166
- interactive=False,
167
- )
168
-
169
-
170
  def init_benchmark_runs(dataframe):
171
  if dataframe is None or dataframe.empty:
172
  raise ValueError("Leaderboard DataFrame is empty or None.")
173
 
174
  label_choices = [("🟠 Fully FOSS", "🟠"), ("🔶 Proprietary", "🔶")]
175
  benchmark_choices = sorted({(clean_markdown_link(v), v) for v in dataframe["Benchmark"]})
 
 
176
 
177
  return Leaderboard(
178
  value=dataframe,
@@ -196,6 +151,8 @@ def init_benchmark_runs(dataframe):
196
  filter_columns=[
197
  ColumnFilter(label="Category", column=" ", type="checkboxgroup", choices=label_choices),
198
  ColumnFilter(label="Benchmark", column="Benchmark", type="checkboxgroup", choices=benchmark_choices),
 
 
199
  ColumnFilter(label="Number of Parameters (B)", column="Model Num Params (B)", type="slider"),
200
  ColumnFilter(label="Precision", column="Precision", type="checkboxgroup"),
201
  ],
@@ -203,15 +160,13 @@ def init_benchmark_runs(dataframe):
203
  )
204
 
205
 
206
- leaderboard_benchmark_names = get_leaderboard_benchmark_names(LEADERBOARD_DF)
207
-
208
  demo = gr.Blocks(theme="citrus")
209
  with demo:
210
  gr.HTML(build_header_html(BENCHMARK_RUN_DF))
211
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
212
 
213
  with gr.Tabs():
214
- with gr.Tab("Leaderboard"):
215
  gr.Markdown("### Benchmark scores")
216
  leaderboard_color_by = gr.Radio(
217
  choices=COLOR_BY_CHOICES,
@@ -220,7 +175,7 @@ with demo:
220
  )
221
 
222
  leaderboard_plots = []
223
- for benchmark_name in leaderboard_benchmark_names:
224
  gr.Markdown(f"#### {benchmark_name}")
225
  plot = gr.Plot(
226
  value=render_leaderboard_benchmark_plot(benchmark_name, "Model"),
@@ -235,29 +190,36 @@ with demo:
235
  outputs=plot,
236
  )
237
 
238
- gr.Markdown("### Leaderboard table")
239
- leaderboard = init_leaderboard(LEADERBOARD_DF)
240
-
241
- with gr.Tab("Cost vs Performance"):
 
 
242
  cost_color_by = gr.Radio(
243
  choices=COLOR_BY_CHOICES,
244
  value="Model",
245
  label="Color by",
246
  )
247
  score_vs_cost_plot = gr.Plot(
248
- value=render_score_vs_cost_plot("Model"),
249
  show_label=False,
250
  )
 
 
 
 
 
251
  cost_color_by.change(
252
  fn=render_score_vs_cost_plot,
253
- inputs=cost_color_by,
254
  outputs=score_vs_cost_plot,
255
  )
256
 
257
- with gr.Tab("Benchmark Runs"):
258
  benchmark_runs = init_benchmark_runs(BENCHMARK_RUN_DF)
259
 
260
- with gr.Tab("About"):
261
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
262
  gr.Markdown(HOW_TO_USE_TEXT, elem_classes="markdown-text")
263
 
 
1
  import os
 
2
  from pathlib import Path
3
 
4
 
5
  def patch_gradio_leaderboard():
6
  """Patch gradio_leaderboard JS to fix crash on tab switch with Gradio 5.x."""
7
  import gradio_leaderboard
8
+
9
  pkg_dir = Path(gradio_leaderboard.__file__).parent
10
  js_file = pkg_dir / "templates" / "component" / "Index-CzS_eGV6.js"
11
  if not js_file.exists():
 
57
  INTRODUCTION_TEXT,
58
  LLM_BENCHMARKS_TEXT,
59
  )
60
+ from src.leaderboard import get_benchmark_names, get_benchmark_run_df, get_score_vs_cost_df
61
 
62
  REPO_ID = "taagarwa/coding-agent-leaderboard"
63
  TOKEN = os.environ.get("HF_TOKEN")
 
69
  API.restart_space(repo_id=REPO_ID)
70
 
71
 
72
+ BENCHMARK_NAMES = get_benchmark_names()
73
+ DEFAULT_BENCHMARK = BENCHMARK_NAMES[0] if BENCHMARK_NAMES else None
74
  BENCHMARK_RUN_DF = get_benchmark_run_df()
75
  SCORE_VS_COST_DF = get_score_vs_cost_df()
76
 
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  def render_leaderboard_benchmark_plot(benchmark_name, color_by):
79
  return create_leaderboard_benchmark_plot(
80
  BENCHMARK_RUN_DF,
 
83
  )
84
 
85
 
86
+ def render_score_vs_cost_plot(benchmark_name, color_by):
87
  return create_score_vs_cost_plot(
88
  SCORE_VS_COST_DF,
89
+ benchmark_name=benchmark_name,
90
  color_by=color_by,
91
  )
92
 
 
94
  def build_header_html(df):
95
  n_results = len(df)
96
  n_models = df["Model"].nunique()
97
+ n_harnesses = df["Harness"].apply(clean_markdown_link).nunique()
98
+ n_benchmarks = df["Benchmark"].apply(clean_markdown_link).nunique()
99
 
100
  return f"""
101
  <base target="_blank">
 
120
  """
121
 
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  def init_benchmark_runs(dataframe):
124
  if dataframe is None or dataframe.empty:
125
  raise ValueError("Leaderboard DataFrame is empty or None.")
126
 
127
  label_choices = [("🟠 Fully FOSS", "🟠"), ("🔶 Proprietary", "🔶")]
128
  benchmark_choices = sorted({(clean_markdown_link(v), v) for v in dataframe["Benchmark"]})
129
+ model_choices = sorted({(clean_markdown_link(v), v) for v in dataframe["Model"]})
130
+ harness_choices = sorted({(clean_markdown_link(v), v) for v in dataframe["Harness"]})
131
 
132
  return Leaderboard(
133
  value=dataframe,
 
151
  filter_columns=[
152
  ColumnFilter(label="Category", column=" ", type="checkboxgroup", choices=label_choices),
153
  ColumnFilter(label="Benchmark", column="Benchmark", type="checkboxgroup", choices=benchmark_choices),
154
+ ColumnFilter(label="Model", column="Model", type="checkboxgroup", choices=model_choices),
155
+ ColumnFilter(label="Harness", column="Harness", type="checkboxgroup", choices=harness_choices),
156
  ColumnFilter(label="Number of Parameters (B)", column="Model Num Params (B)", type="slider"),
157
  ColumnFilter(label="Precision", column="Precision", type="checkboxgroup"),
158
  ],
 
160
  )
161
 
162
 
 
 
163
  demo = gr.Blocks(theme="citrus")
164
  with demo:
165
  gr.HTML(build_header_html(BENCHMARK_RUN_DF))
166
  gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
167
 
168
  with gr.Tabs():
169
+ with gr.Tab("🏆 Leaderboard"):
170
  gr.Markdown("### Benchmark scores")
171
  leaderboard_color_by = gr.Radio(
172
  choices=COLOR_BY_CHOICES,
 
175
  )
176
 
177
  leaderboard_plots = []
178
+ for benchmark_name in BENCHMARK_NAMES:
179
  gr.Markdown(f"#### {benchmark_name}")
180
  plot = gr.Plot(
181
  value=render_leaderboard_benchmark_plot(benchmark_name, "Model"),
 
190
  outputs=plot,
191
  )
192
 
193
+ with gr.Tab("💰 Cost vs Performance"):
194
+ cost_benchmark = gr.Dropdown(
195
+ choices=BENCHMARK_NAMES,
196
+ value=DEFAULT_BENCHMARK,
197
+ label="Benchmark",
198
+ )
199
  cost_color_by = gr.Radio(
200
  choices=COLOR_BY_CHOICES,
201
  value="Model",
202
  label="Color by",
203
  )
204
  score_vs_cost_plot = gr.Plot(
205
+ value=render_score_vs_cost_plot(DEFAULT_BENCHMARK, "Model"),
206
  show_label=False,
207
  )
208
+ cost_benchmark.change(
209
+ fn=render_score_vs_cost_plot,
210
+ inputs=[cost_benchmark, cost_color_by],
211
+ outputs=score_vs_cost_plot,
212
+ )
213
  cost_color_by.change(
214
  fn=render_score_vs_cost_plot,
215
+ inputs=[cost_benchmark, cost_color_by],
216
  outputs=score_vs_cost_plot,
217
  )
218
 
219
+ with gr.Tab("🏃 Benchmark Runs"):
220
  benchmark_runs = init_benchmark_runs(BENCHMARK_RUN_DF)
221
 
222
+ with gr.Tab("ℹ️ About"):
223
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
224
  gr.Markdown(HOW_TO_USE_TEXT, elem_classes="markdown-text")
225
 
results/swe-bench-verified-claude-opus-4-8-claude-code.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-claude-opus-4-8-opencode.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-claude-sonnet-4-6-claude-code.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-gpt-5-5-codex.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-qwen3-6-35b-nvfp4-claude-code.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-qwen3-6-35b-nvfp4-openclaw.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-qwen3-6-35b-nvfp4-opencode.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-qwen3-6-36b-nvfp4-pi.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
results/swe-bench-verified-qwen3-6-36b-nvfp4-qwen-code.json CHANGED
@@ -23,7 +23,7 @@
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
- "name": "swe-bench/SWE-Bench Verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
 
23
  "name": "harbor",
24
  "config": {
25
  "path": null,
26
+ "name": "swe-bench/swe-bench-verified",
27
  "version": null,
28
  "ref": "sha256:235d6032d549851a936db3b5fe08807c4d385c12ee10e7be9c9786a1ff60563c",
29
  "registry_url": null,
src/charts.py CHANGED
@@ -163,18 +163,23 @@ def create_leaderboard_benchmark_plot(
163
 
164
  def create_score_vs_cost_plot(
165
  dataframe: pd.DataFrame,
 
166
  color_by: ColorBy = "Model",
167
  ) -> Figure:
168
  if dataframe is None or dataframe.empty:
169
  return empty_figure("No cost data available.")
170
 
 
 
 
171
  plot_df = dataframe.copy()
172
- plot_df["Avg Score"] = pd.to_numeric(plot_df["Avg Score"], errors="coerce")
173
- plot_df["Avg Cost Per Task (USD)"] = pd.to_numeric(plot_df["Avg Cost Per Task (USD)"], errors="coerce")
174
- plot_df = plot_df.dropna(subset=["Avg Score", "Avg Cost Per Task (USD)"])
 
175
 
176
  if plot_df.empty:
177
- return empty_figure("No cost data available.")
178
 
179
  colors = color_map_for(plot_df[color_by], color_by)
180
  fig = go.Figure()
@@ -182,8 +187,8 @@ def create_score_vs_cost_plot(
182
  for group, group_df in plot_df.groupby(color_by, sort=True):
183
  fig.add_trace(
184
  go.Scatter(
185
- x=group_df["Avg Cost Per Task (USD)"],
186
- y=group_df["Avg Score"],
187
  mode="markers+text",
188
  name=str(group),
189
  text=group_df["Label"],
@@ -193,21 +198,22 @@ def create_score_vs_cost_plot(
193
  "color": colors[str(group)],
194
  "line": {"width": 1, "color": "white"},
195
  },
196
- customdata=group_df[["Model", "Harness", "Avg Score", "Avg Cost Per Task (USD)"]],
197
  hovertemplate=(
198
  "<b>%{customdata[0]}</b><br>"
199
  "Harness: %{customdata[1]}<br>"
200
- "Average score: %{customdata[2]:.1f}%<br>"
201
- "Average cost: $%{customdata[3]:.2f}/task"
 
202
  "<extra></extra>"
203
  ),
204
  )
205
  )
206
 
207
  fig.update_layout(
208
- title={"text": "Cost vs Performance", "font": {"size": 18}},
209
- xaxis={"title": "Average cost per task (USD)", "tickprefix": "$", "tickformat": ".2f"},
210
- yaxis={"title": "Average score (%)", "range": [0, 105]},
211
  legend_title_text=color_by,
212
  )
213
  return apply_plot_theme(fig, height=580)
 
163
 
164
  def create_score_vs_cost_plot(
165
  dataframe: pd.DataFrame,
166
+ benchmark_name: str | None,
167
  color_by: ColorBy = "Model",
168
  ) -> Figure:
169
  if dataframe is None or dataframe.empty:
170
  return empty_figure("No cost data available.")
171
 
172
+ if not benchmark_name:
173
+ return empty_figure("Select a benchmark to view cost data.")
174
+
175
  plot_df = dataframe.copy()
176
+ plot_df = plot_df[plot_df["Benchmark"] == benchmark_name]
177
+ plot_df["Score"] = pd.to_numeric(plot_df["Score"], errors="coerce")
178
+ plot_df["Cost Per Task (USD)"] = pd.to_numeric(plot_df["Cost Per Task (USD)"], errors="coerce")
179
+ plot_df = plot_df.dropna(subset=["Score", "Cost Per Task (USD)"])
180
 
181
  if plot_df.empty:
182
+ return empty_figure(f"No cost data available for {benchmark_name}.")
183
 
184
  colors = color_map_for(plot_df[color_by], color_by)
185
  fig = go.Figure()
 
187
  for group, group_df in plot_df.groupby(color_by, sort=True):
188
  fig.add_trace(
189
  go.Scatter(
190
+ x=group_df["Cost Per Task (USD)"],
191
+ y=group_df["Score"],
192
  mode="markers+text",
193
  name=str(group),
194
  text=group_df["Label"],
 
198
  "color": colors[str(group)],
199
  "line": {"width": 1, "color": "white"},
200
  },
201
+ customdata=group_df[["Model", "Harness", "Benchmark", "Score", "Cost Per Task (USD)"]],
202
  hovertemplate=(
203
  "<b>%{customdata[0]}</b><br>"
204
  "Harness: %{customdata[1]}<br>"
205
+ "Benchmark: %{customdata[2]}<br>"
206
+ "Score: %{customdata[3]:.1f}%<br>"
207
+ "Cost: $%{customdata[4]:.2f}/task"
208
  "<extra></extra>"
209
  ),
210
  )
211
  )
212
 
213
  fig.update_layout(
214
+ title={"text": f"{benchmark_name}: Cost vs Performance", "font": {"size": 18}},
215
+ xaxis={"title": "Cost per task (USD)", "tickprefix": "$", "tickformat": ".2f"},
216
+ yaxis={"title": "Score (%)", "range": [0, 105]},
217
  legend_title_text=color_by,
218
  )
219
  return apply_plot_theme(fig, height=580)
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 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
  """
 
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
+ Compare agents within each benchmark rather than relying on a cross-benchmark average. Each benchmark emphasizes different task types, so per-benchmark scores are the clearest way to judge performance.
53
  """
src/leaderboard.py CHANGED
@@ -3,15 +3,13 @@ import json
3
 
4
  import pandas as pd
5
 
6
- from src.models import Harness, Model, Result
7
 
8
  RESULTS_DIR = Path(__file__).parent.parent / "results"
9
 
10
  BENCHMARK_SORT_ORDER = {
11
  "SWE-Bench Verified": 0,
12
- "swe-bench-verified": 0,
13
  "SWE-Bench Pro -- Ansible": 1,
14
- "swe-bench-pro--ansible": 1,
15
  }
16
 
17
 
@@ -19,7 +17,7 @@ def benchmark_sort_key(name: str) -> tuple[int, str]:
19
  return (BENCHMARK_SORT_ORDER.get(name, 99), name)
20
 
21
 
22
- def format_time(seconds: int):
23
  if seconds is None:
24
  return None
25
  m, s = divmod(seconds, 60)
@@ -37,56 +35,11 @@ def get_results() -> list[Result]:
37
 
38
 
39
  def get_benchmark_names(results: list[Result] | None = None) -> list[str]:
40
- results = results or get_results()
 
41
  return sorted({r.benchmark.name for r in results}, key=benchmark_sort_key)
42
 
43
 
44
- def get_leaderboard_df():
45
- results = get_results()
46
-
47
- # Collect benchmark scores for each model-harness pair, and convert to percent out of 100.
48
- benchmark_lookup: dict[tuple[str, str], dict[str, tuple[float, int]]] = {}
49
- model_lookup: dict[str, Model] = {}
50
- harness_lookup: dict[str, Harness] = {}
51
- for result in results:
52
- model_key = result.model.repo or result.model.name
53
- pair = (model_key, result.harness.name)
54
- harness_lookup[result.harness.name] = result.harness
55
- model_lookup[model_key] = result.model
56
- benchmark_lookup.setdefault(pair, {})[result.benchmark.name] = (
57
- round(result.metrics.score * 100, 1),
58
- result.benchmark.num_tasks,
59
- )
60
-
61
- rows = []
62
- benchmark_names = get_benchmark_names(results=results)
63
- for pair, benchmarks in benchmark_lookup.items():
64
- model = model_lookup[pair[0]]
65
- harness = harness_lookup[pair[1]]
66
- avg_score = sum(score * size for score, size in benchmarks.values()) / sum(
67
- size for _, size in benchmarks.values()
68
- )
69
- row = {
70
- " ": "🟠" if model.is_oss and harness.is_oss else "🔶",
71
- "Model": f"[{model.repo or model.name}]({model.url})",
72
- "Harness": f"[{harness.name}]({harness.url})<sup>*</sup>"
73
- if harness.name == "internal"
74
- else f"[{harness.name}]({harness.url})",
75
- "Precision": model.precision,
76
- "Model License": "FOSS" if model.is_oss else "Proprietary",
77
- "Harness License": "FOSS" if harness.is_oss else "Proprietary",
78
- "Model Num Params (B)": model.num_params,
79
- "Avg Score": round(avg_score, 1),
80
- }
81
- for benchmark_name in benchmark_names:
82
- benchmark_score = benchmarks.get(benchmark_name)
83
- row[benchmark_name] = benchmark_score[0] if benchmark_score else ""
84
- rows.append(row)
85
-
86
- leaderboard_df = pd.DataFrame(rows).sort_values("Avg Score", ascending=False).fillna("")
87
- return leaderboard_df
88
-
89
-
90
  def get_benchmark_run_df():
91
  results = get_results()
92
 
@@ -114,44 +67,40 @@ def get_benchmark_run_df():
114
  }
115
  )
116
 
117
- benchmark_run_df = pd.DataFrame(rows).sort_values(by=["Benchmark", "Score"], ascending=False).fillna("")
118
- return benchmark_run_df
 
 
 
 
 
 
 
 
 
119
 
120
 
121
  def get_score_vs_cost_df():
122
  results = get_results()
123
 
124
- score_weighted_sum: dict[tuple[str, str], float] = {}
125
- cost_weighted_sum: dict[tuple[str, str], float] = {}
126
- weight_sum: dict[tuple[str, str], int] = {}
127
- cost_weight_sum: dict[tuple[str, str], int] = {}
128
- meta_lookup: dict[tuple[str, str], Result] = {}
129
-
130
  for result in results:
131
- pair = (result.model.name, result.harness.name)
132
- weight = result.metrics.n_tasks or result.benchmark.num_tasks or 1
133
- meta_lookup[pair] = result
134
- score_weighted_sum[pair] = score_weighted_sum.get(pair, 0) + (result.metrics.score * 100 * weight)
135
- weight_sum[pair] = weight_sum.get(pair, 0) + weight
136
-
137
  mean_cost = result.metrics.mean_cost_usd_per_task
138
- if mean_cost is not None:
139
- cost_weighted_sum[pair] = cost_weighted_sum.get(pair, 0) + (mean_cost * weight)
140
- cost_weight_sum[pair] = cost_weight_sum.get(pair, 0) + weight
141
-
142
- rows = []
143
- for pair, weighted_score in score_weighted_sum.items():
144
- if pair not in cost_weighted_sum:
145
  continue
146
- result = meta_lookup[pair]
 
 
 
147
  rows.append(
148
  {
149
- "Label": f"{pair[0]} / {pair[1]}",
150
- "Model": pair[0],
151
- "Harness": pair[1],
 
152
  "Category": "FOSS" if result.model.is_oss and result.harness.is_oss else "Proprietary",
153
- "Avg Score": round(weighted_score / weight_sum[pair], 1),
154
- "Avg Cost Per Task (USD)": round(cost_weighted_sum[pair] / cost_weight_sum[pair], 2),
155
  }
156
  )
157
 
@@ -159,11 +108,16 @@ def get_score_vs_cost_df():
159
  "Label",
160
  "Model",
161
  "Harness",
 
162
  "Category",
163
- "Avg Score",
164
- "Avg Cost Per Task (USD)",
165
  ]
166
  score_vs_cost_df = pd.DataFrame(rows, columns=columns)
167
  if score_vs_cost_df.empty:
168
  return score_vs_cost_df
169
- return score_vs_cost_df.sort_values("Avg Score", ascending=False)
 
 
 
 
 
3
 
4
  import pandas as pd
5
 
6
+ from src.models import Result
7
 
8
  RESULTS_DIR = Path(__file__).parent.parent / "results"
9
 
10
  BENCHMARK_SORT_ORDER = {
11
  "SWE-Bench Verified": 0,
 
12
  "SWE-Bench Pro -- Ansible": 1,
 
13
  }
14
 
15
 
 
17
  return (BENCHMARK_SORT_ORDER.get(name, 99), name)
18
 
19
 
20
+ def format_time(seconds: int | None) -> str | None:
21
  if seconds is None:
22
  return None
23
  m, s = divmod(seconds, 60)
 
35
 
36
 
37
  def get_benchmark_names(results: list[Result] | None = None) -> list[str]:
38
+ if results is None:
39
+ results = get_results()
40
  return sorted({r.benchmark.name for r in results}, key=benchmark_sort_key)
41
 
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  def get_benchmark_run_df():
44
  results = get_results()
45
 
 
67
  }
68
  )
69
 
70
+ benchmark_run_df = pd.DataFrame(rows)
71
+ if benchmark_run_df.empty:
72
+ return benchmark_run_df
73
+
74
+ benchmark_run_df["_Benchmark Sort"] = benchmark_run_df["Benchmark"].str.extract(r"\[(.*?)\]", expand=False)
75
+ benchmark_run_df["_Benchmark Sort Key"] = benchmark_run_df["_Benchmark Sort"].map(benchmark_sort_key)
76
+ benchmark_run_df = benchmark_run_df.sort_values(
77
+ by=["_Benchmark Sort Key", "Score"],
78
+ ascending=[True, False],
79
+ ).drop(columns=["_Benchmark Sort", "_Benchmark Sort Key"])
80
+ return benchmark_run_df.fillna("")
81
 
82
 
83
  def get_score_vs_cost_df():
84
  results = get_results()
85
 
86
+ rows = []
 
 
 
 
 
87
  for result in results:
 
 
 
 
 
 
88
  mean_cost = result.metrics.mean_cost_usd_per_task
89
+ if mean_cost is None:
 
 
 
 
 
 
90
  continue
91
+
92
+ model_label = result.model.repo or result.model.name
93
+ harness_label = result.harness.name
94
+
95
  rows.append(
96
  {
97
+ "Label": f"{model_label} / {harness_label}",
98
+ "Model": model_label,
99
+ "Harness": harness_label,
100
+ "Benchmark": result.benchmark.name,
101
  "Category": "FOSS" if result.model.is_oss and result.harness.is_oss else "Proprietary",
102
+ "Score": round(result.metrics.score * 100, 1),
103
+ "Cost Per Task (USD)": round(mean_cost, 2),
104
  }
105
  )
106
 
 
108
  "Label",
109
  "Model",
110
  "Harness",
111
+ "Benchmark",
112
  "Category",
113
+ "Score",
114
+ "Cost Per Task (USD)",
115
  ]
116
  score_vs_cost_df = pd.DataFrame(rows, columns=columns)
117
  if score_vs_cost_df.empty:
118
  return score_vs_cost_df
119
+
120
+ return score_vs_cost_df.sort_values(
121
+ ["Benchmark", "Score"],
122
+ ascending=[True, False],
123
+ )