File size: 35,748 Bytes
05398d1
 
 
ecb1e20
05398d1
 
 
363d8ae
386e6e6
e2be414
a3b611d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40b9d90
1e20a46
 
 
 
 
 
 
 
40b9d90
 
 
05398d1
a3b611d
 
 
05398d1
 
 
a3b611d
 
 
 
b5e722a
 
 
 
a3b611d
 
 
05398d1
765f7ba
b5e722a
 
a3b611d
 
 
 
 
 
 
b5e722a
 
a3b611d
b5e722a
765f7ba
05398d1
 
40b9d90
 
 
 
 
05398d1
a3b611d
 
05398d1
a3b611d
1e20a46
a3b611d
 
 
 
 
 
e2be414
a3b611d
e2be414
 
363d8ae
1e20a46
 
 
 
 
e2be414
 
a3b611d
e2be414
 
 
 
40b9d90
a3b611d
40b9d90
f32be22
 
40b9d90
 
 
 
a3b611d
e2be414
 
 
a3b611d
1e20a46
a3b611d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e20a46
e2be414
a3b611d
 
 
 
 
 
1e20a46
 
a3b611d
 
 
 
1e20a46
363d8ae
 
 
 
a3b611d
363d8ae
 
 
 
 
a3b611d
363d8ae
 
 
 
 
 
 
765f7ba
 
 
 
 
 
 
 
363d8ae
05398d1
 
 
1e20a46
05398d1
 
 
 
e2be414
f32be22
05398d1
 
 
1e20a46
05398d1
 
 
 
 
e2be414
 
 
 
 
 
 
 
05398d1
 
 
 
 
9b33059
05398d1
 
 
e2be414
05398d1
 
baec6d9
 
 
a3b611d
 
 
 
baec6d9
a3b611d
05398d1
 
 
 
1e20a46
 
 
f32be22
 
 
1e20a46
05398d1
1e20a46
 
363d8ae
 
765f7ba
05398d1
 
363d8ae
 
 
1e20a46
baec6d9
 
 
363d8ae
 
 
 
e2be414
363d8ae
 
 
 
 
 
 
05398d1
363d8ae
 
 
 
 
 
 
 
 
 
 
 
05398d1
 
 
 
40b9d90
 
05398d1
 
 
baec6d9
 
 
a3b611d
05398d1
a3b611d
05398d1
 
a3b611d
363d8ae
05398d1
 
 
 
e2be414
05398d1
 
 
 
40b9d90
05398d1
d3905ad
05398d1
 
 
 
40b9d90
 
1e20a46
 
 
 
 
40b9d90
a3b611d
40b9d90
b5e722a
 
05398d1
 
 
 
 
a3b611d
05398d1
b5e722a
40b9d90
05398d1
3ce2cf9
05398d1
 
a3b611d
05398d1
 
 
 
 
e2be414
363d8ae
e2be414
 
 
 
 
 
 
a3b611d
e2be414
a3b611d
 
e2be414
 
40b9d90
b5e722a
40b9d90
 
 
 
b5e722a
1e20a46
e2be414
05398d1
1e20a46
 
a3b611d
1e20a46
b5e722a
1e20a46
 
a3b611d
 
05398d1
 
1e20a46
05398d1
 
b5e722a
1e20a46
05398d1
 
1e20a46
baec6d9
 
 
 
 
 
 
a3b611d
 
baec6d9
 
 
 
 
 
 
b5e722a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363d8ae
 
 
 
 
 
 
 
 
 
2bc564e
 
 
 
 
 
 
 
282d506
2bc564e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282d506
b5e722a
baec6d9
a3b611d
 
 
d3905ad
a3b611d
ae274a0
 
b5b0302
a3b611d
 
 
 
 
 
 
 
 
 
 
b5e722a
d87af0c
b5e722a
a3b611d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05398d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d3905ad
 
05398d1
 
 
 
d3905ad
 
 
 
05398d1
 
 
 
 
d3905ad
 
05398d1
 
 
 
1138892
d3905ad
05398d1
 
 
 
 
d3905ad
05398d1
 
 
 
d3905ad
05398d1
 
ecb1e20
05398d1
1138892
d3905ad
05398d1
 
 
 
 
d3905ad
05398d1
 
 
 
 
d3905ad
 
05398d1
 
 
 
 
1138892
d3905ad
05398d1
 
b5e722a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import hashlib
import os

import pandas as pd
import plotly.express as px
import streamlit as st
from bat import Benchmark, Config, Reporter, Tester
from datetime import datetime


st.set_page_config(
    page_title="BenchBench",
    page_icon="🏋️‍♂️",
    layout="wide",
    initial_sidebar_state="auto",
    menu_items=None,
)

# # Inject custom CSS to set the width of the sidebar
# st.markdown(
#     """
#     <style>
#         section[data-testid="stSidebar"] {
#             width: 200px !important; # Set the width to your desired value
#         }
#     </style>
#     """,
#     unsafe_allow_html=True,
# )

