galb-dai commited on
Commit
180dbc4
·
1 Parent(s): 4d77847
Files changed (1) hide show
  1. src/about.py +164 -113
src/about.py CHANGED
@@ -1,118 +1,169 @@
1
- custom_css = """
2
- :root, [data-theme="light"] {
3
- --f1-text: #111827;
4
- --f1-subtle: #6b7280;
5
- --f1-border: #e5e7eb;
6
- --f1-bg: #ffffff;
7
- --f1-bg-muted: #f9fafb;
8
- }
9
 
10
- /* Readable width */
11
- .f1-container { max-width: 800px; margin: 0 auto; padding: 0 16px; }
12
- .markdown-text { font-size: 16px !important; max-width: 800px; margin: 0 auto; }
13
-
14
- /* Paragraphs: nice wrapping */
15
- .f1-p, .f1-li {
16
- line-height: 1.75;
17
- color: #374151;
18
- text-align: left;
19
- text-wrap: pretty;
20
- overflow-wrap: break-word;
21
- hyphens: auto;
22
- word-break: normal;
23
- }
24
 
25
- /* Headings */
26
- .f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: var(--f1-text); text-align: center; margin-bottom: 1.25rem !important; }
27
- .f1-h2 { /* smaller section headings */
28
- font-weight: 700;
29
- border-bottom: 1px solid var(--f1-border);
30
- padding-bottom: 0.45rem;
31
- margin-top: 1.75rem;
32
- margin-bottom: 0.9rem;
33
- color: var(--f1-text);
34
- font-size: 1.5rem;
35
- line-height: 2rem;
36
- }
37
 
38
- /* Links */
39
- .f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
40
- .f1-a:hover { text-decoration: underline; }
41
-
42
- /* Blockquote & problem box */
43
- .f1-blockquote { border-left: 4px solid #d1d5db; padding-left: 1rem; margin-left: 0; font-style: italic; color: #4b5563; }
44
- .f1-problem-box { background-color: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 8px; padding: 16px; margin-top: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04); }
45
- .f1-problem-name { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-weight: 600; text-align: center; }
46
-
47
- /* Clean, centered table: only top & left borders; not full width; headers centered */
48
- .f1-table-wrap { margin: 10px auto 8px auto; text-align: center; }
49
- .f1-table {
50
- border-collapse: collapse;
51
- width: auto; /* not full width */
52
- margin: 0 auto; /* centered */
53
- border-top: 1px solid var(--f1-border);
54
- border-left: 1px solid var(--f1-border);
55
- background: var(--f1-bg);
56
- }
57
- .f1-table th, .f1-table td {
58
- padding: 8px 12px;
59
- text-align: left;
60
- vertical-align: top;
61
- }
62
- .f1-table th { text-align: center; } /* header cells centered */
63
- .f1-table tr + tr td { border-top: 1px solid var(--f1-border); } /* row separators that visually keep top line only */
64
- .f1-table td + td, .f1-table th + th { border-left: 1px solid var(--f1-border); } /* vertical grid from left border only */
65
-
66
- /* Examples block (Gradio-based) */
67
- #f1-examples { border: 1px solid var(--f1-border); border-radius: 8px; background: var(--f1-bg); margin-bottom: 12px; }
68
- #f1-examples .f1-examples-title { font-weight: 700; margin: 12px 14px 4px 14px; color: var(--f1-text); font-size: 1.1rem; }
69
- #f1-example-radio { border-top: 1px solid var(--f1-border); padding: 6px 8px; }
70
- #f1-example-radio .wrap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
71
- #f1-example-radio label { border: 1px solid transparent; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
72
- #f1-example-radio input[type="radio"]:checked + span { background: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 6px; padding: 6px 10px; }
73
-
74
- /* Leaderboard: full-width controls, nesting rule, center container */
75
- #formulaone-leaderboard-tab-table { max-width: 1200px; margin-left: auto; margin-right: auto; } /* center the whole tab (8) */
76
- #formulaone-leaderboard-tab-table .gr-column .gr-row .gr-column { min-width: 80% !important; } /* (7) exact chain rule */
77
- #formulaone-leaderboard-tab-table .gr-row, #formulaone-leaderboard-tab-table .gr-column { width: 100% !important; max-width: 100% !important; }
78
- #formulaone-leaderboard-tab-table [data-testid="dropdown"], #formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; }
79
-
80
- /* Login button: force light */
81
- #hf-login-btn, #hf-login-btn button, button[data-testid="login-button"], [data-testid="login-button"] button, div[data-testid="login-button"] > button {
82
- background: #ffffff !important;
83
- color: #1f2937 !important;
84
- border: 1px solid var(--f1-border) !important;
85
- box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04) !important;
86
- }
87
- #hf-login-btn:hover, #hf-login-btn button:hover, button[data-testid="login-button"]:hover, [data-testid="login-button"] button:hover, div[data-testid="login-button"] > button:hover { background: #f9fafb !important; }
88
-
89
- /* Misc retained */
90
- #models-to-add-text { font-size: 18px !important; }
91
- #citation-button span { font-size: 16px !important; }
92
- #citation-button textarea { font-size: 16px !important; }
93
- #citation-button > label > button { margin: 6px; transform: scale(1.3); }
94
- #leaderboard-table { margin-top: 15px }
95
- #leaderboard-table-lite { margin-top: 15px }
96
- #search-bar-table-box > div:first-child { background: none; border: none; }
97
- #search-bar { padding: 0px; }
98
- #leaderboard-table td:nth-child(2), #leaderboard-table th:nth-child(2) { max-width: 400px; overflow: auto; white-space: nowrap; }
99
- #scale-logo { border-style: none !important; box-shadow: none; display: block; margin-left: auto; margin-right: auto; max-width: 600px; }
100
- #scale-logo .download { display: none; }
101
- #filter_type{ border: 0; padding-left: 0; padding-top: 0; }
102
- #filter_type label { display: flex; }
103
- #filter_type label > span{ margin-top: var(--spacing-lg); margin-right: 0.5em; }
104
- #filter_type label > .wrap{ width: 103px; }
105
- #filter_type label > .wrap .wrap-inner{ padding: 2px; }
106
- #filter_type label > .wrap .wrap-inner input{ width: 1px }
107
- #filter-columns-type{ border:0; padding:0.5; }
108
- #filter-columns-size{ border:0; padding:0.5; }
109
- #box-filter > .form{ border: 0 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  """
111
 
