File size: 28,715 Bytes
0243d7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4380cc
 
8b18b8e
c4c6527
8b18b8e
 
0243d7b
c4380cc
0243d7b
 
 
 
 
c4380cc
 
 
0243d7b
 
 
c4380cc
 
 
0243d7b
 
c4380cc
 
 
0243d7b
 
 
c4380cc
 
 
 
0243d7b
 
 
 
c4380cc
 
 
 
0243d7b
 
 
 
 
c4380cc
 
0243d7b
 
 
c4380cc
 
0243d7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4380cc
 
 
 
 
 
 
0243d7b
 
 
 
 
 
 
 
 
 
c4380cc
 
 
 
 
 
 
0243d7b
c4380cc
 
 
 
0243d7b
 
 
c4380cc
0243d7b
c4380cc
 
 
0243d7b
c4380cc
0243d7b
c4380cc
0243d7b
 
 
 
 
c4380cc
 
 
 
 
 
0243d7b
 
 
c4380cc
 
 
0243d7b
 
c4380cc
 
 
0243d7b
 
 
c4380cc
 
 
 
0243d7b
 
 
 
c4380cc
 
 
 
0243d7b
 
 
 
 
c4380cc
 
 
0243d7b
 
 
c4380cc
 
0243d7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4380cc
 
 
 
 
 
 
0243d7b
c4380cc
 
 
 
0243d7b
 
 
c4380cc
0243d7b
c4380cc
 
 
0243d7b
c4380cc
0243d7b
 
 
 
 
 
 
 
 
 
 
c4380cc
0243d7b
 
 
 
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
import os
import json
import numpy as np
import pandas as pd
import gradio as gr

HEADER = """
<center>
<h1>X-Risks Leaderboard: Frontier Models Evaluation for Extreme Risks (CCB)</h1>
</center>
<br></br>
"""