holistic_scenarios = [
    "Helm Lite",
    "HF OpenLLM v2",
    "OpenCompass Academic",
    "LMSys Arena",
    "Helm Classic",
    "AlphacaEval v2lc",
    "LiveBench 240725",
    "WildBench Elo LC",
]


st.markdown(
    """
    <h1 style='text-align: center; color: black;'>🏋️‍♂️ BenchBench Leaderboard 🏋️‍♂️</h1>
    """,
    unsafe_allow_html=True,
)

st.divider()

st.markdown(
    """
    BenchBench rates benchmarks according to their agreement with the defined *Aggregate Benchmark* – 
    an enhanced representation of the benchmarks that are out there (see config in sidebar to modify).


    """
)

st.markdown(
    """
    BenchBench is for you if:
    \n
    - **You have a new benchmark**: Show that it agrees/disagrees with known benchmarks.
    - **You are looking for a benchmark to run/trust**: Find an efficient/private/preferble alternative.
    """
)

st.markdown(
    """
    We also show that agreements are best represented with the the BenchBench Score, 
    the relative agreement (Z Score) of each benchmark to the Aggragate benchmark.
    \n
    Read more in our work [Benchmark Agreement Testing Done Right](https://arxiv.org/abs/2407.13696) and the [BenchBench repo](https://github.com/IBM/benchbench)
    """
)

all_scenarios_for_aggragate = Benchmark()
all_scenarios_for_aggragate.load_local_catalog()
all_scenarios_for_aggragate = (
    all_scenarios_for_aggragate.df["scenario"].unique().tolist()
)

with st.sidebar:
    st.markdown("""# Configurations""")

    # with st.expander("Leaderboard configurations (defaults are great BTW)", icon="⚙️"):
    with st.form("my_form_1"):
        aggragate_scenarios = st.multiselect(
            "Aggregate Benchmark",
            all_scenarios_for_aggragate,
            holistic_scenarios,
        )

        corr_type = st.selectbox(
            label="Correlation type", options=["kendall", "pearson"], index=0
        )

        aggregate_scenario_whitelist = aggragate_scenarios
        # [
        #     scen
        #     for scen in all_scenarios_for_aggragate
        #     if scen not in aggragate_scenarios
        # ]

        model_select_strategy = st.selectbox(
            label="Model Select strategy",
            options=["random", "top_aggregate", "somewhere_aggregate"],
            index=0,
        )

        n_models_taken_list = st.slider(
            label="Minimal number of models to use",
            min_value=3,
            max_value=15,
            value=8,
        )

        n_models_taken_list = [n_models_taken_list]

        n_exps = 5

        submitted = st.form_submit_button(label="Run BAT")


with st.expander("Add your benchmarks here!", icon="🔥"):
    aggbench = Benchmark()
    aggbench.load_local_catalog()

    aggbench.add_aggregate(
        new_col_name="aggregate",
        agg_source_name="aggregate",
        scenario_whitelist=aggregate_scenario_whitelist,
        min_scenario_for_models_to_appear_in_agg=1
        if len(aggregate_scenario_whitelist) == 1
        else 3,
    )

    agg_models = (
        aggbench.df.query('scenario=="aggregate"').sample(n=10)["model"].tolist()
    )

    st.markdown(
        "Adding your benchmark is as simple as uploading a csv with the following format, one column indicates the model and the other the benchmark scores."
    )

    st.dataframe(
        pd.read_csv("assets/mybench_240901.csv"),
        use_container_width=True,
        hide_index=True,
        height=200,
    )

    st.markdown(
        "Not sure, what models you should run your benchmark on?" "\ntry these:"
    )

    st.code(agg_models)

    st.markdown("Got the data? Upload it here 👇:")

    uploaded_file = st.file_uploader("Add your benchmark as a CSV")

    my_benchmark = Benchmark()
    if uploaded_file is not None:
        st.markdown(
            "Your benchmark has been uploaded, BAT results will soon be caluclated... check out its results here: [Benchmark BAT Report Card](#benchmark-report-card)"
        )

        df = pd.read_csv(uploaded_file)

        my_benchmark.assign_df(
            df,
            data_source=f"uploaded_benchmark_{datetime.now().strftime('%y%m%d')}.csv",
            normalized_names=False,
        )

        uploaded_models = my_benchmark.df[
            my_benchmark.df["source"].str.contains("uploaded")
        ]["model"].unique()
        aggregate_models = aggbench.df[aggbench.df["source"].str.contains("aggregate")][
            "model"
        ].unique()

        # Find the intersection (overlap) of models
        overlap_models = set(aggregate_models).intersection(uploaded_models)
        if len(overlap_models) < n_models_taken_list[0]:
            st.warning(
                f"You have just {len(overlap_models)} models intersecting with the aggregate!\n"
            )

            st.info(
                f"Here are some models you could run your benchmark over:{[m for m in aggregate_models if m not in uploaded_models]}"
            )
            st.info(
                f"Model that you have and the aggragate does not: {[m for m in uploaded_models if m not in aggregate_models]}"
            )


