Spaces:
Running
Running
File size: 81,577 Bytes
7c691e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 |
import gradio as gr
from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
import config
from envs import RESULTS_REPO_ID, REPO_ID, API, HF_TOKEN
from pathlib import Path
import pandas as pd
import os
import json
from utils.viz import create_scatter_plot, create_flow_chart, create_bar_chart, create_task_success_heatmap, create_leaderboard
from utils.processing import check_and_process_uploads
from huggingface_hub import snapshot_download
from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime
import json
import re
import markdown
import asyncio
from apscheduler.schedulers.asyncio import AsyncIOScheduler
import weave
from utils.db import TracePreprocessor
from gradio.themes.soft import Soft
preprocessor = TracePreprocessor()
from datetime import datetime
abs_path = Path(__file__).parent
def restart_space():
API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)
# New function to download results
def download_latest_results():
print("Downloading latest results...")
snapshot_download(RESULTS_REPO_ID,
local_dir= "evals_upload",
repo_type='dataset',
tqdm_class=None,
etag_timeout=30,
max_workers=4,
)
print("Download complete.")
def get_analyzed_traces(agent_name, benchmark_name):
return preprocessor.get_analyzed_traces(agent_name, benchmark_name)
def get_failure_report(agent_name, benchmark_name):
return preprocessor.get_failure_report(agent_name, benchmark_name)
def parse_json_files(folder_path, benchmark_name, aggregate=True):
return preprocessor.get_parsed_results(benchmark_name, aggregate=aggregate)
def update_agent_dropdown(benchmark_name, metric):
df = parse_json_files(os.path.join(abs_path, "evals_live"), benchmark_name)
agents = df['Agent Name'].tolist()
best_agent = get_best_agent(benchmark_name, metric)
return gr.Dropdown(choices=agents, value=best_agent, label="Select Agent")
def get_best_agent(benchmark_name, metric):
df = parse_json_files(os.path.join(abs_path, "evals_live"), benchmark_name)
return df.loc[df[metric].idxmax()]['Agent Name']
def update_task_analysis(benchmark_name, agent_name):
if not agent_name:
return "Please select an agent.", None, None, ""
analyzed_traces = get_analyzed_traces(agent_name, benchmark_name)
if not analyzed_traces:
return f"No analysis available for agent: {agent_name}", None, None, ""
task_ids = list(analyzed_traces.keys())
overview, flow_chart, _ = update_task_details(benchmark_name, agent_name, task_ids[0])
return overview, flow_chart, gr.Dropdown(choices=task_ids, value=task_ids[0], label="Select Task"), ""
def update_task_details(benchmark_name, agent_name, task_id):
if not task_id:
return "Please select a task.", None, ""
analyzed_traces = get_analyzed_traces(agent_name, benchmark_name)
if not analyzed_traces or task_id not in analyzed_traces:
return f"No analysis available for task: {task_id}", None, ""
analysis = analyzed_traces[task_id]
summary = analysis.get('task_analysis', {})
overview = f"### Summary\n\n{summary.get('overview', 'No overview available.')}\n\n"
# overview += f"### Successes\n{summary.get('key_successes', 'No successes listed.')}\n\n"
# overview += f"### Challenges\n{summary.get('main_challenges', 'No challenges listed.')}\n\n"
# overview += f"### Overall Assessment\n{summary.get('overall_assessment', 'No assessment available.')}\n\n"
if summary.get('overview', 'No overview available.') != "Not available":
flow_chart = create_flow_chart(analysis['steps'])
else:
flow_chart = None
return overview, flow_chart, ""
def format_call_info(step, step_index):
call_data = step['call_data']
analysis = step['analysis']
def format_json(obj):
# if isinstance(obj, dict) and 'choices' in obj:
# # Special handling for message content
# formatted_content = format_message_content(obj['choices'][0])
# return f'<div class="message-content">{formatted_content}</div>'
# else:
json_str = json.dumps(obj, indent=2)
json_str = json_str.replace(' ', ' ')
json_str = json_str.replace('\n', '<br>')
return f'<div class="json-wrapper">{json_str}</div>'
# Currently not used but we can enable it to format message content
def format_message_content(content):
# Convert Markdown to HTML
html_content = markdown.markdown(content)
# Replace ``` code blocks with styled pre blocks
html_content = re.sub(r'```python\n(.*?)```', lambda m: f'<pre class="code-block">{m.group(1)}</pre>', html_content, flags=re.DOTALL)
return html_content
formatted_info = f"""
<style>
.json-wrapper {{
white-space: pre-wrap;
word-wrap: break-word;
font-family: monospace;
max-height: 300px;
overflow-y: auto;
background-color: #f5f5f5;
padding: 10px;
border-radius: 5px;
}}
.message-content {{
white-space: normal;
word-wrap: break-word;
font-family: Arial, sans-serif;
max-height: 500px;
overflow-y: auto;
background-color: #ffffff;
padding: 10px;
border-radius: 5px;
border: 1px solid #e0e0e0;
}}
.code-block {{
background-color: #f0f0f0;
padding: 10px;
border-radius: 5px;
font-family: monospace;
white-space: pre-wrap;
word-wrap: break-word;
}}
</style>
<h3>Step {step_index + 1}: {analysis.get('headline', '')}</h3>
<h4>Call Metadata</h4>
<ul>
<li><strong>Weave Task ID:</strong> {call_data['weave_task_id']}</li>
<li><strong>Trace ID:</strong> {call_data['trace_id']}</li>
<li><strong>Project ID:</strong> {call_data['project_id']}</li>
<li><strong>Created Timestamp:</strong> {datetime.fromtimestamp(call_data['created_timestamp'])}</li>
<li><strong>Model:</strong> {call_data['inputs']['model']}</li>
</ul>
<h4>Inputs</h4>
{format_json(call_data['inputs'])}
<h4>Outputs</h4>
{format_json(call_data['outputs'])}
<h4>Usage</h4>
{format_json(call_data['summary'])}
<h4>Analysis</h4>
<ul>
<li><strong>Description:</strong> {analysis['description']}</li>
<li><strong>Assessment:</strong> {analysis['assessment']}</li>
<li><strong>Success:</strong> {analysis['success']}</li>
<li><strong>Action Type:</strong> {analysis['action_type']}</li>
</ul>
"""
return formatted_info
def update_failure_report(agent_name, benchmark_name):
failure_report = get_failure_report(agent_name, benchmark_name)
if not failure_report:
return "No failure report available for this agent.", None
# Create overview of failure categories
categories_overview = "### Failure Categories:\n\n"
for category in failure_report['failure_categories']:
categories_overview += f"#### {category['category_name']}\n"
categories_overview += f"{category['description']}\n\n"
# Count tasks affected by each category
category_counts = {}
for task, classification in failure_report['task_classifications'].items():
category_id = classification['category_id']
category_counts[category_id] = category_counts.get(category_id, 0) + 1
# Prepare data for bar chart
categories = [cat['category_name'] for cat in failure_report['failure_categories']]
counts = [category_counts.get(str(i+1), 0) for i in range(len(categories))]
# Create bar chart
chart = create_bar_chart(categories, counts, "Failure Categories", "Number of Affected Tasks", "Failure Categories Distribution")
return categories_overview, chart
from gradio.themes.utils import colors, fonts, sizes
from typing import Iterable
class MyTheme(Soft):
def __init__(
self,
*,
primary_hue: colors.Color | str = colors.blue,
text_size: sizes.Size | str = sizes.text_lg,
font: fonts.Font
| str
| Iterable[fonts.Font | str] = (
fonts.GoogleFont("Lato"),
"ui-sans-serif",
"sans-serif",
),
font_mono: fonts.Font
| str
| Iterable[fonts.Font | str] = (
fonts.GoogleFont("IBM Plex Mono"),
"ui-monospace",
"monospace",
),
):
super().__init__(
primary_hue=primary_hue,
text_size=text_size,
font=font,
font_mono=font_mono,
)
my_theme = MyTheme()
with gr.Blocks(theme=my_theme, css='css.css', title="HAL: Holistic Agent Leaderboard") as demo:
# gr.Markdown((Path(__file__).parent / "header.md").read_text(), elem_classes=["text-large"])
gr.HTML("""
<style>
.hal-header {
color: #ecf0f1;
border-radius: 10px;
padding: 40px 20px;
text-align: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.hal-title {
font-size: 2.5em;
font-weight: 700;
margin: 0;
letter-spacing: 2px;
text-transform: uppercase;
}
.hal-subtitle {
font-size: 1.2em;
font-weight: 300;
margin-top: 15px;
margin-left: auto;
margin-right: auto;
line-height: 1.6;
text-align: center;
}
.hal-highlight {
color: #3498db;
font-weight: 600;
}
</style>
<header class="hal-header">
<h1 class="hal-title">Holistic Agent Leaderboard (HAL)</h1>
<p class="hal-subtitle">
A standardized, cost-aware, and third-party leaderboard for evaluating agents.
</p>
</header>""")
gr.HTML("""
<style>
.feature-row {
display: flex;
justify-content: space-between;
margin-top: 20px;
margin-bottom: 20px;
}
.feature-column {
flex: 1;
padding: 25px;
background-color: #ffffff;
border-radius: 10px;
margin: 0 15px;
text-align: left;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
align-items: flex-start;
border-top: 5px solid #3498db;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-column:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}
.feature-keyword {
font-size: 1.2em;
font-weight: bold;
color: #1b9e77;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}
.feature-content {
flex-grow: 1;
}
.feature-description {
font-size: 0.95em;
line-height: 1.6;
color: #333;
}
</style>
<div class="feature-row">
<div class="feature-column">
<div class="feature-keyword">Standardized</div>
<div class="feature-content">
<p class="feature-description">Evaluations across agent benchmarks are all recorded to a single leaderboard that evaluates every listed agent in the same way.</p>
</div>
</div>
<div class="feature-column">
<div class="feature-keyword">Cost-controlled</div>
<div class="feature-content">
<p class="feature-description">For downstream users, understanding the cost of running agents is a significant need for adoption. For agent developers, cost-controlled evaluations help develop accurate baselines.</p>
</div>
</div>
<div class="feature-column">
<div class="feature-keyword">Third-party</div>
<div class="feature-content">
<p class="feature-description">Agent developers clearly have competing objectives in reporting accuracy: they want to achieve state-of-the-art performance.</p>
</div>
</div>
</div>
<style>
.section-heading {
font-size: 1.8em;
font-weight: bold;
color: #2c3e50;
margin-top: 40px;
margin-bottom: 20px;
text-align: left;
}
.user-types-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
margin-top: 20px;
}
.user-type {
background-color: #ffffff;
border-radius: 10px;
padding: 25px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
border-left: 5px solid #3498db;
}
.user-type:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}
.user-type-title {
font-size: 1.2em;
font-weight: bold;
color: #3498db;
margin-bottom: 10px;
}
.user-type-description {
font-size: 0.95em;
line-height: 1.6;
color: #333;
}
.user-type-links a {
display: inline-block;
padding: 5px 12px;
margin-bottom: 5px;
background-color: #f0f4f8;
color: #2c3e50 !important; /* Force the color change */
text-decoration: none !important; /* Force remove underline */
border-radius: 15px;
font-size: 0.85em;
transition: all 0.3s ease;
border: 1px solid #e1e8ed;
}
.user-type-links a:hover {
background-color: #3498db;
color: white !important; /* Force the color change on hover */
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2);
text-decoration: none !important; /* Ensure no underline on hover */
}
.user-type-links a:visited {
color: #2c3e50 !important; /* Ensure visited links have the same color */
}
.user-type-links a::before {
content: "→";
margin-right: 5px;
font-size: 1.1em;
}
</style>
<h2 class="section-heading">Who is it for?</h2>
<p>We see HAL being useful for four types of users:</p>
<div class="user-types-container">
<div class="user-type">
<h3 class="user-type-title">Downstream Users & Procurers</h3>
<p class="user-type-description">Customers looking to deploy agents can get visibility into existing benchmarks, know developers building useful agents, and identify the state of the art for both cost and accuracy for their tasks of interest.</p>
<div class="user-type-links">
<a href="#leaderboards">Leaderboards</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Agent Benchmark Developers</h3>
<p class="user-type-description">Reporting results on a centralized leaderboard could allow improved visibility into agent benchmarks that measure real-world utility.</p>
<div class="user-type-links">
<a href="#benchmark-submission">Add a Benchmark</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Agent Developers</h3>
<p class="user-type-description">HAL allows for easy reproduction of past agents, clear comparison with past baselines, and a straightforward way to compete on a leaderboard.</p>
<div class="user-type-links">
<a href="#agent-submission">Submit an Agent</a>
<a href="#leaderboards">Leaderboards</a>
<a href="#reproduction-guide">Reproduction Guide</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Safety Researchers</h3>
<p class="user-type-description">Understanding agent capabilities on real-world safety threats and their associated costs is crucial. For example, Cybench evaluations could provide insights into agent performance and affordability for potential adversaries.</p>
<div class="user-type-links">
<a href="#cybench-results">Cybench Leaderboard (coming soon)</a>
<a href="#agent-monitor">Agent Monitor</a>
</div>
</div>
</div>
</br>
<h2 class="section-heading" id="leaderboards">Leaderboards</h2>
<p>Select a benchmark to see the agent leaderboard. Verified results have been run by the HAL team:</p>
""")
with gr.Tabs() as tabs:
with gr.Tab("CORE-Bench"):
gr.HTML("""
<p>
CORE-Bench evaluates the ability of agents to computationally reproduce the results of published scientific papers. Agents are given the codebase of a paper and must install all libraries and dependencies, run the code, and read through the output and figures to answer questions about the paper. The benchmark has tasks at three difficulty levels:
</p>
""")
with gr.Tab("CORE-Bench-Hard"):
gr.HTML("""
<p>
<i><b>CORE-Bench-Hard:</b></i> The agent is given the codebase of the paper and must install all libraries and dependencies, run the code, and read through the output and figures to answer questions about the paper. This level is most akin to fully reproducing a paper and is the most realistic and challenging level.
</p>
""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_hard'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.COREBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.COREBENCH_HIDE_COLUMNS,
search_columns=config.COREBENCH_SEARCH_COLUMNS,
)
# gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost on CORE-Bench-Hard")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_hard', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('corebench_hard'),
'CORE-Bench-Hard'
),
outputs=[task_success_heatmap]
)
with gr.Tab("CORE-Bench-Medium"):
gr.HTML("""
<p>
<i><b>CORE-Bench-Medium:</b></i> The agent is given a Dockerfile and instructions on how to use the Dockerfile to fully reproduce the paper. This level mainly evaluates agents ability to use and interact with the terminal. The agent must then answer questions about the output of the code, as in the above level.
</p>
""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_medium'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.COREBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.COREBENCH_HIDE_COLUMNS,
search_columns=config.COREBENCH_SEARCH_COLUMNS,
)
# gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost on CORE-Bench-Medium")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_medium', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('corebench_medium'),
'CORE-Bench-Medium'
),
outputs=[task_success_heatmap]
)
with gr.Tab("CORE-Bench-Easy"):
gr.HTML("""
<p>
<i><b>CORE-Bench-Easy:</b></i> The agent is given the output of the code and must answer questions about the output without running any code. To answer questions, agents must navigate through the terminal output as well as files and figures generated by the code.
</p>
""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_easy'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.COREBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.COREBENCH_HIDE_COLUMNS,
search_columns=config.COREBENCH_SEARCH_COLUMNS,
)
# gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost on CORE-Bench-Easy")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'corebench_easy', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('corebench_easy'),
'CORE-Bench-Easy'
),
outputs=[task_success_heatmap]
)
gr.Markdown((Path(__file__).parent / "agent_submission_core.md").read_text())
with gr.Tab("USACO"):
gr.Markdown("""The USA Computing Olympiad (USACO) is a computer programming competition for pre-college students. This benchmark evaluates the performance of AI agents on a set of 307 USACO tasks. The agents are evaluated based on the number of tasks correctly solved.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'usaco'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.USACO_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.USACO_HIDE_COLUMNS,
search_columns=config.USACO_SEARCH_COLUMNS,
)
gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for USACO agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'usaco', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('usaco'),
'USACO'
),
outputs=[task_success_heatmap]
)
gr.HTML("""
<style>
.grouped-section {
border: 2px solid #dee2e6; /* Color matching unactivated tabs */
border-radius: 10px;
padding: 30px;
margin-top: 40px;
margin-bottom: 40px;
position: relative;
}
.grouped-section-title {
font-size: 1.7em;
font-weight: bold;
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #dee2e6;
}
</style>
""")
with gr.Group(elem_classes=["grouped-section"]):
gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
gr.Markdown('The agent monitor provides an overview of the recurring errors an agent makes as well as a summary of the steps the agent takes to solve a task. It currently consists of two main components:')
gr.HTML('<div style="height: 10px;"></div>')
gr.Markdown("## Failure report for each agent")
gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="usaco", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task overview")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select USACO Task")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "usaco")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("SWE-bench Verified (Mini)"):
gr.Markdown("""SWE-bench is a dataset that tests systems' ability to solve GitHub issues automatically. Verified is a human-validated subset of 500 problems reviewed by software engineers. The We are currently actively developing this platform and this benchmark is not fully implemented yet.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified_mini'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.SWEBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.SWEBENCH_HIDE_COLUMNS,
search_columns=config.SWEBENCH_SEARCH_COLUMNS,
)
gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for SWE-bench agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified_mini', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in SWE-bench are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('swebench_verified_mini'),
'SWE-bench Verified'
),
outputs=[task_success_heatmap]
)
# gr.HTML("""
# <style>
# .grouped-section {
# border: 2px solid #dee2e6; /* Color matching unactivated tabs */
# border-radius: 10px;
# padding: 30px;
# margin-top: 40px;
# margin-bottom: 40px;
# position: relative;
# }
# .grouped-section-title {
# font-size: 1.7em;
# font-weight: bold;
# color: #2c3e50;
# margin-bottom: 20px;
# padding-bottom: 10px;
# border-bottom: 2px solid #dee2e6;
# }
# </style>
# """)
# with gr.Group(elem_classes=["grouped-section"]):
# gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
# gr.HTML('<div style="height: 10px;"></div>')
# gr.Markdown("## Failure report for each agent")
# gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_categories_overview = gr.Markdown()
# with gr.Column(scale=1):
# failure_categories_chart = gr.Plot()
# # Initialize the failure report agent dropdown with all agents
# demo.load(update_agent_dropdown,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)],
# outputs=[failure_report_agent_dropdown])
# # Update failure report when agent is selected
# failure_report_agent_dropdown.change(update_failure_report,
# inputs=[failure_report_agent_dropdown, gr.Textbox(value="swebench_verified", visible=False)],
# outputs=[failure_categories_overview, failure_categories_chart])
# gr.HTML('<div style="height: 30px;"></div>')
# gr.Markdown("## Task overview")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# agent_dropdown = gr.Dropdown(label="Select Agent")
# with gr.Column(scale=1):
# task_dropdown = gr.Dropdown(label="Select SWE-bench Verified Task")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# task_overview = gr.Markdown()
# with gr.Row():
# flow_chart = gr.Plot(label="Task Flow")
# # Initialize the agent dropdown with the best agent
# demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
# demo.load(update_task_analysis, inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
# agent_dropdown.change(update_task_analysis,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown],
# outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
# task_dropdown.change(update_task_details,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown, task_dropdown],
# outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified_mini")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "swebench_verified_mini")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified_mini")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified_mini")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_verified_mini", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("SWE-bench Verified"):
gr.Markdown("""SWE-bench is a dataset that tests systems' ability to solve GitHub issues automatically. Verified is a human-validated subset of 500 problems reviewed by software engineers. The We are currently actively developing this platform and this benchmark is not fully implemented yet.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.SWEBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.SWEBENCH_HIDE_COLUMNS,
search_columns=config.SWEBENCH_SEARCH_COLUMNS,
)
gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for SWE-bench agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in SWE-bench are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('swebench_verified'),
'SWE-bench Verified'
),
outputs=[task_success_heatmap]
)
# gr.HTML("""
# <style>
# .grouped-section {
# border: 2px solid #dee2e6; /* Color matching unactivated tabs */
# border-radius: 10px;
# padding: 30px;
# margin-top: 40px;
# margin-bottom: 40px;
# position: relative;
# }
# .grouped-section-title {
# font-size: 1.7em;
# font-weight: bold;
# color: #2c3e50;
# margin-bottom: 20px;
# padding-bottom: 10px;
# border-bottom: 2px solid #dee2e6;
# }
# </style>
# """)
# with gr.Group(elem_classes=["grouped-section"]):
# gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
# gr.HTML('<div style="height: 10px;"></div>')
# gr.Markdown("## Failure report for each agent")
# gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_categories_overview = gr.Markdown()
# with gr.Column(scale=1):
# failure_categories_chart = gr.Plot()
# # Initialize the failure report agent dropdown with all agents
# demo.load(update_agent_dropdown,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)],
# outputs=[failure_report_agent_dropdown])
# # Update failure report when agent is selected
# failure_report_agent_dropdown.change(update_failure_report,
# inputs=[failure_report_agent_dropdown, gr.Textbox(value="swebench_verified", visible=False)],
# outputs=[failure_categories_overview, failure_categories_chart])
# gr.HTML('<div style="height: 30px;"></div>')
# gr.Markdown("## Task overview")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# agent_dropdown = gr.Dropdown(label="Select Agent")
# with gr.Column(scale=1):
# task_dropdown = gr.Dropdown(label="Select SWE-bench Verified Task")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# task_overview = gr.Markdown()
# with gr.Row():
# flow_chart = gr.Plot(label="Task Flow")
# # Initialize the agent dropdown with the best agent
# demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
# demo.load(update_task_analysis, inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
# agent_dropdown.change(update_task_analysis,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown],
# outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
# task_dropdown.change(update_task_details,
# inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown, task_dropdown],
# outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "swebench_verified")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("SWE-bench Lite"):
gr.Markdown("""SWE-bench is a dataset that tests systems' ability to solve GitHub issues automatically. Lite is a subset of 300 tasks of the original SWE-bench. We are currently actively developing this platform and this benchmark is not fully implemented yet.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_lite'), ci_metrics=["Accuracy", "Total Cost"]),
select_columns=SelectColumns(
default_selection=config.SWEBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.SWEBENCH_HIDE_COLUMNS,
search_columns=config.SWEBENCH_SEARCH_COLUMNS,
)
gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for SWE-bench agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_lite', aggregate=False), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in SWE-bench are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('swebench_lite'),
'SWE-bench Lite'
),
outputs=[task_success_heatmap]
)
gr.HTML("""
<style>
.grouped-section {
border: 2px solid #dee2e6; /* Color matching unactivated tabs */
border-radius: 10px;
padding: 30px;
margin-top: 40px;
margin-bottom: 40px;
position: relative;
}
.grouped-section-title {
font-size: 1.7em;
font-weight: bold;
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #dee2e6;
}
</style>
""")
with gr.Group(elem_classes=["grouped-section"]):
gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
gr.HTML('<div style="height: 10px;"></div>')
gr.Markdown("## Failure report for each agent")
gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="swebench_lite", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task overview")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select SWE-bench Lite Task")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "swebench_lite")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("MLAgentBench"):
gr.Markdown("""MLAgentBench is a suite of end-to-end Machine Learning (ML) experimentation tasks, where the agent aims to take a given dataset and a machine learning task description and autonomously develop or improve an ML model. We are currently actively developing this platform and this benchmark is not fully implemented yet. In particular, we only include one agent and a subset of tasks for this benchmark.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=create_leaderboard(parse_json_files(os.path.join(abs_path, "evals_live"), 'mlagentbench')),
select_columns=SelectColumns(
default_selection=config.MLAGENTBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.MLAGENTBENCH_HIDE_COLUMNS,
search_columns=config.MLAGENTBENCH_SEARCH_COLUMNS,
)
gr.Markdown("""*Error ranges span from the lowest to highest observed values in repeated runs.*""", elem_classes=["text-right"])
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for MLAgentBench agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'mlagentbench', aggregate=False), "Total Cost", "Overall Score", "Total Cost (in USD)", "Overall Score", ["Agent Name"]))
# gr.HTML('<div style="height: 30px;"></div>')
# gr.Markdown("## Task success heatmap")
# gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least. For agents that have been run more than once, the run with the highest score is shown.")
# with gr.Row():
# task_success_heatmap = gr.Plot()
# demo.load(
# lambda: create_task_success_heatmap(
# preprocessor.get_task_success_data('usaco'),
# 'USACO'
# ),
# outputs=[task_success_heatmap]
# )
gr.HTML("""
<style>
.grouped-section {
border: 2px solid #dee2e6; /* Color matching unactivated tabs */
border-radius: 10px;
padding: 30px;
margin-top: 40px;
margin-bottom: 40px;
position: relative;
}
.grouped-section-title {
font-size: 1.7em;
font-weight: bold;
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #dee2e6;
}
</style>
""")
with gr.Group(elem_classes=["grouped-section"]):
gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
# gr.HTML('<div style="height: 10px;"></div>')
# gr.Markdown("## Failure report for each agent")
# gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
# gr.HTML('<div style="height: 10px;"></div>')
# with gr.Row():
# with gr.Column(scale=1):
# failure_categories_overview = gr.Markdown()
# with gr.Column(scale=1):
# failure_categories_chart = gr.Plot()
# # Initialize the failure report agent dropdown with all agents
# demo.load(update_agent_dropdown,
# inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)],
# outputs=[failure_report_agent_dropdown])
# # Update failure report when agent is selected
# failure_report_agent_dropdown.change(update_failure_report,
# inputs=[failure_report_agent_dropdown, gr.Textbox(value="mlagentbench", visible=False)],
# outputs=[failure_categories_overview, failure_categories_chart])
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task overview")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select MLAgentBench Task")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "mlagentbench")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("About"):
gr.Markdown((Path(__file__).parent / "about.md").read_text())
# Will trigger autoscaling of plots when tabs are switched
tabs.select(fn=None, inputs=None, outputs=None, js="""
function() {
setTimeout(function() {
window.dispatchEvent(new Event('resize'));
}, 100);
}
""")
gr.HTML("""<h2 class="section-heading" id="agent-submission">How to add an agent to HAL leaderboards?</h2>""")
gr.Markdown((Path(__file__).parent / "agent_submission.md").read_text())
gr.HTML("""<h2 class="section-heading" id="benchmark-submission">How to add a benchmark to HAL?</h2>""")
gr.Markdown((Path(__file__).parent / "benchmark_submission.md").read_text())
gr.HTML("""<h2 class="section-heading" id="reproduction-guide">How can I run evaluations?</h2>""")
gr.Markdown("""Coming soon...""")
async def main():
# Preprocess traces
# preprocessor = TracePreprocessor()
# preprocessor.preprocess_traces('evals_live')
# preprocessor = TracePreprocessor()
# Download the results from the Hugging Face Hub
# await asyncio.to_thread(download_latest_results)
# # Check for new uploads and process them
# await check_and_process_uploads()
scheduler = AsyncIOScheduler()
scheduler.add_job(restart_space, "interval", hours=1)
# scheduler.add_job(download_latest_results, "interval", hours=1)
# scheduler.add_job(check_and_process_uploads, "interval", hours=1)
scheduler.start()
await demo.launch(favicon_path="hal.png")
if __name__ == "__main__":
weave.init(f'leaderboard_{datetime.now().strftime("%Y%m%d%H%M%S")}')
asyncio.run(main()) |