ABOUT_SECTION = """
## About

In recent headlines —from [OpenAI’s deal with the US National Laboratories](https://futurism.com/openai-signs-deal-us-government-nuclear-weapon-security) to [reports of a STEM student using AI guidance to build a nuclear fusor](https://www.corememory.com/p/a-young-man-used-ai-to-build-a-nuclear)— we’ve seen first-hand how advanced AI systems can impact high-stakes domains. These stories, while diverse in their context, share a common thread: they underscore the urgent need to better understand and responsibly manage the risks associated with frontier AI models.

Both cases illustrate a rapidly evolving landscape where AI isn’t just a tool for productivity—it can also play a role in critical, high-stakes environments like cybersecurity, chemistry, biology, nuclear and radiology domains.

At Inception, as part of the broader G42 family, we’re taking this responsibility very seriously. In this [space](https://huggingface.co/spaces/inceptionai/X-Risks-Leaderboard), we are debuting the X-Risks Leaderboard and, more broadly, the Safety Evaluation Suite. Our hope is that these tools will foster a transparent, evidence-based conversation about AI safety that can inform both researchers and policymakers alike.

### Motivation

As highlighted in the [International Scientific Report on the Safety of Advanced AI (2025)](https://assets.publishing.service.gov.uk/media/679a0c48a77d250007d313ee/International_AI_Safety_Report_2025_accessible_f.pdf) and in [Model evaluation for extreme risks (Google, 2023)](https://arxiv.org/pdf/2305.15324), rigorous model evaluation is essential for identifying dangerous capabilities and ensuring that alignment issues do not lead to unintended harmful consequences. These findings reinforce our belief that continuous, comprehensive evaluation throughout the AI development lifecycle is not just beneficial, but necessary.

As researchers, we’re aware that such advancements offer both unprecedented opportunities and profound challenges. The pace at which AI capabilities are expanding means that traditional risk assessment methods may fall short. In this Leaderboard —X-Risks Leaderboard— we aim to rigorously measure how these models perform when confronted with expert-level questions/challenges that mimic real-world scenarios with potentially catastrophic outcomes.

### The X-Risks Leaderboard

The X-Risks Leaderboard presented in this space is designed to assess and highlight the extreme risks posed by frontier models/systems. And here’s how we’re approaching it:

- **Expert-Level Challenges:** We’ve started by focusing on domains such as cybersecurity, chemistry, and biology. In these areas, we’ve developed a set of expert-level questions (200 questions per domain) that serve as a proxy for the models’ ability to aid in scenarios that could escalate into real-world crises. Our plan is to extend this evaluation to nuclear and radiology challenges as our work progresses.
- **Transparent Scoring:** The Leaderboard reports scores based on how correctly and efficiently a model answers these domain-specific questions, based on [3C3H](https://huggingface.co/blog/leaderboard-3c3h-aragen) as a metric.
- **An Early Warning System:** A higher score in these extreme-risk evaluations might be a double-edged sword. It reflects a model’s ability to perform complex tasks, but it also flags a potential for these capabilities to be misapplied in ways that could have severe consequences. This public leaderboard aims to serve as an early warning framework for these kinds of risks.

### The Safety Evaluation Suite

This Leaderboard is a single pillar and first of our broader **Safety Evaluation Suite**, which we’re developing to address various dimensions of AI safety:

1. **X-Risks Leaderboard:** Focuses on evaluating extreme, existential, and catastrophic risks in high-stakes domains -CCBRN threats-.

2. **Persuasion Leaderboard:** This component will assess how AI systems might influence user beliefs and decisions, measuring their potential to persuade or manipulate. (To be introduced later this year)

3. **Red Teaming and Jailbreaking Leaderboard:** Evaluates the resilience of AI models against adversarial prompt hacking and other forms of red teaming, ensuring that models maintain their integrity in hostile environments. (To be introduced later this year)

4. **Social Safety Evaluations:** Concentrates on safeguarding against harmful outputs in areas such as self-harm, explicit content, discrimination, privacy breaches, and other ethical concerns. (To be introduced later this year)

Together, these components will help us and the broader research community to better understand, anticipate, and mitigate the risks inherent in rapidly advancing AI technologies.

### Contact

We are not here to sensationalize these issues but to study them with the scientific rigor they deserve. At Inception, our team of researchers is committed to transparency and collaboration, and by publicly sharing our methodologies and findings through the X-Risks Leaderboard (with more components to come), we hope to contribute to a broader, evidence-based dialogue on AI safety.

For any inquiries or assistance, feel free to reach out through the community tab at [Inception X-Risks Community](https://huggingface.co/spaces/inceptionai/X-Risks-Leaderboard/discussions) or via [email](mailto:[email protected]).
"""

CITATION_BUTTON_LABEL = """
Copy the following snippet to cite these results
"""

CITATION_BUTTON_TEXT = """
@misc{
  author = {El Filali, Ali and Jackson, Andrew and Ben Amor, Boulbaba and Herlihy, Adele O and Murray, Larry and Manucha, Rohit and Kosior, Grzegorz and Wilton, James},
  title = {X-Risks Leaderboard : Frontier Models Evaluation for Extreme Risks (CCB)},
  year = {2025},
  publisher = {Inception},
  howpublished = "url{https://huggingface.co/spaces/inceptionai/X-Risks-Leaderboard}"
}
"""