def run_load(
    aggregate_scenario_whitelist,
    n_models_taken_list=[5],
    model_select_strategy_list=["random"],
    corr_types=["kendall"],
    n_exps=10,
    my_benchmark=Benchmark(),
    use_caching=True,
):
    # Create a hash of the inputs to generate a unique cache file for each set of inputs
    input_str = (
        str(aggregate_scenario_whitelist)
        + str(n_models_taken_list)
        + str(model_select_strategy_list)
        + str(corr_types)
        + str(n_exps)
    )

    if not my_benchmark.is_empty:
        input_str += str(
            hashlib.sha256(
                my_benchmark.df.to_csv(index=False).encode("utf-8")
            ).hexdigest()
        )

    input_hash = hashlib.md5(input_str.encode()).hexdigest()
    cache_file = f"agreements_cache_{input_hash}.csv"

    # Define the cache directory
    cache_dir = "cache"
    os.makedirs(cache_dir, exist_ok=True)
    cache_path = os.path.join(cache_dir, cache_file)

    # Check if the cache file exists
    if os.path.exists(cache_path) and use_caching:
        print("Loading cached results...")
        agreements = pd.read_csv(cache_path)
        aggregate_scores = pd.read_csv(
            cache_path.replace("agreement", "aggregate_scores")
        )
        allbench = Benchmark(
            pd.read_csv(cache_path.replace("agreement", "allbench")),
            normalized_names=True,
        )

        return agreements, aggregate_scores, allbench

    else:
        print("Cached results not found, calculating")

        allbench = Benchmark()
        allbench.load_local_catalog()

        scenarios_to_drop = ["HFv2 BBH Raw"]
        allbench.df = allbench.df.query("scenario not in @scenarios_to_drop")

        allbench.add_aggregate(
            new_col_name="aggregate",
            agg_source_name="aggregate",
            scenario_whitelist=aggregate_scenario_whitelist,
            min_scenario_for_models_to_appear_in_agg=1
            if len(aggregate_scenario_whitelist) == 1
            else len(aggregate_scenario_whitelist) // 3,
        )

        allbench.extend(my_benchmark)
        allbench.clear_repeated_scenarios()

        aggragate_scores = allbench.df.query('scenario=="aggregate"')[
            ["model", "score"]
        ].sort_values(by="score", ascending=False)

        if not my_benchmark.is_empty:
            aggragate_scores["in_uploaded"] = aggragate_scores["model"].apply(
                lambda x: x in my_benchmark.df["model"].unique()
            )

            # Get unique models for each scenario
            uploaded_models = allbench.df[
                allbench.df["source"].str.contains("uploaded")
            ]["model"].unique()
            aggregate_models = allbench.df[
                allbench.df["source"].str.contains("aggregate")
            ]["model"].unique()

            # Find the intersection (overlap) of models
            n_overlap_models = len(set(aggregate_models).intersection(uploaded_models))
            # make sure we are asking for the maximal number of models between the request benchmark and the aggregate
            n_models_taken_list = [min(n_models_taken_list[0], n_overlap_models)]

        cfg = Config(
            exp_to_run="example",
            n_models_taken_list=n_models_taken_list,
            model_select_strategy_list=model_select_strategy_list,
            corr_types=corr_types,
            n_exps=n_exps if n_models_taken_list != [0] else 1,
        )

        tester = Tester(cfg=cfg)

        agreements = tester.all_vs_all_agreement_testing(
            allbench,
            single_source_scenario="aggregate",  # olny measuring all with the aggragate
        )

        agreements.to_csv(cache_path, index=False)
        aggragate_scores.to_csv(
            cache_path.replace("agreement", "aggregate_scores"), index=False
        )
        allbench.df.to_csv(cache_path.replace("agreement", "allbench"), index=False)

    return agreements, aggragate_scores, allbench


agreements, aggragare_score_df, allbench = run_load(
    aggregate_scenario_whitelist=aggregate_scenario_whitelist,
    n_models_taken_list=n_models_taken_list,
    model_select_strategy_list=[model_select_strategy],
    corr_types=[corr_type],
    n_exps=n_exps,
    my_benchmark=my_benchmark,
)

reporter = Reporter()
z_scores = reporter.get_all_z_scores(agreements=agreements, aggragate_name="aggregate")
z_scores.drop(columns=["n_models_of_corr_with_agg"], inplace=True)

corr_name = f"{'Kendall Tau' if corr_type=='kendall' else 'Per.'} Corr. w/ Agg"

z_scores["z_score"] = z_scores["z_score"].round(2)
z_scores["corr_with_agg"] = z_scores["corr_with_agg"].round(2)
z_scores["p_value_of_corr_with_agg"] = z_scores["p_value_of_corr_with_agg"].round(2)
# z_scores["n_models_of_corr_with_agg"] = z_scores["n_models_of_corr_with_agg"].round(1)

z_scores["date"] = z_scores["source"].apply(
    lambda x: x.split(".csv")[0].split("_")[-1]
    if "frozen" not in x
    else x.split(".csv")[0].split("_")[-2]
)

z_scores["date"] = pd.to_datetime("20" + z_scores["date"]).dt.date

z_score_name = "BenchBench Score"
p_val_name = "p val"