112
- get_window_url_params = """
113
- function(url_params) {
114
- const params = new URLSearchParams(window.location.search);
115
- url_params = Object.fromEntries(params);
116
- return url_params;
117
- }
118
- """
 
 
 
 
 
 
 
1
+ # The paper's URL for linking
2
+ PAPER_URL = "https://arxiv.org/abs/2507.13337"
 
 
 
 
 
 
3
 
4
+ # Top part (through the categories table). We insert the Gradio-based examples AFTER this.
5
+ WHAT_IS_F1_HTML_TOP = f"""
6
+ <!DOCTYPE html>
7
+ <html lang="en">
8
+ <body>
9
+ <main class="f1-container">
10
+ <header class="text-center mb-12">
11
+ <h1 class="text-4xl md:text-5xl font-bold text-gray-900 f1-h1">FormulaOne</h1>
12
+ </header>
 
 
 
 
 
13
 
14
+ <section>
15
+ <p class="text-lg mb-4 f1-p">Frontier AI models have recently demonstrated strong performance on mathematical and algorithmic benchmarks, including earning <a href="https://deepmind.google/discover/blog/advanced-version-of-gemini-with-deep-think-officially-achieves-gold-medal-standard-at-the-international-mathematical-olympiad/" target="_blank" rel="noopener noreferrer" class="f1-a">gold medals in olympiads</a>, and attaining <a href="https://arxiv.org/html/2502.06807v1" target="_blank" rel="noopener noreferrer" class="f1-a">top percentile ratings</a> in competitive programming contests. How well do such benchmarks capture the true depth of algorithmic reasoning, as it arises in real-world research problems?</p>
 
 
 
 
 
 
 
 
 
 
16
 
17
+ <p class="text-lg mb-4 f1-p">We believe that existing benchmarks fail to capture the deep reasoning skills required for complex, research-level algorithmic problems. To address this gap, <a href="{PAPER_URL}" target="_blank" rel="noopener noreferrer" class="f1-a">we introduce <strong>FormulaOne</strong></a>.</p>
18
+
19
+ <p class="mb-4 f1-p"><strong>FormulaOne</strong> consists of 220 novel dynamic programming problems over graphs. The problems are organised into three categories, ranging from moderate difficulty and all the way up to research-level.</p>
20
+
21
+ <!-- Clean, centered table -->
22
+ <div class="f1-table-wrap">
23
+ <table class="f1-table" aria-label="FormulaOne categories">
24
+ <thead>
25
+ <tr>
26
+ <th>Category</th>
27
+ <th>Size</th>
28
+ <th>Description</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr>
33
+ <td>Warmup</td>
34
+ <td>100</td>
35
+ <td>A set of “easier” problems.</td>
36
+ </tr>
37
+ <tr>
38
+ <td>Tier 1</td>
39
+ <td>100</td>
40
+ <td>A set of challenging problems.</td>
41
+ </tr>
42
+ <tr>
43
+ <td>Tier 2</td>
44
+ <td>20</td>
45
+ <td>A set of highly challenging problems.</td>
46
+ </tr>
47
+ </tbody>
48
+ </table>
49
+ </div>
50
+ </section>
51
+ """
52
+
53
+ # Bottom part (the paragraph after Examples, all remaining sections).
54
+ WHAT_IS_F1_HTML_BOTTOM = """
55
+ <section>
56
+ <p class="mb-4 f1-p">The latter category is incredibly demanding, requiring resolution of many points of uncertainty, and involving an array of reasoning steps, including topological and geometric insight, knowledge of mathematical domains such as extremal graph theory and logic, combinatorial considerations, precise implementation, and more.</p>
57
+ <p class="f1-p">Despite <a href="https://epoch.ai/frontiermath" target="_blank" rel="noopener noreferrer" class="f1-a">impressive</a> <a href="https://artificialanalysis.ai/evaluations/gpqa-diamond" target="_blank" rel="noopener noreferrer" class="f1-a">performance</a> on existing benchmarks, presently <strong>no model solves even a single FormulaOne Tier 2 problem</strong>.<sup><a href="#evaluation" class="f1-a">1</a></sup></p>
58
+ </section>
59
+
60
+ <section>
61
+ <h2 class="f1-h2">An “Infinite Well” of Problems</h2>
62
+ <!-- Removed the example problem box, per request -->
63
+ <p class="mb-4 f1-p">While the problems are often natural to state, their solutions are far from obvious. The solvability of this vast class of problems is guaranteed by an algorithmic <strong>meta-theorem</strong> due to <a href="https://en.wikipedia.org/wiki/Courcelle%27s_theorem" target="_blank" rel="noopener noreferrer" class="f1-a">Courcelle</a>, which broadly states:</p>
64
+ <blockquote class="my-6 f1-blockquote">
65
+ “For every sufficiently tree-like graph, any problem definable in an expressive formal logic — Monadic Second-Order (MSO) logic — can be solved by a dynamic programming algorithm that operates in time linear in the order of the graph.”
66
+ </blockquote>
67
+ <p class="f1-p">The key is to use a structure known as a tree decomposition, which organises the graph’s vertices into a series of overlapping sets, or “bags”, that are themselves arranged in a tree.</p>
68
+ <figure class="f1-figure">
69
+ <img src="/file=assets/bag_modifications.png" alt="An illustration of local modifications to bags (dashed boxes)" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
70
+ <figcaption class="f1-figcaption">An illustration of local modifications to bags: Introduce, Forget, and Join.</figcaption>
71
+ </figure>
72
+ <p class="mb-4 f1-p">An algorithm can then traverse this tree of bags, solving the problem piece by piece using dynamic programming. This process involves designing a “state” that summarises all necessary information about the partial solution within a bag, and then defining how this state transforms as vertices are introduced, forgotten, or bags are merged.</p>
73
+ <figure class="f1-figure">
74
+ <video class="w-full max-w-2xl mx-auto rounded-lg shadow-lg" autoplay loop muted playsinline>
75
+ <source src="/file=assets/dp_animation.mp4" type="video/mp4">
76
+ Your browser does not support the video tag.
77
+ </video>
78
+ <figcaption class="f1-figcaption">Animation showing the design of a compressed dynamic programming state-space.</figcaption>
79
+ </figure>
80
+ <p class="f1-p">The deceptive simplicity of the problem statements belies the <strong>extraordinary difficulty</strong> of discovering the correct dynamic programming solution. This process is riddled with subtle combinatorial and logical pitfalls, demanding a profound understanding of the problem’s underlying structure. For a detailed walkthrough of the fifteen interdependent reasoning steps required to solve a single hard problem – <strong>Maximal-Cluster-Graph</strong> <a href="https://arxiv.org/pdf/2507.13337#appendix.A" target="_blank" rel="noopener noreferrer" class="f1-a">see the appendix of our paper</a>.</p>
81
+ </section>
82
+
83
+ <section id="evaluation">
84
+ <h2 class="f1-h2">Evaluation</h2>
85
+ <p class="mb-4 f1-p">To give models the best possible chance of success, we provide a generous few-shot prompt that covers a broad array of the ideas and techniques involved in solving these problems. All models were evaluated using their highest available reasoning settings and with the maximum context length permitted.</p>
86
+ <p class="mb-4 f1-p">Each submitted solution is subjected to a rigorous and automated <a href="https://arxiv.org/pdf/2507.13337#section.4" target="_blank" rel="noopener noreferrer" class="f1-a">test suite</a> that measures three key aspects of its validity:</p>
87
+ <ul class="list-disc list-inside space-y-2 mb-6">
88
+ <li class="f1-li"><strong>Correctness:</strong> The output of the submitted algorithm must be correct on all graphs.</li>
89
+ <li class="f1-li"><strong>Consistency:</strong> The solution must produce the same output for a given graph, regardless of the specific structure of its tree decomposition.</li>
90
+ <li class="f1-li"><strong>Efficiency:</strong> The solution must be truly <a href="https://en.wikipedia.org/wiki/Parameterized_complexity" target="_blank" rel="noopener noreferrer" class="f1-a">fixed-parameter linear</a>.</li>
91
+ </ul>
92
+ <p class="mb-4 f1-p">To support research and encourage community contributions, the <code>FormulaOne-Warmup</code> dataset is released as a public resource for training and fine-tuning models. The complete test suite for all 100 Warmup problems is available, alongside a standalone evaluation environment, in our <a href="https://github.com/double-ai/formulaone-dataset/tree/main" target="_blank" rel="noopener noreferrer" class="f1-a">GitHub repository</a>.</p>
93
+ <p class="f1-p">To maintain the integrity of the core benchmark, only a minimal subset of tests is released for the Tier 1 and Tier 2 problems.</p>
94
+
95
+ <!-- (6) Same level as Evaluation -->
96
+ <h2 class="f1-h2">Model Accuracy</h2>
97
+ <p class="mb-4 f1-p">On the <strong>FormulaOne-Warmup</strong> problems, frontier models perform reasonably well. This confirms they have a foundational capability for these types of algorithmic tasks.</p>
98
+ <figure class="f1-figure">
99
+ <img src="/file=assets/warmup_performance.png" alt="Plot showing model performance on FormulaOne-Warmup" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
100
+ <figcaption class="f1-figcaption">Performance of frontier models on the FormulaOne-Warmup dataset.</figcaption>
101
+ </figure>
102
+ <p class="mb-4 f1-p">However, as the reasoning depth increases in <strong>Tier 1</strong>, and solutions require the discovery and integration of novel and more complex state representations, model performance drops off sharply.</p>
103
+ <figure class="f1-figure">
104
+ <img src="/file=assets/tier1_performance.png" alt="Plot showing model performance on FormulaOne Tier 1" class="max-w-full md:max-w-2xl mx-auto rounded-lg shadow-md">
105
+ <figcaption class="f1-figcaption">Figure 1: Performance of frontier reasoning models on the FormulaOne dataset.</figcaption>
106
+ </figure>
107
+ <p class="f1-p">This trend culminates in <strong>Tier 2</strong>, where the difficulty is characteristic of exploratory research problems. On this set of 20 problems, no current frontier model solves even a single one. This result starkly illustrates the gap that remains between high performance on existing benchmarks and the deep algorithmic reasoning required for truly complex problems.</p>
108
+ </section>
109
+ </main>
110
+ </body>
111
+ </html>
112
+ """
113
+
114
+
115
+ EVALUATION_QUEUE_TEXT = """
116
+ ## Submitting to the FormulaOne Leaderboard
117
+
118
+ This leaderboard evaluates systems on the FormulaOne core dataset. Submissions consist of a .jsonl file with solution code for each problem.
119
+
120
+ ### 📁 I. Format Your Submission File
121
+
122
+ Your submission must be a .jsonl file with one entry per problem:
123
+
124
+ ```json
125
+ {"problem_id": "1", "solution": "<your Python code here>"}
126
+ {"problem_id": "2", "solution": "<your Python code here>"}
127
+ ...
128
+ ```
129
+
130
+ - problem_id: Must match the official list of FormulaOne core problems.
131
+ - solution: A Python code implementing the required callback functions.
132
+
133
+ 📄 Full list of problem_ids:
134
+ View the [FormulaOne core dataset](https://github.com/double-ai/formulaone-dataset-release/dataset/formulaone) for the complete list of problem IDs.
135
+
136
+ ⚠️ Validation Rules:
137
+ Submissions must:
138
+ - Contain exactly two columns: ["problem_id", "solution"]
139
+ - Include all required problems (no missing/unknown IDs)
140
+ - Provide solutions as Python strings
141
+ - Avoid duplicates
142
+
143
+ ### 📤 II. Submit via the UI below
144
+
145
+ - Upload your `.jsonl` file.
146
+ - Fill in the following fields:
147
+ - **System Name**
148
+ - **Organization**
149
+ - **System Type**
150
+ - Click **Submit**.
151
+
152
+ ### ⏱️ After Submission
153
+
154
+ Submissions are validated and evaluated within ~24 hours. Results will appear on the leaderboard once processed.
155
  """
156
 
157
+
158
+ CITATION_BUTTON_LABEL = """📚 How to cite FormulaOne"""
159
+ CITATION_BUTTON_TEXT = r"""
160
+ @misc{beniamini2025formulaonemeasuringdepthalgorithmic,
161
+ title={FormulaOne: Measuring the Depth of Algorithmic Reasoning Beyond Competitive Programming},
162
+ author={Gal Beniamini and Yuval Dor and Alon Vinnikov and Shir Granot Peled and Or Weinstein and Or Sharir and Noam Wies and Tomer Nussbaum and Nadav Schweiger and Ido Ben Shaul and Tomer Zekharya and Yoav Levine and Shai Shalev-Shwartz and Amnon Shashua},
163
+ year={2025},
164
+ eprint={2507.13337},
165
+ archivePrefix={arXiv},
166
+ primaryClass={cs.AI},
167
+ url={https://arxiv.org/abs/2507.13337},
168
+ }
169
+ """