def load_results():
    # Get the current directory of the script and construct the path to results.json
    current_dir = os.path.dirname(os.path.abspath(__file__))
    results_file = os.path.join(current_dir, "assets", "results", "results.json")
    
    # Load the JSON data from the specified file
    with open(results_file, 'r') as f:
        data = json.load(f)
    
    # Filter out any entries that only contain '_last_sync_timestamp'
    filtered_data = []
    for entry in data:
        # If '_last_sync_timestamp' is the only key, skip it
        if len(entry.keys()) == 1 and "_last_sync_timestamp" in entry:
            continue
        filtered_data.append(entry)
    
    data = filtered_data
    
    # Lists to collect data
    data_3c3h = []
    data_tasks = []
    
    for model_data in data:
        # Extract model meta data
        meta = model_data.get('Meta', {})
        model_name = meta.get('Model Name', 'UNK')
        revision = meta.get('Revision', 'UNK')
        precision = meta.get('Precision', 'UNK')
        params = meta.get('Params', 'UNK')
        license = meta.get('License', 'UNK')
        
        # Convert "Model Size" to numeric, treating "UNK" as infinity
        try:
            model_size_numeric = float(params)
        except (ValueError, TypeError):
            model_size_numeric = np.inf
        
        # 3C3H Scores
        scores_data = model_data.get('claude-3.5-sonnet Scores', {})
        scores_3c3h = scores_data.get('3C3H Scores', {})
        scores_tasks = scores_data.get('Tasks Scores', {})
        
        # Multiply scores by 100 to get percentages (keep them as numeric values)
        formatted_scores_3c3h = {k: v * 100 for k, v in scores_3c3h.items()}
        formatted_scores_tasks = {k: v * 100 for k, v in scores_tasks.items()}
        
        # For 3C3H Scores DataFrame
        data_entry_3c3h = {
            'Model Name': model_name,
            'Revision': revision,
            'License': license,
            'Precision': precision,
            'Model Size': model_size_numeric,  # Numeric value for sorting
            '3C3H Score': formatted_scores_3c3h.get("3C3H Score", np.nan),
            'Correctness': formatted_scores_3c3h.get("Correctness", np.nan),
            'Completeness': formatted_scores_3c3h.get("Completeness", np.nan),
            'Conciseness': formatted_scores_3c3h.get("Conciseness", np.nan),
            'Helpfulness': formatted_scores_3c3h.get("Helpfulness", np.nan),
            'Honesty': formatted_scores_3c3h.get("Honesty", np.nan),
            'Harmlessness': formatted_scores_3c3h.get("Harmlessness", np.nan),
        }
        data_3c3h.append(data_entry_3c3h)
        
        # For Tasks Scores DataFrame
        data_entry_tasks = {
            'Model Name': model_name,
            'Revision': revision,
            'License': license,
            'Precision': precision,
            'Model Size': model_size_numeric,  # Numeric value for sorting
            **formatted_scores_tasks
        }
        data_tasks.append(data_entry_tasks)
    
    df_3c3h = pd.DataFrame(data_3c3h)
    df_tasks = pd.DataFrame(data_tasks)
    
    # Round the numeric score columns to 4 decimal places
    score_columns_3c3h = ['3C3H Score', 'Correctness', 'Completeness', 'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness']
    df_3c3h[score_columns_3c3h] = df_3c3h[score_columns_3c3h].round(4)
    
    # Replace np.inf with a large number in 'Model Size Filter' for filtering
    max_model_size_value = 1000  # Define a maximum value
    df_3c3h['Model Size Filter'] = df_3c3h['Model Size'].replace(np.inf, max_model_size_value)
    
    # Sort df_3c3h by '3C3H Score' descending if column exists
    if '3C3H Score' in df_3c3h.columns:
        df_3c3h = df_3c3h.sort_values(by='3C3H Score', ascending=False)
        df_3c3h.insert(0, 'Rank', range(1, len(df_3c3h) + 1))  # Add Rank column starting from 1
    else:
        df_3c3h.insert(0, 'Rank', range(1, len(df_3c3h) + 1))
    
    # Extract task columns
    task_columns = [col for col in df_tasks.columns if col not in ['Model Name', 'Revision', 'License', 'Precision', 'Model Size', 'Model Size Filter']]
    
    # Round the task score columns to 4 decimal places
    if task_columns:
        df_tasks[task_columns] = df_tasks[task_columns].round(4)
    
    # Replace np.inf with a large number in 'Model Size Filter' for filtering
    df_tasks['Model Size Filter'] = df_tasks['Model Size'].replace(np.inf, max_model_size_value)
    
    # Sort df_tasks by the first task column if it exists
    if task_columns:
        first_task = task_columns[0]
        df_tasks = df_tasks.sort_values(by=first_task, ascending=False)
        df_tasks.insert(0, 'Rank', range(1, len(df_tasks) + 1))  # Add Rank column starting from 1
    else:
        df_tasks = df_tasks.sort_values(by='Model Name', ascending=True)
        df_tasks.insert(0, 'Rank', range(1, len(df_tasks) + 1))
    
    return df_3c3h, df_tasks, task_columns