data = (
    z_scores.rename(
        columns={
            "scenario": "Benchmark",
            "z_score": z_score_name,
            "corr_with_agg": corr_name,
            "p_value_of_corr_with_agg": p_val_name,
            # "n_models_of_corr_with_agg": "# Models Used",
            "source": "Source",
            "date": "Snapshot Date",
        }
    )
    .sort_values(z_score_name, ascending=False)
    .reset_index(drop=True)
)


# Apply coloring based on 'Z' valuesz
def highlight_uploaded_benchmark(row):
    if "uploaded_benchmark" in row["Source"]:
        return ["background-color: rgba(100,100,100,0.1)"] * len(row)
    else:
        return [""] * len(row)


styled_data = (
    data.style.background_gradient(
        subset=[z_score_name],
        cmap="RdYlGn",
        vmin=-data[z_score_name].abs().max(),
        vmax=data[z_score_name].abs().max(),
    )
    .apply(highlight_uploaded_benchmark, axis=1)
    .background_gradient(
        subset=[p_val_name],
        cmap="Reds",
        vmin=0.1,
        vmax=1,
    )
    .format(subset=[z_score_name, corr_name, p_val_name], formatter="{:.2}")
    .set_properties(**{"text-align": "center"})
)

cols_used = [
    "Benchmark",
    z_score_name,
    corr_name,
    p_val_name,
    "Snapshot Date",
]


st.dataframe(
    data=styled_data,
    column_order=cols_used,
    hide_index=True,
    use_container_width=True,
    height=300,
    column_config={col: {"alignment": "center"} for col in cols_used},
)


aggragare_score_df.rename(
    columns={
        "model": "Model",
        "score": "Mean Win Rate over Selected Scenarios for Aggragate",
    },
    inplace=True,
)

with st.expander(label="Aggragate Benchmark scores"):
    st.dataframe(
        data=aggragare_score_df,
        hide_index=True,
        height=500,
        use_container_width=True,
    )

left, right = st.columns([1, 1])

with left:
    with st.expander(label="Cite Us!"):
        st.code(
            r"""

    @misc{perlitz2024llmbenchmarksagreefixing,
        title={Do These LLM Benchmarks Agree? Fixing Benchmark Evaluation with BenchBench}, 
        author={Yotam Perlitz and Ariel Gera and Ofir Arviv and Asaf Yehudai and Elron Bandel and Eyal Shnarch and Michal Shmueli-Scheuer and Leshem Choshen},
        year={2024},
        eprint={2407.13696},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2407.13696}, 
    }

"""
        )

