File size: 4,468 Bytes
aecfcd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd

# Set up page config for a better look
st.set_page_config(
    page_title="FactBench Leaderboard",
    layout="centered",
)

st.markdown(
    """
    <style>
    @import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400&display=swap');

    html, body, [class*="css"] {
        font-family: 'Courier Prime', monospace;  /* Command-line font */
    }

    .title {
        font-size: 42px;
        font-weight: bold;
        text-align: center;
        color: #333;
        margin-bottom: 5px;
    }

    .description {
        font-size: 22px;
        text-align: center;
        margin-bottom: 30px;
        color: #555;
    }

    .table-container {
        margin-top: 20px;
    }

    table {
        width: 100%;  /* Set table to fill width */
        border-collapse: collapse;  /* Merge cells neatly */
        border-radius: 10px;  /* Rounded edges */
        overflow: hidden;  /* Ensure rounded edges are visible */
    }

    th, td {
        padding: 8px;  /* Reduced padding for smaller font */
        text-align: center;  /* Center-align text */
        border: 1px solid #ddd;  /* Add borders */
        font-size: 14px;  /* Smaller font size */
    }

    th {
        background-color: #f2f2f2;  /* Light gray background for header */
        font-weight: bold;  /* Bold font for headers */
    }

    /* Specific column widths */
    td:nth-child(2), th:nth-child(2) {  /* Wider Model column */
        width: 30%;  /* Increased width for model column */
    }

    td:nth-child(3), th:nth-child(3),
    td:nth-child(4), th:nth-child(4),
    td:nth-child(5), th:nth-child(5),
    td:nth-child(6), th:nth-child(6) {
        width: 17.5%;  /* Equal width for the rest */
    }

    /* Hover effect for table rows */
    tr:hover {
        background-color: #eaeaea;  /* Light grey on hover */
    }

    </style>
    """,
    unsafe_allow_html=True
)

# Add title and description
st.markdown('<div class="title">FactBench Leaderboard</div>',
            unsafe_allow_html=True)
st.markdown('<div class="description">Benchmark for LM Factuality Evaluation</div>',
            unsafe_allow_html=True)

# Data for all tiers combined
data = {
    'Tier': ['Easy', 'Easy', 'Easy', 'Easy',
             'Moderate', 'Moderate', 'Moderate', 'Moderate',
             'Hard', 'Hard', 'Hard', 'Hard'],
    'Model': ['GPT4-o', 'Gemini1.5-Pro', 'Llama3.1-70B-Instruct', 'Llama3.1-405B-Instruct',
              'GPT4-o', 'Gemini1.5-Pro', 'Llama3.1-70B-Instruct', 'Llama3.1-405B-Instruct',
              'GPT4-o', 'Gemini1.5-Pro', 'Llama3.1-70B-Instruct', 'Llama3.1-405B-Instruct'],
    'FactScore': [53.19, 51.79, 52.49, 53.22, 54.76, 52.62, 52.53, 53.48, 69.44, 66.05, 69.85, 70.04],
    'SAFE': [63.31, 61.24, 61.29, 61.63, 65.01, 62.68, 62.64, 63.29, 76.17, 75.69, 77.55, 77.01],
    'Factcheck-GPT': [86.4, 83.45, 83.48, 83.57, 89.39, 87.44, 85.16, 86.37, 94.25, 91.09, 92.89, 93.64],
    'VERIFY': [71.58, 69.38, 67.27, 64.94, 76.02, 74.24, 72.01, 70.25, 90.58, 87.82, 86.63, 85.79]
}

# Convert the data to a DataFrame
df = pd.DataFrame(data)

# Dropdown menu to filter tiers
tiers = ['All Tiers', 'Easy', 'Moderate', 'Hard']
selected_tier = st.selectbox('Select Tier:', tiers)

# Filter the data based on the selected tier
if selected_tier != 'All Tiers':
    filtered_df = df[df['Tier'] == selected_tier]
else:
    filtered_df = df

# Create HTML for the table
html = '''
<table>
    <thead>
        <tr>
            <th>Tier</th>
            <th>Model</th>
            <th>FactScore</th>
            <th>SAFE</th>
            <th>Factcheck-GPT</th>
            <th>VERIFY</th>
        </tr>
    </thead>
    <tbody>
'''

# Generate the rows of the table
current_tier = None
for i, row in filtered_df.iterrows():
    if row['Tier'] != current_tier:
        if current_tier is not None:
            # Close the previous tier row
            html += '    </tr>'
        current_tier = row['Tier']
        html += f'    <tr><td rowspan="4" style="vertical-align: middle;">{current_tier}</td>'
    else:
        html += '    <tr>'

    # Fill in model and scores
    html += f'''
        <td>{row['Model']}</td>
        <td>{row['FactScore']:.2f}</td>
        <td>{row['SAFE']:.2f}</td>
        <td>{row['Factcheck-GPT']:.2f}</td>
        <td>{row['VERIFY']:.2f}</td>
    </tr>
'''

# Close the last row and table tags
html += '''

</table>
'''

# Display
st.markdown(html, unsafe_allow_html=True)