def main():
    df_3c3h, df_tasks, task_columns = load_results()

    # Extract unique Precision and License values for filters
    precision_options_3c3h = sorted(df_3c3h['Precision'].dropna().unique().tolist())
    precision_options_3c3h = [p for p in precision_options_3c3h if p != 'UNK']
    precision_options_3c3h.append('Missing')

    license_options_3c3h = sorted(df_3c3h['License'].dropna().unique().tolist())
    license_options_3c3h = [l for l in license_options_3c3h if l != 'UNK']
    license_options_3c3h.append('Missing')

    precision_options_tasks = sorted(df_tasks['Precision'].dropna().unique().tolist())
    precision_options_tasks = [p for p in precision_options_tasks if p != 'UNK']
    precision_options_tasks.append('Missing')

    license_options_tasks = sorted(df_tasks['License'].dropna().unique().tolist())
    license_options_tasks = [l for l in license_options_tasks if l != 'UNK']
    license_options_tasks.append('Missing')

    # Get min and max model sizes for sliders, handling 'inf' values
    min_model_size_3c3h = int(df_3c3h['Model Size Filter'].min())
    max_model_size_3c3h = int(df_3c3h['Model Size Filter'].max())

    min_model_size_tasks = int(df_tasks['Model Size Filter'].min())
    max_model_size_tasks = int(df_tasks['Model Size Filter'].max())

    # Exclude 'Model Size Filter' from column selectors
    column_choices_3c3h = [col for col in df_3c3h.columns if col != 'Model Size Filter']
    column_choices_tasks = [col for col in df_tasks.columns if col != 'Model Size Filter']

    with gr.Blocks() as demo:
        gr.HTML(HEADER)
        
        with gr.Tabs():
            with gr.Tab("Leaderboard"):
                with gr.Tabs():
                    with gr.Tab("Tasks Scores"):
                        gr.Markdown("""
                        **Notes:**  
                        - This table is sorted according to the first task based on its accuracy score.
                        - A higher rank indicates a greater susceptibility for the model to be considered dangerous.
                        """)                        
                        with gr.Row():
                            search_box_tasks = gr.Textbox(
                                placeholder="Search for models...", 
                                label="Search", 
                                interactive=True
                            )
                        with gr.Row():
                            column_selector_tasks = gr.CheckboxGroup(
                                choices=column_choices_tasks,
                                value=['Rank', 'Model Name'] + task_columns,
                                label="Select columns to display",
                            )
                        with gr.Row():
                            license_filter_tasks = gr.CheckboxGroup(
                                choices=license_options_tasks,
                                value=license_options_tasks.copy(),  # Default all selected
                                label="Filter by License",
                            )
                            precision_filter_tasks = gr.CheckboxGroup(
                                choices=precision_options_tasks,
                                value=precision_options_tasks.copy(),  # Default all selected
                                label="Filter by Precision",
                            )
                        with gr.Row():
                            model_size_min_filter_tasks = gr.Slider(
                                minimum=min_model_size_tasks,
                                maximum=max_model_size_tasks,
                                value=min_model_size_tasks,
                                step=1,
                                label="Minimum Model Size",
                                interactive=True
                            )
                            model_size_max_filter_tasks = gr.Slider(
                                minimum=min_model_size_tasks,
                                maximum=max_model_size_tasks,
                                value=max_model_size_tasks,
                                step=1,
                                label="Maximum Model Size",
                                interactive=True
                            )
                        
                        leaderboard_tasks = gr.Dataframe(
                            df_tasks[['Rank', 'Model Name'] + task_columns],
                            interactive=False
                        )
                        
                        def filter_df_tasks(search_query, selected_cols, precision_filters, license_filters, min_size, max_size):
                            filtered_df = df_tasks.copy()
                            
                            # Ensure min_size <= max_size
                            if min_size > max_size:
                                min_size, max_size = max_size, min_size
                            
                            # Apply search filter
                            if search_query:
                                filtered_df = filtered_df[filtered_df['Model Name'].str.contains(search_query, case=False, na=False)]
                            
                            # Apply Precision filter
                            if precision_filters:
                                include_missing = 'Missing' in precision_filters
                                selected_precisions = [p for p in precision_filters if p != 'Missing']
                                if include_missing:
                                    filtered_df = filtered_df[
                                        (filtered_df['Precision'].isin(selected_precisions)) |
                                        (filtered_df['Precision'] == 'UNK') |
                                        (filtered_df['Precision'].isna())
                                    ]
                                else:
                                    filtered_df = filtered_df[filtered_df['Precision'].isin(selected_precisions)]
                            
                            # Apply License filter
                            if license_filters:
                                include_missing = 'Missing' in license_filters
                                selected_licenses = [l for l in license_filters if l != 'Missing']
                                if include_missing:
                                    filtered_df = filtered_df[
                                        (filtered_df['License'].isin(selected_licenses)) |
                                        (filtered_df['License'] == 'UNK') |
                                        (filtered_df['License'].isna())
                                    ]
                                else:
                                    filtered_df = filtered_df[filtered_df['License'].isin(selected_licenses)]
                            
                            # Apply Model Size filter
                            filtered_df = filtered_df[
                                (filtered_df['Model Size Filter'] >= min_size) &
                                (filtered_df['Model Size Filter'] <= max_size)
                            ]
                            
                            # Remove existing 'Rank' column if present
                            if 'Rank' in filtered_df.columns:
                                filtered_df = filtered_df.drop(columns=['Rank'])
                            
                            # Sort by the first task column if it exists
                            if task_columns:
                                first_task = task_columns[0]
                                filtered_df = filtered_df.sort_values(by=first_task, ascending=False)
                            else:
                                filtered_df = filtered_df.sort_values(by='Model Name', ascending=True)
                            
                            # Recalculate Rank after filtering
                            filtered_df = filtered_df.reset_index(drop=True)
                            filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
                            
                            # Ensure selected columns are present
                            selected_cols = [col for col in selected_cols if col in filtered_df.columns]
                            
                            return filtered_df[selected_cols]
                        
                        # Bind the filter function to the appropriate events
                        filter_inputs_tasks = [
                            search_box_tasks,
                            column_selector_tasks,
                            precision_filter_tasks,
                            license_filter_tasks,
                            model_size_min_filter_tasks,
                            model_size_max_filter_tasks
                        ]
                        search_box_tasks.submit(
                            filter_df_tasks,
                            inputs=filter_inputs_tasks,
                            outputs=leaderboard_tasks
                        )
                        
                        # Bind change events for CheckboxGroups and sliders
                        for component in filter_inputs_tasks:
                            component.change(
                                filter_df_tasks,
                                inputs=filter_inputs_tasks,
                                outputs=leaderboard_tasks
                            )
                    with gr.Tab("3C3H Scores"):
                        with gr.Row():
                            search_box_3c3h = gr.Textbox(
                                placeholder="Search for models...", 
                                label="Search", 
                                interactive=True
                            )
                        with gr.Row():
                            column_selector_3c3h = gr.CheckboxGroup(
                                choices=column_choices_3c3h,
                                value=[
                                    'Rank', 'Model Name', '3C3H Score', 'Correctness', 'Completeness',
                                    'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness'
                                ],
                                label="Select columns to display",
                            )
                        with gr.Row():
                            license_filter_3c3h = gr.CheckboxGroup(
                                choices=license_options_3c3h,
                                value=license_options_3c3h.copy(),  # Default all selected
                                label="Filter by License",
                            )
                            precision_filter_3c3h = gr.CheckboxGroup(
                                choices=precision_options_3c3h,
                                value=precision_options_3c3h.copy(),  # Default all selected
                                label="Filter by Precision",
                            )
                        with gr.Row():
                            model_size_min_filter_3c3h = gr.Slider(
                                minimum=min_model_size_3c3h,
                                maximum=max_model_size_3c3h,
                                value=min_model_size_3c3h,
                                step=1,
                                label="Minimum Model Size",
                                interactive=True
                            )
                            model_size_max_filter_3c3h = gr.Slider(
                                minimum=min_model_size_3c3h,
                                maximum=max_model_size_3c3h,
                                value=max_model_size_3c3h,
                                step=1,
                                label="Maximum Model Size",
                                interactive=True
                            )
                        
                        leaderboard_3c3h = gr.Dataframe(
                            df_3c3h[['Rank', 'Model Name', '3C3H Score', 'Correctness', 'Completeness',
                                      'Conciseness', 'Helpfulness', 'Honesty', 'Harmlessness']],
                            interactive=False
                        )
                        
                        def filter_df_3c3h(search_query, selected_cols, precision_filters, license_filters, min_size, max_size):
                            filtered_df = df_3c3h.copy()
                            
                            # Ensure min_size <= max_size
                            if min_size > max_size:
                                min_size, max_size = max_size, min_size
                            
                            # Apply search filter
                            if search_query:
                                filtered_df = filtered_df[filtered_df['Model Name'].str.contains(search_query, case=False, na=False)]
                            
                            # Apply Precision filter
                            if precision_filters:
                                include_missing = 'Missing' in precision_filters
                                selected_precisions = [p for p in precision_filters if p != 'Missing']
                                if include_missing:
                                    filtered_df = filtered_df[
                                        (filtered_df['Precision'].isin(selected_precisions)) |
                                        (filtered_df['Precision'] == 'UNK') |
                                        (filtered_df['Precision'].isna())
                                    ]
                                else:
                                    filtered_df = filtered_df[filtered_df['Precision'].isin(selected_precisions)]
                            
                            # Apply License filter
                            if license_filters:
                                include_missing = 'Missing' in license_filters
                                selected_licenses = [l for l in license_filters if l != 'Missing']
                                if include_missing:
                                    filtered_df = filtered_df[
                                        (filtered_df['License'].isin(selected_licenses)) |
                                        (filtered_df['License'] == 'UNK') |
                                        (filtered_df['License'].isna())
                                    ]
                                else:
                                    filtered_df = filtered_df[filtered_df['License'].isin(selected_licenses)]
                            
                            # Apply Model Size filter
                            filtered_df = filtered_df[
                                (filtered_df['Model Size Filter'] >= min_size) &
                                (filtered_df['Model Size Filter'] <= max_size)
                            ]
                            
                            # Remove existing 'Rank' column if present
                            if 'Rank' in filtered_df.columns:
                                filtered_df = filtered_df.drop(columns=['Rank'])
                            
                            # Recalculate Rank after filtering
                            filtered_df = filtered_df.reset_index(drop=True)
                            filtered_df.insert(0, 'Rank', range(1, len(filtered_df) + 1))
                            # Ensure selected columns are present
                            selected_cols = [col for col in selected_cols if col in filtered_df.columns]
                            
                            return filtered_df[selected_cols]
                        
                        # Bind the filter function to the appropriate events
                        filter_inputs_3c3h = [
                            search_box_3c3h,
                            column_selector_3c3h,
                            precision_filter_3c3h,
                            license_filter_3c3h,
                            model_size_min_filter_3c3h,
                            model_size_max_filter_3c3h
                        ]
                        search_box_3c3h.submit(
                            filter_df_3c3h,
                            inputs=filter_inputs_3c3h,
                            outputs=leaderboard_3c3h
                        )
                        
                        # Bind change events for CheckboxGroups and sliders
                        for component in filter_inputs_3c3h:
                            component.change(
                                filter_df_3c3h,
                                inputs=filter_inputs_3c3h,
                                outputs=leaderboard_3c3h
                            )

            with gr.Tab("About"):
                gr.Markdown(ABOUT_SECTION)
            with gr.Row():
                with gr.Accordion("📙 Citation", open=False):
                    citation_button = gr.Textbox(
                        value=CITATION_BUTTON_TEXT,
                        label=CITATION_BUTTON_LABEL,
                        lines=9,
                        elem_id="citation-button",
                        show_copy_button=True,
                    )

    demo.launch()

if __name__ == "__main__":
    main()