with right:
    with st.expander(label="Cite Everyone Else!"):
        st.code(
            r"""

    @misc{perlitz2024llmbenchmarksagreefixing,
        title={Do These LLM Benchmarks Agree? Fixing Benchmark Evaluation with BenchBench}, 
        author={Yotam Perlitz and Ariel Gera and Ofir Arviv and Asaf Yehudai and Elron Bandel and Eyal Shnarch and Michal Shmueli-Scheuer and Leshem Choshen},
        year={2024},
        eprint={2407.13696},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2407.13696}, 
    }
        

    @misc{berkeley-function-calling-leaderboard,
        title={Berkeley Function Calling Leaderboard}, 
        author={Fanjia Yan and Huanzhi Mao and Charlie Cheng-Jie Ji
        and Tianjun Zhang and Shishir G. Patil and Ion Stoica and Joseph E.
        Gonzalez},
        howpublished={\url{https://gorilla.cs.berkeley.edu/blogs/8_berkeley_function_calling_leaderboard.html}},
        year={2024},
    }

    @misc{liu2023agentbenchevaluatingllmsagents,
        title={AgentBench: Evaluating LLMs as Agents}, 
        author={Xiao Liu and Hao Yu and Hanchen Zhang and Yifan Xu and Xuanyu Lei and Hanyu Lai and Yu Gu and Hangliang Ding and Kaiwen Men and Kejuan Yang and Shudan Zhang and Xiang Deng and Aohan Zeng and Zhengxiao Du and Chenhui Zhang and Sheng Shen and Tianjun Zhang and Yu Su and Huan Sun and Minlie Huang and Yuxiao Dong and Jie Tang},
        year={2023},
        eprint={2308.03688},
        archivePrefix={arXiv},
        primaryClass={cs.AI},
        url={https://arxiv.org/abs/2308.03688}, 
    }
            
    @software{Li_AlpacaEval_An_Automatic_2023,
        author = {Li, Xuechen and Zhang, Tianyi and Dubois, Yann and Taori, Rohan and Gulrajani, Ishaan and Guestrin, Carlos and Liang, Percy and Hashimoto, Tatsunori B.},
        month = may,
        title = {{AlpacaEval: An Automatic Evaluator of Instruction-following Models}},
        year = {2023}
    }
            
    @misc{li2024crowdsourceddatahighqualitybenchmarks,
        title={From Crowdsourced Data to High-Quality Benchmarks: Arena-Hard and BenchBuilder Pipeline}, 
        author={Tianle Li and Wei-Lin Chiang and Evan Frick and Lisa Dunlap and Tianhao Wu and Banghua Zhu and Joseph E. Gonzalez and Ion Stoica},
        year={2024},
        eprint={2406.11939},
        archivePrefix={arXiv},
        primaryClass={cs.LG},
        url={https://arxiv.org/abs/2406.11939}, 
    }
    @misc{chiang2024chatbot,
        title={Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference},
        author={Wei-Lin Chiang and Lianmin Zheng and Ying Sheng and Anastasios Nikolas Angelopoulos and Tianle Li and Dacheng Li and Hao Zhang and Banghua Zhu and Michael Jordan and Joseph E. Gonzalez and Ion Stoica},
        year={2024},
        eprint={2403.04132},
        archivePrefix={arXiv},
        primaryClass={cs.AI}
    }
    @misc{arenahard2024,
        title = {From Live Data to High-Quality Benchmarks: The Arena-Hard Pipeline},
        url = {https://lmsys.org/blog/2024-04-19-arena-hard/},
        author = {Tianle Li*, Wei-Lin Chiang*, Evan Frick, Lisa Dunlap, Banghua Zhu, Joseph E. Gonzalez, Ion Stoica},
        month = {April},
        year = {2024}
    }
            
    @misc{kim2024biggenbenchprincipledbenchmark,
        title={The BiGGen Bench: A Principled Benchmark for Fine-grained Evaluation of Language Models with Language Models}, 
        author={Seungone Kim and Juyoung Suk and Ji Yong Cho and Shayne Longpre and Chaeeun Kim and Dongkeun Yoon and Guijin Son and Yejin Cho and Sheikh Shafayat and Jinheon Baek and Sue Hyun Park and Hyeonbin Hwang and Jinkyung Jo and Hyowon Cho and Haebin Shin and Seongyun Lee and Hanseok Oh and Noah Lee and Namgyu Ho and Se June Joo and Miyoung Ko and Yoonjoo Lee and Hyungjoo Chae and Jamin Shin and Joel Jang and Seonghyeon Ye and Bill Yuchen Lin and Sean Welleck and Graham Neubig and Moontae Lee and Kyungjae Lee and Minjoon Seo},
        year={2024},
        eprint={2406.05761},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2406.05761}, 
    }
                
    @misc{liang2023holisticevaluationlanguagemodels,
        title={Holistic Evaluation of Language Models}, 
        author={Percy Liang and Rishi Bommasani and Tony Lee and Dimitris Tsipras and Dilara Soylu and Michihiro Yasunaga and Yian Zhang and Deepak Narayanan and Yuhuai Wu and Ananya Kumar and Benjamin Newman and Binhang Yuan and Bobby Yan and Ce Zhang and Christian Cosgrove and Christopher D. Manning and Christopher Ré and Diana Acosta-Navas and Drew A. Hudson and Eric Zelikman and Esin Durmus and Faisal Ladhak and Frieda Rong and Hongyu Ren and Huaxiu Yao and Jue Wang and Keshav Santhanam and Laurel Orr and Lucia Zheng and Mert Yuksekgonul and Mirac Suzgun and Nathan Kim and Neel Guha and Niladri Chatterji and Omar Khattab and Peter Henderson and Qian Huang and Ryan Chi and Sang Michael Xie and Shibani Santurkar and Surya Ganguli and Tatsunori Hashimoto and Thomas Icard and Tianyi Zhang and Vishrav Chaudhary and William Wang and Xuechen Li and Yifan Mai and Yuhui Zhang and Yuta Koreeda},
        year={2023},
        eprint={2211.09110},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2211.09110}, 
    }


    @misc{open-llm-leaderboard-v2,
    author = {Clémentine Fourrier and Nathan Habib and Alina Lozovskaya and Konrad Szafer and Thomas Wolf},
    title = {Open LLM Leaderboard v2},
    year = {2024},
    publisher = {Hugging Face},
    howpublished = "\url{https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard}",
    }

    @software{eval-harness,
        author       = {Gao, Leo and
                        Tow, Jonathan and
                        Biderman, Stella and
                        Black, Sid and
                        DiPofi, Anthony and
                        Foster, Charles and
                        Golding, Laurence and
                        Hsu, Jeffrey and
                        McDonell, Kyle and
                        Muennighoff, Niklas and
                        Phang, Jason and
                        Reynolds, Laria and
                        Tang, Eric and
                        Thite, Anish and
                        Wang, Ben and
                        Wang, Kevin and
                        Zou, Andy},
        title        = {A framework for few-shot language model evaluation},
        month        = sep,
        year         = 2021,
        publisher    = {Zenodo},
        version      = {v0.0.1},
        doi          = {10.5281/zenodo.5371628},
        url          = {https://doi.org/10.5281/zenodo.5371628},
    }

    @misc{zhou2023instructionfollowingevaluationlargelanguage,
        title={Instruction-Following Evaluation for Large Language Models},
        author={Jeffrey Zhou and Tianjian Lu and Swaroop Mishra and Siddhartha Brahma and Sujoy Basu and Yi Luan and Denny Zhou and Le Hou},
        year={2023},
        eprint={2311.07911},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2311.07911},
    }

    @misc{suzgun2022challengingbigbenchtaskschainofthought,
        title={Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them},
        author={Mirac Suzgun and Nathan Scales and Nathanael Schärli and Sebastian Gehrmann and Yi Tay and Hyung Won Chung and Aakanksha Chowdhery and Quoc V. Le and Ed H. Chi and Denny Zhou and Jason Wei},
        year={2022},
        eprint={2210.09261},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2210.09261},
    }

    @misc{hendrycks2021measuringmathematicalproblemsolving,
        title={Measuring Mathematical Problem Solving With the MATH Dataset},
        author={Dan Hendrycks and Collin Burns and Saurav Kadavath and Akul Arora and Steven Basart and Eric Tang and Dawn Song and Jacob Steinhardt},
        year={2021},
        eprint={2103.03874},
        archivePrefix={arXiv},
        primaryClass={cs.LG},
        url={https://arxiv.org/abs/2103.03874},
    }

    @misc{rein2023gpqagraduatelevelgoogleproofqa,
        title={GPQA: A Graduate-Level Google-Proof Q&A Benchmark},
        author={David Rein and Betty Li Hou and Asa Cooper Stickland and Jackson Petty and Richard Yuanzhe Pang and Julien Dirani and Julian Michael and Samuel R. Bowman},
        year={2023},
        eprint={2311.12022},
        archivePrefix={arXiv},
        primaryClass={cs.AI},
        url={https://arxiv.org/abs/2311.12022},
    }

    @misc{sprague2024musrtestinglimitschainofthought,
        title={MuSR: Testing the Limits of Chain-of-thought with Multistep Soft Reasoning},
        author={Zayne Sprague and Xi Ye and Kaj Bostrom and Swarat Chaudhuri and Greg Durrett},
        year={2024},
        eprint={2310.16049},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2310.16049},
    }

    @misc{wang2024mmluprorobustchallengingmultitask,
        title={MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark},
        author={Yubo Wang and Xueguang Ma and Ge Zhang and Yuansheng Ni and Abhranil Chandra and Shiguang Guo and Weiming Ren and Aaran Arulraj and Xuan He and Ziyan Jiang and Tianle Li and Max Ku and Kai Wang and Alex Zhuang and Rongqi Fan and Xiang Yue and Wenhu Chen},
        year={2024},
        eprint={2406.01574},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2406.01574},
    }

    @misc{open-llm-leaderboard-v1,
        author = {Edward Beeching and Clémentine Fourrier and Nathan Habib and Sheon Han and Nathan Lambert and Nazneen Rajani and Omar Sanseviero and Lewis Tunstall and Thomas Wolf},
        title = {Open LLM Leaderboard (2023-2024)},
        year = {2023},
        publisher = {Hugging Face},
        howpublished = "\url{https://huggingface.co/spaces/open-llm-leaderboard-old/open_llm_leaderboard}"
    }
            
    @misc{open-llm-leaderboard,
        author = {Edward Beeching and Clémentine Fourrier and Nathan Habib and Sheon Han and Nathan Lambert and Nazneen Rajani and Omar Sanseviero and Lewis Tunstall and Thomas Wolf},
        title = {Open LLM Leaderboard},
        year = {2023},
        publisher = {Hugging Face},
        howpublished = "\url{https://huggingface.co/spaces/open-llm-leaderboard-old/open_llm_leaderboard}"
    }

    @misc{waldis2024holmesbenchmarklinguisticcompetence,
        title={Holmes: Benchmark the Linguistic Competence of Language Models}, 
        author={Andreas Waldis and Yotam Perlitz and Leshem Choshen and Yufang Hou and Iryna Gurevych},
        year={2024},
        eprint={2404.18923},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2404.18923}, 
    }       

    @article{livebench,
        author    = {White, Colin and Dooley, Samuel and Roberts, Manley and Pal, Arka and Feuer, Ben and Jain, Siddhartha and Shwartz-Ziv, Ravid and Jain, Neel and Saifullah, Khalid and Naidu, Siddartha and Hegde, Chinmay and LeCun, Yann and Goldstein, Tom and Neiswanger, Willie and Goldblum, Micah},
        title     = {LiveBench: A Challenging, Contamination-Free LLM Benchmark},
        url       = {arXiv preprint arXiv:2406.19314},
        year      = {2024},
    }  
            
    @article{ni2024mixeval,
        title={MixEval: Deriving Wisdom of the Crowd from LLM Benchmark Mixtures},
        author={Ni, Jinjie and Xue, Fuzhao and Yue, Xiang and Deng, Yuntian and Shah, Mahir and Jain, Kabir and Neubig, Graham and You, Yang},
        journal={arXiv preprint arXiv:2406.06565},
        year={2024}
    }
            
    @misc{wang2024mmluprorobustchallengingmultitask,
        title={MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark}, 
        author={Yubo Wang and Xueguang Ma and Ge Zhang and Yuansheng Ni and Abhranil Chandra and Shiguang Guo and Weiming Ren and Aaran Arulraj and Xuan He and Ziyan Jiang and Tianle Li and Max Ku and Kai Wang and Alex Zhuang and Rongqi Fan and Xiang Yue and Wenhu Chen},
        year={2024},
        eprint={2406.01574},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2406.01574}, 
    }
                
    @misc{zheng2023judgingllmasajudgemtbenchchatbot,
        title={Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena}, 
        author={Lianmin Zheng and Wei-Lin Chiang and Ying Sheng and Siyuan Zhuang and Zhanghao Wu and Yonghao Zhuang and Zi Lin and Zhuohan Li and Dacheng Li and Eric P. Xing and Hao Zhang and Joseph E. Gonzalez and Ion Stoica},
        year={2023},
        eprint={2306.05685},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2306.05685}, 
    }
            
    @misc{2023opencompass,
        title={OpenCompass: A Universal Evaluation Platform for Foundation Models},
        author={OpenCompass Contributors},
        howpublished = {\url{https://github.com/open-compass/opencompass}},
        year={2023}
    }
            
    @misc{qin2023toolllm,
        title={ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs}, 
        author={Yujia Qin and Shihao Liang and Yining Ye and Kunlun Zhu and Lan Yan and Yaxi Lu and Yankai Lin and Xin Cong and Xiangru Tang and Bill Qian and Sihan Zhao and Runchu Tian and Ruobing Xie and Jie Zhou and Mark Gerstein and Dahai Li and Zhiyuan Liu and Maosong Sun},
        year={2023},
        eprint={2307.16789},
        archivePrefix={arXiv},
        primaryClass={cs.AI}
    }
                
    @misc{qin2023tool,
        title={Tool Learning with Foundation Models}, 
        author={Yujia Qin and Shengding Hu and Yankai Lin and Weize Chen and Ning Ding and Ganqu Cui and Zheni Zeng and Yufei Huang and Chaojun Xiao and Chi Han and Yi Ren Fung and Yusheng Su and Huadong Wang and Cheng Qian and Runchu Tian and Kunlun Zhu and Shihao Liang and Xingyu Shen and Bokai Xu and Zhen Zhang and Yining Ye and Bowen Li and Ziwei Tang and Jing Yi and Yuzhang Zhu and Zhenning Dai and Lan Yan and Xin Cong and Yaxi Lu and Weilin Zhao and Yuxiang Huang and Junxi Yan and Xu Han and Xian Sun and Dahai Li and Jason Phang and Cheng Yang and Tongshuang Wu and Heng Ji and Zhiyuan Liu and Maosong Sun},
        year={2023},
        eprint={2304.08354},
        archivePrefix={arXiv},
        primaryClass={cs.CL}
    }
                
    @misc{guo2024stabletoolbench,
        title={StableToolBench: Towards Stable Large-Scale Benchmarking on Tool Learning of Large Language Models},
        author={Guo, Zhicheng and Cheng, Sijie and Wang, Hao and Liang, Shihao and Qin, Yujia and Li, Peng and Liu, Zhiyuan and Sun, Maosong and Liu, Yang},
        year={2024},
        eprint={2403.07714},
        archivePrefix={arXiv},
        primaryClass={cs.CL}
    }
            
    @article{yuchen2024wildbench,
        title={WildBench: Benchmarking LLMs with Challenging Tasks from Real Users in the Wild},
        author={Yuchen Lin, Bill and Deng, Yuntian and Chandu, Khyathi and Brahman, Faeze and Ravichander, Abhilasha and Pyatkin, Valentina and Dziri, Nouha and Le Bras, Ronan and Choi, Yejin},
        journal={arXiv e-prints},
        pages={arXiv--2406},
        year={2024}
    }
    
    """
        )


