-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnakefile
298 lines (266 loc) · 10.8 KB
/
Snakefile
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
# use hard-coded rules and embeddings to assign topics
rule classify_questions:
input: "src/scripts/classify_questions.py"
cache: True
output: "src/data/questions.pkl"
script: "src/scripts/classify_questions.py"
# output some basic statistics about our corpus of questions
rule question_statistics:
input: "src/data/questions.pkl"
output:
[
"src/tex/output/total_number_of_questions.txt",
"src/tex/output/num_h_statements.txt",
"src/tex/output/num_pictograms.txt",
"src/tex/output/non_mcq_questions.txt",
"src/tex/output/mcq_questions.txt",
"src/tex/output/automatically_generated.txt",
"src/tex/output/manually_generated.txt",
]
script: "src/scripts/compute_basic_statistics.py"
# plot the number of questions in different topics
rule question_plots:
input: "src/data/questions.pkl"
output:
[
"src/tex/figures/question_count_barplot.pdf",
"src/tex/output/num_topics.txt",
"src/tex/figures/question_count_barplot_mcq_vs_general.pdf",
]
script: "src/scripts/plot_statistics.py"
# output basic statistics about the human baseline
rule human_statistics:
input: "src/scripts/analyze_human_data.py"
output:
[
"src/tex/output/number_experts.txt",
"src/tex/output/number_of_considered_humans.txt",
"src/tex/output/total_hours.txt",
"src/tex/figures/human_timing.pdf",
"src/tex/figures/experience_vs_correctness.pdf",
"src/tex/output/spearman_experience_score.txt",
"src/tex/output/spearman_experience_score_p.txt",
"src/tex/output/num_human_phd.txt",
"src/tex/output/num_human_master.txt",
"src/tex/output/num_human_bachelor.txt",
"src/tex/output/num_human_highschool.txt",
"src/tex/output/num_human_postdoc.txt",
"src/tex/output/num_users_with_education_info.txt",
"src/tex/output/spearman_experience_score_with_tool_p.txt",
"src/tex/output/spearman_experience_score_with_tool.txt",
"src/tex/output/spearman_experience_score_without_tool_p.txt",
"src/tex/output/spearman_experience_score_without_tool.txt",
"src/data/human_no_tool_answered_questions.txt",
"src/data/human_tool_answered_questions.txt",
"src/data/human_answered_questions.txt",
"src/tex/output/num_human_answered_questions.txt",
]
script: "src/scripts/analyze_human_data.py"
# map the model names (based on the yaml file) to the report directory
rule map_model_name_to_report_dir:
input: "src/scripts/make_name_dir_map.py"
output: "src/data/name_to_dir_map.pkl"
script: "src/scripts/make_name_dir_map.py"
# obtain one big dataframe with all model scores
rule model_score_dict:
input:
[
"src/data/questions.pkl",
"src/data/name_to_dir_map.pkl",
"src/data/human_no_tool_answered_questions.txt",
"src/data/human_tool_answered_questions.txt",
"src/data/human_answered_questions.txt",
]
cache: True
output: "src/data/model_score_dicts.pkl"
script: "src/scripts/get_model_performance_dicts.py"
# obtain human scores summarized
rule get_human_performance_dicts:
input:
[
"src/data/questions.pkl",
"src/data/human_no_tool_answered_questions.txt",
"src/data/human_tool_answered_questions.txt",
"src/data/human_answered_questions.txt",
]
output:
[
"src/data/humans_as_models_scores_tools.pkl",
"src/data/humans_as_models_scores_no_tools.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
script: "src/scripts/get_human_performance_dicts.py"
# analyze the performance per source
rule performance_per_source:
input:
[
"src/data/model_score_dicts.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
output:
[
directory("src/tex/output/subset_scores"),
directory("src/tex/output/human_subset_scores"),
"src/tex/figures/performance_per_topic.pdf",
"src/tex/output/human_subset_scores/is_number_nmr_peaks.txt",
"src/tex/output/human_subset_scores/is_number_of_isomers.txt",
"src/tex/output/human_subset_scores/is_gfk.txt",
"src/tex/output/subset_scores/is_gfk_gpt-4.txt",
"src/tex/output/subset_scores/is_number_nmr_peaks_o1.txt",
"src/tex/figures/performance_per_topic_tiny.pdf",
"src/tex/output/subset_scores/is_gfk_Claude-3.5__Sonnet_.txt"
]
script: "src/scripts/analyze_performance_per_source.py"
# plot the overall performance
rule plot_overview_performance:
input: "src/data/model_score_dicts.pkl"
output: ["src/tex/figures/overall_performance.pdf"]
script: "src/scripts/plot_overview_performance_plot.py"
# plots the performance in various ways
rule analyze_model_reports:
input:
[
"src/data/model_score_dicts.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
output:
[
"src/tex/figures/all_questions_models_completely_correct_radar_overall.pdf",
"src/tex/figures/all_questions_models_completely_correct_radar_human.pdf",
]
script: "src/scripts/analyze_model_reports.py"
rule plot_human_score_distribution:
input: rules.human_statistics.output
output: "src/tex/figures/human_score_distribution.pdf"
script: "src/scripts/plot_human_score_distribution.py"
rule molecule_score_correlation:
input:
[
"src/data/model_score_dicts.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
output:
[
"src/tex/figures/correlation_plot_is_number_nmr_peaks_num_atoms.pdf",
"src/tex/figures/correlation_plot_is_electron_counts_num_atoms.pdf",
"src/tex/figures/correlation_plot_is_number_nmr_peaks_complexity.pdf",
]
script: "src/scripts/correlate_with_molecule_features.py"
rule model_size_plot:
input: "src/data/model_score_dicts.pkl"
output: "src/tex/figures/model_size_plot.pdf"
script: "src/scripts/performance_vs_model_size.py"
rule performance_tables:
input:
[
"src/data/model_score_dicts.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
output:
[
"src/tex/output/performance_table_human_subset.tex",
"src/tex/output/performance_table.tex",
]
script: "src/scripts/make_performance_tables.py"
rule question_counts:
input: "src/scripts/count_json_files.py"
output:
[
directory("src/tex/output/question_count_per_dir"),
"src/tex/output/question_count_per_dir/json_file_counts_reactive_groups.txt",
"src/tex/output/question_count_per_dir/json_file_counts_dai.txt",
"src/tex/output/question_count_per_dir/json_file_counts_h_statements.txt",
"src/tex/output/question_count_per_dir/json_file_counts_oxidation_states.txt",
"src/tex/output/question_count_per_dir/json_file_counts_point_group.txt",
"src/tex/output/question_count_per_dir/json_file_counts_pictograms.txt",
"src/tex/output/question_count_per_dir/json_file_counts_smiles_to_name.txt",
"src/tex/output/question_count_per_dir/json_file_counts_number_of_isomers.txt",
"src/tex/output/question_count_per_dir/json_file_counts_number_of_nmr_peaks.txt",
"src/tex/output/question_count_per_dir/json_file_counts_electron_counts.txt",
"src/tex/output/question_count_per_dir/json_file_counts_chem_chem_comp.txt",
"src/tex/output/question_count_per_dir/json_file_counts_materials_compatibility.txt",
"src/tex/output/question_count_per_dir/json_file_counts_preference.txt",
]
script: "src/scripts/count_json_files.py"
rule logit_calibration:
input: rules.model_score_dict.output
output: "src/tex/figures/log_probs_calibration_plot_overall_filtered.pdf"
script: "src/scripts/plot_logprobs.py"
rule plot_temperature_impact:
input: "src/data/model_score_dicts.pkl"
output: "src/tex/figures/swarm_plot_combined.pdf"
script: "src/scripts/plot_temperature_diffs.py"
rule tool_usage:
input: "src/data/model_score_dicts.pkl"
output: "src/tex/figures/human_tool_usage_by_topic.pdf"
script: "src/scripts/human_tool_usage.py"
rule confidence_main_text:
input: "src/data/model_score_dicts.pkl"
output:
[
"src/tex/figures/model_confidence_performance.pdf",
"src/tex/output/model_confidence_performance/gpt-4_is_pictograms_average_confidence_correct_overall.txt",
"src/tex/output/model_confidence_performance/gpt-4_is_pictograms_num_correct_overall.txt",
"src/tex/output/model_confidence_performance/gpt-4_is_pictograms_average_confidence_incorrect_overall.txt",
"src/tex/output/model_confidence_performance/claude3_is_pictograms_average_confidence_correct_overall.txt",
"src/tex/output/model_confidence_performance/claude3_is_pictograms_average_confidence_incorrect_overall.txt",
"src/tex/output/model_confidence_performance/gpt-4_is_pictograms_num_incorrect_overall.txt"
]
script: "src/scripts/confidence_estimate.py"
rule refusal_counts:
input: "src/data/model_score_dicts.pkl"
output:"src/tex/output/model_refusal_and_extraction_count.pkl"
script: "src/scripts/count_refusal.py"
rule refusal_table:
input: rules.refusal_counts.output
output: "src/tex/output/model_refusal_table.tex"
script: "src/scripts/make_refusal_tables.py"
rule sources_table:
input: "src/data/questions.pkl"
output: "src/tex/output/sources_table.tex"
script: "src/scripts/make_source_table.py"
rule save_trend_variables:
input: "src/scripts/appendix_variables.py"
output:
[
"src/tex/output/trends_section_variables/gemma_9B.txt",
"src/tex/output/trends_section_variables/diff_between_llama_405B_and_gemma_9B.txt",
]
script: "src/scripts/appendix_variables.py"
#plot performance of models on both corpus
rule plot_corpuses:
input: "src/data/model_score_dicts.pkl"
output: "src/tex/figures/corpus_human_comparison.pdf"
script: "src/scripts/corpus_humanset_performace.py"
rule requires_data:
input: "src/data/questions.pkl"
output:
[
"src/data/requires_data.pkl",
"src/tex/output/reasoning_count.txt",
"src/tex/output/knowledge_count.txt",
"src/tex/output/calculation_count.txt",
"src/tex/output/intuition_count.txt",
]
script: "src/scripts/make_required_skills_table.py"
rule performance_topic_tables:
input:
[
"src/data/model_score_dicts.pkl",
"src/data/humans_as_models_scores_combined.pkl",
]
output:
[
"src/tex/output/performance_topic_table_human_subset.tex",
"src/tex/output/performance_topic_table.tex",
"src/tex/output/total_analytical.txt",
"src/tex/output/total_chemical_preference.txt",
"src/tex/output/total_general.txt",
"src/tex/output/total_inorganic.txt",
"src/tex/output/total_materials_science.txt",
"src/tex/output/total_organic.txt",
"src/tex/output/total_physical.txt",
"src/tex/output/total_technical.txt",
"src/tex/output/total_toxicity_safety.txt",
]
script: "src/scripts/make_topic_performance_tables.py"