st.subheader("Benchmark Report Card")

st.markdown("Choose the Benchmark from which you want to get a report.")

benchmarks = data["Benchmark"].unique().tolist()

index_to_use = 1
if not my_benchmark.is_empty:
    index_to_use = benchmarks.index(my_benchmark.df["scenario"].unique()[0])

plotted_scenario = st.selectbox(
    "Choose Benchmark to plot",
    benchmarks,
    index=index_to_use,
)

col1, col2, col3 = st.columns(3)
cur_data = data.query(f"Benchmark=='{plotted_scenario}'")
col1.metric("Relative agreement", cur_data[z_score_name])
col2.metric(corr_name, cur_data[corr_name])
col3.metric("p-value of Corr.", cur_data[p_val_name])

cur_df = allbench.df.query(f'scenario=="aggregate" or scenario=="{plotted_scenario}"')

# Filter models that are present in both scenarios
models_in_both = cur_df.groupby("model")["scenario"].nunique().eq(2).index

# Pivot the DataFrame to have scenarios as columns
df_pivot = cur_df[cur_df["model"].isin(models_in_both)].pivot(
    index="model", columns="scenario", values="score"
)

# Create the scatter plot using Plotly Express
fig = px.scatter(
    df_pivot,
    x=df_pivot.columns[0],
    y=df_pivot.columns[1],
    trendline="ols",
    labels={
        df_pivot.columns[0]: df_pivot.columns[0],
        df_pivot.columns[1]: df_pivot.columns[1],
    },
    hover_name=df_pivot.index,
    title="Model Scores Comparison between Scenarios",
)
st.plotly_chart(fig, use_container_width=True)

st.subheader("How did we get the Z Scores?", divider=True)

st.write(r"""
            Section 3.1 in our work shows how using a single reference benchmark drastically hurts the roubustness and validity of BAT.
            To remedy this, we propose to test benchmark agreement with an aggragate benchmark and compare the agreement to other benchmarks.
            We recommend to perform this comparison using the [Z score](https://en.wikipedia.org/wiki/Standard_score) and demonstrate obtaining it to a benchmark of your selection.
            In the follwing way: $z_i=(x_i-\mu_{i...N}) / \sigma_{i...N}$ where $x_i$ is the agreement of the $i$th benchmark to the aggragate and $\mu_{i...N}$,$\sigma_{i...N}$ are the 
            mean and standard deviation of the agreements of the other benchmarks to the aggragate.
            """)


fig = px.histogram(
    data.query("Benchmark!=@plotted_scenario"), x=corr_name, nbins=len(data) - 1
)
# Add a vertical line at a specific x-coordinate
# Replace 'x_value' with the actual value where you want the line
x_value = 0.5  # Example value, adjust as necessary
fig.add_vline(
    x=data.query("Benchmark==@plotted_scenario")[corr_name].iloc[0],
    line_dash="dash",
    line_color="red",
)
# Update layout to add a title
fig.update_layout(
    title="Histogram of Correlation Values",  # Change the title text as needed
    title_x=0.3,  # Centers the title
    title_font=dict(size=20, family="CMU"),  # Customize font if needed
)

# # Plot!
st.plotly_chart(fig, use_container_width=True)

import streamlit as st

st.subheader("Why should you use the BenchBench Leaderboard?")

st.markdown(
    """
    Benchmark Agreement Testing (BAT) is crucial for validating new benchmarks and understanding the relationships between existing ones. 
    However, current BAT practices often lack standardization and transparency, leading to inconsistent results and hindering reliable comparisons. 
    The BenchBench Leaderboard addresses these challenges by offering a **principled and data-driven approach to benchmark evaluation**. 
    Let's explore some of the key issues with current BAT practices:
    """
)

st.markdown(
    """
    - **Lack of Standard Methodologies:**  BAT lacks standardized procedures for benchmark and model selection, hindering reproducibility and comparability across studies. 
      Researchers often make arbitrary choices, leading to results that are difficult to interpret and build upon. 
    """
)

st.image(
    "images/motivation.png",
    caption="**Example: Model Selection Impacts BAT Conclusions.** Kendall-tau correlations between the LMSys Arena benchmark and three others demonstrate how agreement varies significantly depending on the subset of models considered. This highlights the need for standardized model selection in BAT.",
    use_column_width=True,
)

st.markdown(
    """
    - **Arbitrary Selection of Reference Benchmarks:** The choice of reference benchmarks in BAT is often subjective and lacks a clear rationale. Using different reference benchmarks can lead to widely varying agreement scores, making it difficult to draw robust conclusions about a target benchmark's validity.
    """
)
st.markdown(
    """
    - **Inadequate Model Representation:** BAT often relies on a limited set of models that may not adequately represent the diversity of modern language models. This can lead to biased agreement scores that favor certain model types and fail to provide a comprehensive view of benchmark performance.
    """
)

st.image(
    "images/pointplot_granularity_matters.png",
    caption="**Example: Agreement Varies with Model Range.** Mean correlation between benchmarks shows that agreement tends to increase with the number of models considered and is generally lower for closely ranked models (blue lines). This highlights the importance of considering multiple granularities in BAT.",
    use_column_width=True,
)

st.markdown(
    """
    - **Overemphasis on Correlation Metrics:** BAT often relies heavily on correlation metrics without fully considering their limitations or the context of their application. While correlation can be informative, it's crucial to remember that high correlation doesn't automatically imply that benchmarks measure the same underlying construct.
    """
)

st.markdown(
    """
    The BenchBench Leaderboard tackles these challenges by implementing a standardized and transparent approach to BAT, promoting consistency and facilitating meaningful comparisons between benchmarks.
    By adopting the best practices embedded in the leaderboard, the research community can enhance the reliability and utility of benchmarks for evaluating and advancing language models.
    """
)


st.image(
    "images/ablations.png",
    caption="**BenchBench's Standardized Approach Reduces Variance.** This ablation study demonstrates that following the best practices implemented in BenchBench significantly reduces the variance of BAT results, leading to more robust and reliable conclusions.",
    use_column_width=True,
)


st.code(
    r"""
    @misc{perlitz2024llmbenchmarksagreefixing,
        title={Do These LLM Benchmarks Agree? Fixing Benchmark Evaluation with BenchBench}, 
        author={Yotam Perlitz and Ariel Gera and Ofir Arviv and Asaf Yehudai and Elron Bandel and Eyal Shnarch and Michal Shmueli-Scheuer and Leshem Choshen},
        year={2024},
        eprint={2407.13696},
        archivePrefix={arXiv},
        primaryClass={cs.CL},
        url={https://arxiv.org/abs/2407.13696}, 
    }
"""
)