File size: 91,971 Bytes
f71c233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for nanoGPT/gpt4o-runs: 44\n",
      "Paper pdfs found for nanoGPT/gpt4o-runs: 16\n",
      "Directories found for nanoGPT/claude-runs: 50\n",
      "Paper pdfs found for nanoGPT/claude-runs: 20\n",
      "Directories found for nanoGPT/deepseek-runs: 37\n",
      "Paper pdfs found for nanoGPT/deepseek-runs: 22\n",
      "Directories found for nanoGPT/llama3.1-runs: 41\n",
      "Paper pdfs found for nanoGPT/llama3.1-runs: 21\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import sys\n",
    "\n",
    "sys.path.append(\"..\")\n",
    "from ai_scientist.perform_review import (\n",
    "    load_paper,\n",
    "    perform_review,\n",
    "    reviewer_system_prompt_neg,\n",
    "    neurips_form,\n",
    ")\n",
    "import os\n",
    "import openai\n",
    "\n",
    "\n",
    "paper_paths = {\n",
    "    \"gpt4o-runs\": [],\n",
    "    \"claude-runs\": [],\n",
    "    \"deepseek-runs\": [],\n",
    "    \"llama3.1-runs\": [],\n",
    "}\n",
    "\n",
    "for dir in paper_paths.keys():\n",
    "    # Get paper directories in dir\n",
    "    full_dir = os.path.join(\"nanoGPT\", dir)\n",
    "    subdirs = next(os.walk(full_dir))[1]\n",
    "    print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "\n",
    "    # Check if paper exists in directory and generate txt file if so\n",
    "    paper_gen_counter = 0\n",
    "    for s_dir in subdirs:\n",
    "        paper_name = s_dir[16:]\n",
    "        if os.path.exists(f\"{full_dir}/{s_dir}/{paper_name}.pdf\"):\n",
    "            paper_paths[dir].append(f\"{full_dir}/{s_dir}/{paper_name}.pdf\")\n",
    "            paper_gen_counter += 1\n",
    "    print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# NanoGPT Paper Reviews"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "llm_cols = [\n",
    "    \"paper_id\",\n",
    "    \"Summary\",\n",
    "    \"Questions\",\n",
    "    \"Limitations\",\n",
    "    \"Ethical Concerns\",\n",
    "    \"Soundness\",\n",
    "    \"Presentation\",\n",
    "    \"Contribution\",\n",
    "    \"Overall\",\n",
    "    \"Confidence\",\n",
    "    \"Strengths\",\n",
    "    \"Weaknesses\",\n",
    "    \"Originality\",\n",
    "    \"Quality\",\n",
    "    \"Clarity\",\n",
    "    \"Significance\",\n",
    "    \"Decision\",\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "client = openai.Client()\n",
    "model = \"gpt-4o-2024-05-13\"\n",
    "\n",
    "num_reflections = 5\n",
    "num_fs_examples = 1\n",
    "num_reviews_ensemble = 5\n",
    "temperature = 0.1\n",
    "reviewer_system_prompt = reviewer_system_prompt_neg\n",
    "review_instruction_form = neurips_form"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for nanoGPT/llama3.1-runs: 41\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240731_212220_layerwise_learning_rates/layerwise_learning_rates.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240731_212220_layerwise_learning_rates/layerwise_learning_rates.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_061540_syntactic_complexity_aware_gpt/syntactic_complexity_aware_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_061540_syntactic_complexity_aware_gpt/syntactic_complexity_aware_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_010354_recency_effect_gpt/recency_effect_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_010354_recency_effect_gpt/recency_effect_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_061933_entity_relationship_gpt/entity_relationship_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_061933_entity_relationship_gpt/entity_relationship_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240731_211950_adaptive_block_size/adaptive_block_size.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240731_211950_adaptive_block_size/adaptive_block_size.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_014116_idiomatic_gpt/idiomatic_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_014116_idiomatic_gpt/idiomatic_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_045953_frequency_based_forgetting_gpt/frequency_based_forgetting_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_045953_frequency_based_forgetting_gpt/frequency_based_forgetting_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240731_213451_temporal_regularization/temporal_regularization.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240731_213451_temporal_regularization/temporal_regularization.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_001010_availability_heuristic_gpt/availability_heuristic_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_001010_availability_heuristic_gpt/availability_heuristic_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_034431_linguistic_difficulty_gpt/linguistic_difficulty_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_034431_linguistic_difficulty_gpt/linguistic_difficulty_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240731_212950_targeted_knowledge_distillation/targeted_knowledge_distillation.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240731_212950_targeted_knowledge_distillation/targeted_knowledge_distillation.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_000729_dual_scale_attention_gpt/dual_scale_attention_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_000729_dual_scale_attention_gpt/dual_scale_attention_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_083347_contrastive_forgetting_gpt/contrastive_forgetting_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_083347_contrastive_forgetting_gpt/contrastive_forgetting_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_075259_syntactic_complexity_aware_gpt/syntactic_complexity_aware_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_075259_syntactic_complexity_aware_gpt/syntactic_complexity_aware_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_072244_domain_invariant_reps/domain_invariant_reps.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_072244_domain_invariant_reps/domain_invariant_reps.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240731_235721_domain_adaptation_meta_learning/domain_adaptation_meta_learning.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240731_235721_domain_adaptation_meta_learning/domain_adaptation_meta_learning.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_030146_selective_forgetting_gpt/selective_forgetting_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_030146_selective_forgetting_gpt/selective_forgetting_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_044633_availability_heuristic_gpt/availability_heuristic_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_044633_availability_heuristic_gpt/availability_heuristic_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_004830_interpretable_dynamic_attention_gpt/interpretable_dynamic_attention_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_004830_interpretable_dynamic_attention_gpt/interpretable_dynamic_attention_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_041741_primacy_effect_gpt/primacy_effect_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_041741_primacy_effect_gpt/primacy_effect_gpt.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for nanoGPT/llama3.1-runs/20240801_042950_novelty_conditioned_gpt/novelty_conditioned_gpt.pdf\n",
      "Generated review file for nanoGPT/llama3.1-runs/20240801_042950_novelty_conditioned_gpt/novelty_conditioned_gpt.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Paper pdfs found for nanoGPT/llama3.1-runs: 21\n"
     ]
    }
   ],
   "source": [
    "paper_paths = {\n",
    "    \"gpt4o-runs\": [],\n",
    "    \"claude-runs\": [],\n",
    "    \"deepseek-runs\": [],\n",
    "    \"llama3.1-runs\": [],\n",
    "}\n",
    "\n",
    "for dir in paper_paths.keys():\n",
    "    # Get paper directories in dir\n",
    "    full_dir = os.path.join(\"nanoGPT\", dir)\n",
    "    subdirs = next(os.walk(full_dir))[1]\n",
    "    print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "    rating_fname = os.path.join(\"nanoGPT\", dir + \"_ratings.csv\")\n",
    "    llm_ratings = pd.DataFrame(columns=llm_cols)\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "\n",
    "    # Check if paper exists in directory and generate txt file if so\n",
    "    paper_gen_counter = 0\n",
    "    for s_dir in subdirs:\n",
    "        paper_name = s_dir[16:]\n",
    "        pdf_path = f\"{full_dir}/{s_dir}/{paper_name}.pdf\"\n",
    "        try:\n",
    "            if os.path.exists(pdf_path):\n",
    "                paper_paths[dir].append(pdf_path)\n",
    "                paper_gen_counter += 1\n",
    "                txt_path = f\"parsed_ai_papers/{full_dir}/{s_dir}.txt\"\n",
    "                os.makedirs(os.path.dirname(txt_path), exist_ok=True)\n",
    "                if not os.path.exists(txt_path):\n",
    "                    text = load_paper(pdf_path, num_pages=None)\n",
    "                    with open(txt_path, \"w\") as f:\n",
    "                        f.write(text)\n",
    "                    print(f\"Generated txt file for {pdf_path}\")\n",
    "                else:\n",
    "                    with open(txt_path, \"r\") as f:\n",
    "                        text = f.read()\n",
    "\n",
    "                review = perform_review(\n",
    "                    text,\n",
    "                    model,\n",
    "                    client,\n",
    "                    num_reflections,\n",
    "                    num_fs_examples,\n",
    "                    num_reviews_ensemble,\n",
    "                    temperature,\n",
    "                    reviewer_system_prompt=reviewer_system_prompt,\n",
    "                    review_instruction_form=review_instruction_form,\n",
    "                )\n",
    "                correct_review = sum([k in review for k in llm_cols[1:]]) == len(\n",
    "                    llm_cols[1:]\n",
    "                )\n",
    "                if correct_review:\n",
    "                    # Add the reviews to the rankings dataframe as a new row\n",
    "                    llm_ratings.loc[paper_name] = review\n",
    "                    llm_ratings.to_csv(rating_fname)\n",
    "                    print(f\"Generated review file for {pdf_path}\")\n",
    "                    print(f\"Decision: {review['Decision']}, Score: {review['Overall']}\")\n",
    "                else:\n",
    "                    print(f\"Review for {pdf_path} was incorrect\")\n",
    "        except Exception as e:\n",
    "            print(f\"Error processing {pdf_path}: {e}\")\n",
    "\n",
    "    print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model gpt4o - Min: 3, Max: 5, Mean: 3.25\n",
      "Model claude - Min: 3, Max: 5, Mean: 4.05\n",
      "Model deepseek - Min: 3, Max: 4, Mean: 3.210526315789474\n",
      "Model llama3.1 - Min: 1, Max: 3, Mean: 2.3157894736842106\n"
     ]
    }
   ],
   "source": [
    "# Load dataframe with results\n",
    "all_scores = {\n",
    "    \"gpt4o\": None,\n",
    "    \"claude\": None,\n",
    "    \"deepseek\": None,\n",
    "    \"llama3.1\": None,\n",
    "}\n",
    "\n",
    "for model in all_scores.keys():\n",
    "    llm_ratings = pd.read_csv(f\"nanoGPT/{model}-runs_ratings.csv\")\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "    scores = llm_ratings[\"Overall\"].tolist()\n",
    "    all_scores[model] = scores\n",
    "    print(\n",
    "        f\"Model {model} - Min: {min(scores)}, Max: {max(scores)}, Mean: {sum(scores)/len(scores)}\"\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Diffusion Paper Reviews"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for diffusion/llama3.1-runs: 31\n",
      "Paper pdfs found for diffusion/llama3.1-runs: 20\n"
     ]
    }
   ],
   "source": [
    "paper_paths = {\n",
    "    \"gpt4o-runs\": [],\n",
    "    \"claude-runs\": [],\n",
    "    \"deepseek-runs\": [],\n",
    "    \"llama3.1-runs\": [],\n",
    "}\n",
    "\n",
    "for dir in paper_paths.keys():\n",
    "    # Get paper directories in dir\n",
    "    full_dir = os.path.join(\"diffusion\", dir)\n",
    "    subdirs = next(os.walk(full_dir))[1]\n",
    "    print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "\n",
    "    # Check if paper exists in directory and generate txt file if so\n",
    "    paper_gen_counter = 0\n",
    "    for s_dir in subdirs:\n",
    "        paper_name = s_dir[16:]\n",
    "        if os.path.exists(f\"{full_dir}/{s_dir}/{paper_name}.pdf\"):\n",
    "            paper_paths[dir].append(f\"{full_dir}/{s_dir}/{paper_name}.pdf\")\n",
    "            paper_gen_counter += 1\n",
    "    print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diffusion/llama3.1-runs\n",
      "Directories found for diffusion/llama3.1-runs: 31\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_063127_mode_transition/mode_transition.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_063127_mode_transition/mode_transition.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_080530_noise_schedule_signatures/noise_schedule_signatures.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_080530_noise_schedule_signatures/noise_schedule_signatures.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_065703_mode_signatures/mode_signatures.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_065703_mode_signatures/mode_signatures.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_071635_dataset_distribution_fingerprinting/dataset_distribution_fingerprinting.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_071635_dataset_distribution_fingerprinting/dataset_distribution_fingerprinting.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_075145_diffusion_perturbations/diffusion_perturbations.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_075145_diffusion_perturbations/diffusion_perturbations.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_051323_learning_rate_schedule/learning_rate_schedule.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_051323_learning_rate_schedule/learning_rate_schedule.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_052053_resolution_conditioned_diffusion/resolution_conditioned_diffusion.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_052053_resolution_conditioned_diffusion/resolution_conditioned_diffusion.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_085047_noise_schedule_interpolation/noise_schedule_interpolation.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_085047_noise_schedule_interpolation/noise_schedule_interpolation.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_100934_noise_schedule_analysis/noise_schedule_analysis.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_100934_noise_schedule_analysis/noise_schedule_analysis.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_084629_diffusion_model_temporal_adaptation/diffusion_model_temporal_adaptation.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_084629_diffusion_model_temporal_adaptation/diffusion_model_temporal_adaptation.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_085742_diffusion_model_masking/diffusion_model_masking.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_085742_diffusion_model_masking/diffusion_model_masking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_051553_hybrid_embedding/hybrid_embedding.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_051553_hybrid_embedding/hybrid_embedding.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_091633_diffusion_trajectory_quality/diffusion_trajectory_quality.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_091633_diffusion_trajectory_quality/diffusion_trajectory_quality.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_051823_mode_specific_diffusion/mode_specific_diffusion.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_051823_mode_specific_diffusion/mode_specific_diffusion.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_065715_diffusion_confidence/diffusion_confidence.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_065715_diffusion_confidence/diffusion_confidence.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_052323_geometric_constraints/geometric_constraints.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_052323_geometric_constraints/geometric_constraints.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_052824_dataset_agnostic_diffusion/dataset_agnostic_diffusion.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_052824_dataset_agnostic_diffusion/dataset_agnostic_diffusion.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_054621_diffusion_trajectory_control/diffusion_trajectory_control.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_054621_diffusion_trajectory_control/diffusion_trajectory_control.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_084148_noise_schedule_symmetry/noise_schedule_symmetry.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_084148_noise_schedule_symmetry/noise_schedule_symmetry.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for diffusion/llama3.1-runs/20240803_071545_symmetry_invariant_loss/symmetry_invariant_loss.pdf\n",
      "Generated review file for diffusion/llama3.1-runs/20240803_071545_symmetry_invariant_loss/symmetry_invariant_loss.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Paper pdfs found for diffusion/llama3.1-runs: 20\n"
     ]
    }
   ],
   "source": [
    "model = \"gpt-4o-2024-05-13\"\n",
    "\n",
    "for dir in paper_paths.keys():\n",
    "    # Get paper directories in dir\n",
    "    full_dir = os.path.join(\"diffusion\", dir)\n",
    "    print(full_dir)\n",
    "    subdirs = next(os.walk(full_dir))[1]\n",
    "    print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "    rating_fname = os.path.join(\"diffusion\", dir + \"_ratings.csv\")\n",
    "    llm_ratings = pd.DataFrame(columns=llm_cols)\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "\n",
    "    # Check if paper exists in directory and generate txt file if so\n",
    "    paper_gen_counter = 0\n",
    "    for s_dir in subdirs:\n",
    "        paper_name = s_dir[16:]\n",
    "        pdf_path = f\"{full_dir}/{s_dir}/{paper_name}.pdf\"\n",
    "        try:\n",
    "            if os.path.exists(pdf_path):\n",
    "                paper_paths[dir].append(pdf_path)\n",
    "                paper_gen_counter += 1\n",
    "\n",
    "                txt_path = f\"parsed_ai_papers/{full_dir}/{s_dir}.txt\"\n",
    "                os.makedirs(os.path.dirname(txt_path), exist_ok=True)\n",
    "                if not os.path.exists(txt_path):\n",
    "                    text = load_paper(pdf_path, num_pages=None)\n",
    "                    with open(txt_path, \"w\") as f:\n",
    "                        f.write(text)\n",
    "                    print(f\"Generated txt file for {pdf_path}\")\n",
    "                else:\n",
    "                    with open(txt_path, \"r\") as f:\n",
    "                        text = f.read()\n",
    "                review = perform_review(\n",
    "                    text,\n",
    "                    model,\n",
    "                    client,\n",
    "                    num_reflections,\n",
    "                    num_fs_examples,\n",
    "                    num_reviews_ensemble,\n",
    "                    temperature,\n",
    "                    reviewer_system_prompt=reviewer_system_prompt,\n",
    "                    review_instruction_form=review_instruction_form,\n",
    "                )\n",
    "                correct_review = sum([k in review for k in llm_cols[1:]]) == len(\n",
    "                    llm_cols[1:]\n",
    "                )\n",
    "                if correct_review:\n",
    "                    # Add the reviews to the rankings dataframe as a new row\n",
    "                    llm_ratings.loc[paper_name] = review\n",
    "                    llm_ratings.to_csv(rating_fname)\n",
    "                    print(f\"Generated review file for {pdf_path}\")\n",
    "                    print(f\"Decision: {review['Decision']}, Score: {review['Overall']}\")\n",
    "                else:\n",
    "                    print(f\"Review for {pdf_path} was incorrect\")\n",
    "        except Exception as e:\n",
    "            print(f\"Error for {pdf_path}: {e}\")\n",
    "\n",
    "    print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model gpt4o - Min: 3, Max: 5, Mean: 3.7058823529411766\n",
      "Model claude - Min: 3, Max: 6, Mean: 3.8157894736842106\n",
      "Model deepseek - Min: 3, Max: 5, Mean: 3.3214285714285716\n",
      "Model llama3.1 - Min: 1, Max: 3, Mean: 2.3\n"
     ]
    }
   ],
   "source": [
    "# Load dataframe with results\n",
    "all_scores = {\n",
    "    \"gpt4o\": None,\n",
    "    \"claude\": None,\n",
    "    \"deepseek\": None,\n",
    "    \"llama3.1\": None,\n",
    "}\n",
    "\n",
    "for model in all_scores.keys():\n",
    "    llm_ratings = pd.read_csv(f\"diffusion/{model}-runs_ratings.csv\")\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "    scores = llm_ratings[\"Overall\"].tolist()\n",
    "    all_scores[model] = scores\n",
    "    print(\n",
    "        f\"Model {model} - Min: {min(scores)}, Max: {max(scores)}, Mean: {sum(scores)/len(scores)}\"\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Grokking Reviews"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for grokking/llama3.1-runs: 42\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_100036_permutation_equivariance_grokking/permutation_equivariance_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_100036_permutation_equivariance_grokking/permutation_equivariance_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_002804_math_operation_depth_grokking/math_operation_depth_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_002804_math_operation_depth_grokking/math_operation_depth_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_080426_hierarchical_meta_pattern_grokking/hierarchical_meta_pattern_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_080426_hierarchical_meta_pattern_grokking/hierarchical_meta_pattern_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_072525_structured_irrelevant_info_grokking/structured_irrelevant_info_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_072525_structured_irrelevant_info_grokking/structured_irrelevant_info_grokking.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_094851_controlled_concept_drift_grokking/controlled_concept_drift_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_094851_controlled_concept_drift_grokking/controlled_concept_drift_grokking.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_145029_hierarchical_math_operations/hierarchical_math_operations.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_145029_hierarchical_math_operations/hierarchical_math_operations.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_102104_operation_invariance/operation_invariance.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_102104_operation_invariance/operation_invariance.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_003304_missing_operand_grokking/missing_operand_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_003304_missing_operand_grokking/missing_operand_grokking.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_175803_arithmetic_decomposition/arithmetic_decomposition.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_175803_arithmetic_decomposition/arithmetic_decomposition.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_040654_hierarchical_math_operations/hierarchical_math_operations.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_040654_hierarchical_math_operations/hierarchical_math_operations.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_002303_numbering_system_grokking/numbering_system_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_002303_numbering_system_grokking/numbering_system_grokking.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_132224_modular_to_nonmodular_grokking/modular_to_nonmodular_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_132224_modular_to_nonmodular_grokking/modular_to_nonmodular_grokking.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_103132_cognitive_demand_generalization/cognitive_demand_generalization.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_103132_cognitive_demand_generalization/cognitive_demand_generalization.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_132853_math_operation_representation_comparison/math_operation_representation_comparison.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_132853_math_operation_representation_comparison/math_operation_representation_comparison.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_104541_operation_compositionality_grokking/operation_compositionality_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_104541_operation_compositionality_grokking/operation_compositionality_grokking.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_032142_identity_element_grokking/identity_element_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_032142_identity_element_grokking/identity_element_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_003034_graph_structure_grokking/graph_structure_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_003034_graph_structure_grokking/graph_structure_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_070827_distracting_patterns_grokking/distracting_patterns_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_070827_distracting_patterns_grokking/distracting_patterns_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_043727_few_shot_grokking/few_shot_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_043727_few_shot_grokking/few_shot_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_004309_operation_representation_networks/operation_representation_networks.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_004309_operation_representation_networks/operation_representation_networks.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_042456_arithmetic_decomposition/arithmetic_decomposition.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_042456_arithmetic_decomposition/arithmetic_decomposition.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_060902_nested_operations/nested_operations.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_060902_nested_operations/nested_operations.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_061539_isomorphic_grokking/isomorphic_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_061539_isomorphic_grokking/isomorphic_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_104945_model_capacity_grokking/model_capacity_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_104945_model_capacity_grokking/model_capacity_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_033537_distracting_patterns_grokking/distracting_patterns_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_033537_distracting_patterns_grokking/distracting_patterns_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_002533_rotational_symmetry_grokking/rotational_symmetry_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_002533_rotational_symmetry_grokking/rotational_symmetry_grokking.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_131714_fractal_operations_grokking/fractal_operations_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_131714_fractal_operations_grokking/fractal_operations_grokking.pdf\n",
      "Decision: Reject, Score: 1\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_025747_abstractness_grokking/abstractness_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_025747_abstractness_grokking/abstractness_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_114200_operation_complexity_generalization/operation_complexity_generalization.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_114200_operation_complexity_generalization/operation_complexity_generalization.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Generated txt file for grokking/llama3.1-runs/20240803_063216_abstract_algebra_grokking/abstract_algebra_grokking.pdf\n",
      "Generated review file for grokking/llama3.1-runs/20240803_063216_abstract_algebra_grokking/abstract_algebra_grokking.pdf\n",
      "Decision: Reject, Score: 2\n",
      "Paper pdfs found for grokking/llama3.1-runs: 30\n"
     ]
    }
   ],
   "source": [
    "paper_paths = {\n",
    "    \"gpt4o-runs\": [],\n",
    "    \"claude-runs\": [],\n",
    "    \"deepseek-runs\": [],\n",
    "    \"llama3.1-runs\": [],\n",
    "}\n",
    "\n",
    "model = \"gpt-4o-2024-05-13\"\n",
    "\n",
    "for dir in paper_paths.keys():\n",
    "    # Get paper directories in dir\n",
    "    full_dir = os.path.join(\"grokking\", dir)\n",
    "    subdirs = next(os.walk(full_dir))[1]\n",
    "    print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "    rating_fname = os.path.join(\"grokking\", dir + \"_ratings.csv\")\n",
    "    llm_ratings = pd.DataFrame(columns=llm_cols)\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "\n",
    "    # Check if paper exists in directory and generate txt file if so\n",
    "    paper_gen_counter = 0\n",
    "    for s_dir in subdirs:\n",
    "        paper_name = s_dir[16:]\n",
    "        pdf_path = f\"{full_dir}/{s_dir}/{paper_name}.pdf\"\n",
    "        try:\n",
    "            if os.path.exists(pdf_path):\n",
    "                paper_paths[dir].append(pdf_path)\n",
    "                paper_gen_counter += 1\n",
    "\n",
    "                txt_path = f\"parsed_ai_papers/{full_dir}/{s_dir}.txt\"\n",
    "                os.makedirs(os.path.dirname(txt_path), exist_ok=True)\n",
    "                if not os.path.exists(txt_path):\n",
    "                    text = load_paper(pdf_path, num_pages=None)\n",
    "                    with open(txt_path, \"w\") as f:\n",
    "                        f.write(text)\n",
    "                    print(f\"Generated txt file for {pdf_path}\")\n",
    "                else:\n",
    "                    with open(txt_path, \"r\") as f:\n",
    "                        text = f.read()\n",
    "                review = perform_review(\n",
    "                    text,\n",
    "                    model,\n",
    "                    client,\n",
    "                    num_reflections,\n",
    "                    num_fs_examples,\n",
    "                    num_reviews_ensemble,\n",
    "                    temperature,\n",
    "                    reviewer_system_prompt=reviewer_system_prompt,\n",
    "                    review_instruction_form=review_instruction_form,\n",
    "                )\n",
    "                correct_review = sum([k in review for k in llm_cols[1:]]) == len(\n",
    "                    llm_cols[1:]\n",
    "                )\n",
    "                if correct_review:\n",
    "                    # Add the reviews to the rankings dataframe as a new row\n",
    "                    llm_ratings.loc[paper_name] = review\n",
    "                    llm_ratings.to_csv(rating_fname)\n",
    "                    print(f\"Generated review file for {pdf_path}\")\n",
    "                    print(f\"Decision: {review['Decision']}, Score: {review['Overall']}\")\n",
    "                else:\n",
    "                    print(f\"Review for {pdf_path} was incorrect\")\n",
    "        except Exception as e:\n",
    "            print(f\"Error for {pdf_path}: {e}\")\n",
    "\n",
    "    print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model gpt4o - Min: 2, Max: 3, Mean: 2.9166666666666665\n",
      "Model claude - Min: 3, Max: 5, Mean: 3.44\n",
      "Model deepseek - Min: 3, Max: 4, Mean: 3.125\n",
      "Model llama3.1 - Min: 1, Max: 3, Mean: 2.0\n"
     ]
    }
   ],
   "source": [
    "# Load dataframe with results\n",
    "all_scores = {\n",
    "    \"gpt4o\": None,\n",
    "    \"claude\": None,\n",
    "    \"deepseek\": None,\n",
    "    \"llama3.1\": None,\n",
    "}\n",
    "\n",
    "for model in all_scores.keys():\n",
    "    llm_ratings = pd.read_csv(f\"grokking/{model}-runs_ratings.csv\")\n",
    "    llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "    scores = llm_ratings[\"Overall\"].tolist()\n",
    "    all_scores[model] = scores\n",
    "    print(\n",
    "        f\"Model {model} - Min: {min(scores)}, Max: {max(scores)}, Mean: {sum(scores)/len(scores)}\"\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Manual Paper Reviews"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for manual_papers: 6\n",
      "{'Summary': 'The paper introduces an adaptive dual-scale denoising approach for low-dimensional diffusion models, aiming to balance global structure and local details in generated samples. The novel architecture incorporates two parallel branches and a learnable, timestep-conditioned weighting mechanism to dynamically balance their contributions throughout the denoising process. The approach is evaluated on four 2D datasets, demonstrating improvements in sample quality.', 'Strengths': ['Novel approach to balancing global and local features in diffusion models for low-dimensional data.', 'Comprehensive empirical evaluation on multiple 2D datasets.', 'Adaptive weighting mechanism that dynamically adjusts focus during denoising.'], 'Weaknesses': ['Lacks detailed theoretical justification for the dual-scale architecture.', 'Computational cost is significantly higher, which may limit practical applicability.', 'Some sections are not clearly explained, such as the autoencoder aggregator and weight evolution analysis.', 'Limited diversity in the datasets used for evaluation. More complex, real-world datasets could strengthen claims.', 'Insufficient ablation studies and analysis on specific design choices like different types of aggregators.'], 'Originality': 4, 'Quality': 3, 'Clarity': 3, 'Significance': 3, 'Questions': ['Can you provide a more detailed theoretical justification for the dual-scale architecture?', \"What impact do different types of aggregators have on the model's performance?\", 'How does the model perform on more complex, real-world low-dimensional datasets?', 'Can the computational cost be reduced without sacrificing performance?'], 'Limitations': ['The paper should address the high computational cost and explore ways to optimize it.', 'The limited diversity of datasets and lack of detailed theoretical backing for the proposed architecture are notable limitations.'], 'Ethical Concerns': False, 'Soundness': 3, 'Presentation': 3, 'Contribution': 3, 'Overall': 5, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240802_090035_adaptive_dual_scale_denoising/adaptive_dual_scale_denoising.pdf\n",
      "Generated review file for manual_papers/20240802_090035_adaptive_dual_scale_denoising/adaptive_dual_scale_denoising.pdf\n",
      "Decision: Reject, Score: 5\n",
      "{'Summary': 'The paper proposes a novel layer-wise learning rate strategy to accelerate and enhance the grokking phenomenon in Transformer models. The approach involves assigning different learning rates to the embedding layers, lower Transformer layers, and higher Transformer layers. The method is empirically validated on algorithmic tasks such as modular arithmetic and permutations, showing significant improvements in convergence speed and final performance.', 'Strengths': ['The paper addresses an important problem in deep learning: the grokking phenomenon.', 'The proposed layer-wise learning rate strategy is novel and shows significant improvements in experimental results.', 'Experiments demonstrate substantial improvements in both convergence speed and final performance.'], 'Weaknesses': ['The paper lacks detailed methodological clarity, particularly regarding the exact implementation of the layer-wise learning rates and hyperparameter tuning.', 'The theoretical explanation for why layer-wise learning rates work is insufficient.', 'The scope of tasks is limited to algorithmic ones, making it unclear how well the findings generalize to other domains.', 'The choice of learning rates seems arbitrary and lacks justification.', 'More comprehensive ablation studies and comparisons with other related methods would strengthen the paper.', 'Certain sections, such as the experimental setup and ablation studies, could be more detailed and clearer.'], 'Originality': 3, 'Quality': 2, 'Clarity': 3, 'Significance': 3, 'Questions': ['Can the authors provide more detailed explanations of the hyperparameter tuning process and the exact implementation of the layer-wise learning rates?', 'How do the authors ensure that the proposed method generalizes to tasks beyond the algorithmic ones tested in the paper?', 'Can the authors compare their approach with other related methods in more detail?', 'Can you provide more theoretical insights into why layer-wise learning rates specifically facilitate grokking?', 'How were the specific learning rates chosen for embedding, lower, and higher layers?', 'Can you discuss the potential for overfitting and how it was mitigated?', 'Have you tested the robustness of your method across different datasets and larger model sizes?', 'What is the impact of different learning rate configurations on the results?', 'Can the authors discuss potential strategies for mitigating the need for careful tuning of learning rates to avoid instability?'], 'Limitations': ['The methodology lacks detailed clarity, and the authors do not provide sufficient information on the hyperparameter tuning process.', 'The scope of tasks is limited to algorithmic ones, and the generalizability of the findings is unclear.', 'The paper requires more theoretical backing for the proposed method.', 'The choice of specific learning rates and potential overfitting issues need to be addressed in more detail.', 'The scalability of the approach to larger models and more complex tasks is not thoroughly addressed.', 'Ethical concerns related to the potential misuse of accelerated learning techniques are not addressed.'], 'Ethical Concerns': False, 'Soundness': 2, 'Presentation': 2, 'Contribution': 3, 'Overall': 4, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240801_032548_layerwise_lr_grokking/layerwise_lr_grokking.pdf\n",
      "Generated review file for manual_papers/20240801_032548_layerwise_lr_grokking/layerwise_lr_grokking.pdf\n",
      "Decision: Reject, Score: 4\n",
      "{'Summary': 'The paper introduces the Multi-Style Adapter, which enhances style awareness and consistency in character-level language models by integrating learnable style embeddings, a style classification head, and a StyleAdapter module into the GPT architecture. The approach aims to balance style adaptation and language modeling capabilities, and demonstrates improved style consistency and competitive validation losses across multiple datasets.', 'Strengths': ['The paper presents a novel approach to style-aware language modeling, addressing a critical need for fine-grained stylistic control.', 'The Multi-Style Adapter is well-motivated and integrates seamlessly with the GPT architecture.', 'Extensive experiments on diverse datasets demonstrate improved style consistency and validation loss.', 'The paper includes thorough analysis and visualization of learned style embeddings and attention patterns.'], 'Weaknesses': ['The model achieves perfect style consistency scores on some datasets, which may indicate overfitting to specific style patterns.', 'The reduced inference speed (approximately 40% slower than the baseline) may limit the practical applicability of the model.', 'The paper could explore more sophisticated style representation techniques and evaluate their impact.', 'Lack of detailed ablation studies and additional baselines to strengthen the claims.', 'Clarity of the autoencoder aggregator mechanism could be enhanced.'], 'Originality': 3, 'Quality': 3, 'Clarity': 3, 'Significance': 3, 'Questions': ['How does the model handle unseen styles during inference?', 'Can the authors provide more details on the training process and hyperparameter tuning?', \"What are the potential impacts of overfitting on the model's ability to generate diverse text within each style?\", 'Can the authors provide more detailed ablation studies, especially focusing on the impact of different components in the Multi-Style Adapter?', 'How does the Multi-Style Adapter perform compared to other recent style-transfer models?', 'Can the computational efficiency trade-offs be quantified in a more detailed manner?', \"Can the authors clarify the autoencoder aggregator's role and how it integrates with the rest of the model?\", 'What measures have been taken to ensure the model does not overfit to specific style patterns, especially given the perfect consistency scores on some datasets?', 'Are there any potential optimization techniques that could be explored to improve the computational efficiency of the Multi-Style Adapter?', 'How does the model handle cases where the input sequence contains mixed styles?', 'Could you provide more qualitative examples of generated text to demonstrate the style consistency?', 'What is the impact of reducing the number of gating parameters in the modulation function?'], 'Limitations': [\"The reduced inference speed and potential overfitting to specific style patterns are significant limitations. Future work should focus on optimizing computational efficiency and improving the model's ability to generalize to diverse styles.\", 'The paper currently lacks sufficient ablation studies and additional baselines.', \"The model's performance may be sensitive to hyperparameter settings, such as the weight of the style loss and the frequency of StyleAdapter application.\"], 'Ethical Concerns': False, 'Soundness': 3, 'Presentation': 3, 'Contribution': 3, 'Overall': 5, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240727_060642_multi_style_adapter/multi_style_adapter.pdf\n",
      "Generated review file for manual_papers/20240727_060642_multi_style_adapter/multi_style_adapter.pdf\n",
      "Decision: Reject, Score: 5\n",
      "{'Summary': 'The paper explores the application of Q-learning to dynamically adjust the learning rate during transformer model training, aiming to enhance training efficiency and model performance. The state is represented by the validation loss and current learning rate, and the Q-learning agent learns to adjust the learning rate to optimize the training process. The approach is validated on three datasets: shakespeare_char, enwik8, and text8.', 'Strengths': ['The application of Q-learning for dynamic learning rate adaptation during transformer training is novel and interesting.', 'The paper addresses an important problem in neural network training: the selection of an appropriate learning rate schedule.', 'Comprehensive experimental setup on multiple datasets.'], 'Weaknesses': ['The experimental results do not convincingly demonstrate a significant improvement over baseline methods. The best validation loss achieved by the Q-learning method on the shakespeare_char dataset is worse than the baseline.', 'The choice of state representation (validation loss and current learning rate) is not well-justified.', 'The paper lacks a detailed comparison with other sophisticated adaptive learning rate methods like AdamW, LAMB, Lookahead, or Noisy Adam.', 'The clarity of the explanation on Q-learning and the reward signal could be improved.', 'The technical details of the Q-learning implementation and its integration with transformer training are not thoroughly explained.', 'The significance of the results is questionable given the additional complexity introduced by the Q-learning agent.', 'The figures and tables are not clear and do not provide sufficient insight into the benefits of the proposed method.', 'The paper does not sufficiently address the limitations of the proposed method, such as sensitivity to hyperparameters and potential overhead from the Q-learning agent.', 'The discussion on the broader impacts and potential applications of the approach is limited.'], 'Originality': 2, 'Quality': 2, 'Clarity': 2, 'Significance': 2, 'Questions': ['Can you provide a detailed justification for the choice of state representation (validation loss and current learning rate)?', 'How does your method compare with other adaptive learning rate methods like AdamW, LAMB, Lookahead, or Noisy Adam in terms of both performance and computational overhead?', 'Can you clarify the reward signal used in your Q-learning approach?', 'Why were other RL approaches not considered or compared with Q-learning?', 'Can the authors provide more details on the hyperparameter tuning process?', 'Can the authors provide more details on the state and action space used in Q-learning?', 'How sensitive is the approach to the choice of hyperparameters for Q-learning?', 'Can the authors provide a more in-depth analysis of why Q-learning leads to better performance?', 'Can you provide more details on the implementation of the Q-learning agent and its interaction with the training process?', 'What specific benefits does Q-learning offer over other RL-based hyperparameter optimization methods?', 'Can you elaborate on the marginal improvements in validation loss? Why are the differences so small?', 'How does the proposed method generalize to other types of neural network architectures or other hyperparameters?', 'Can the authors provide more insights into the robustness and generality of the proposed Q-learning based approach?', 'How does the method perform on other types of neural network architectures apart from transformers?', 'Can the authors discuss potential limitations and ethical concerns in more detail?'], 'Limitations': [\"The method's performance is sensitive to the choice of hyperparameters, and there is additional overhead introduced by the Q-learning agent.\", 'The experimental results do not convincingly demonstrate significant improvements over baseline methods.', 'The approach may not generalize well to other types of neural network architectures without further tuning.', 'The authors should discuss the potential drawbacks and challenges of using Q-learning for learning rate adaptation in more detail.', 'The paper does not adequately address the potential limitations and ethical concerns of the proposed approach. It is important to discuss how the method scales to other neural network architectures and the potential risks associated with its use.'], 'Ethical Concerns': False, 'Soundness': 2, 'Presentation': 2, 'Contribution': 2, 'Overall': 3, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240725_214144_rl_lr_adaptation/rl_lr_adaptation.pdf\n",
      "Generated review file for manual_papers/20240725_214144_rl_lr_adaptation/rl_lr_adaptation.pdf\n",
      "Decision: Reject, Score: 3\n",
      "{'Summary': 'The paper investigates the impact of weight initialization strategies on the grokking phenomenon in Transformer models, focusing on arithmetic tasks in finite fields. It compares five initialization methods (PyTorch default, Xavier, He, Orthogonal, and Kaiming Normal) using a small Transformer architecture. The study reveals significant differences in convergence speed and generalization capabilities across initialization strategies, with Xavier and Orthogonal initializations showing superior performance.', 'Strengths': ['Addresses an intriguing and underexplored phenomenon in deep learning.', 'Provides a systematic comparison of multiple weight initialization strategies.', 'Includes rigorous empirical analysis and statistical validation.', 'Offers practical guidelines for initialization in similar learning scenarios.'], 'Weaknesses': ['The scope is limited to small Transformer models and arithmetic tasks, which may not generalize well to larger models or more complex tasks.', 'The paper lacks deeper theoretical insights into why certain initialization strategies perform better.', 'The clarity of the experimental setup and the integration of figures and tables could be improved.', 'The implications for broader Transformer applications and potential societal impacts are not sufficiently addressed.'], 'Originality': 3, 'Quality': 3, 'Clarity': 3, 'Significance': 3, 'Questions': ['Can the authors provide more theoretical explanations for why certain initialization methods perform better?', 'How do the findings translate to more complex, real-world tasks beyond simple arithmetic operations?', 'Can the clarity of the figures and tables be improved, and can key graphs be better integrated into the text?', 'What are the potential negative societal impacts of the findings?'], 'Limitations': ['The study is limited to small Transformer models and arithmetic tasks, which may not fully represent the complexity of real-world problems.', 'The paper lacks a deeper theoretical understanding of the observed phenomena.', 'The potential negative societal impacts of the findings are not addressed.'], 'Ethical Concerns': False, 'Soundness': 3, 'Presentation': 3, 'Contribution': 3, 'Overall': 5, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240731_205208_weight_initialization_grokking/weight_initialization_grokking.pdf\n",
      "Generated review file for manual_papers/20240731_205208_weight_initialization_grokking/weight_initialization_grokking.pdf\n",
      "Decision: Reject, Score: 5\n",
      "{'Summary': 'The paper proposes integrating a Generative Adversarial Network (GAN) framework into diffusion models to improve sample quality and diversity. The approach includes a simple discriminator network, an adversarial loss term, and a gradient penalty to the adversarial loss. Extensive experiments on multiple 2D datasets are conducted to validate the approach, comparing results in terms of training time, evaluation loss, KL divergence, and sample quality.', 'Strengths': ['The integration of GAN framework with diffusion models is a novel approach to improve sample quality and diversity.', 'The introduction of a gradient penalty to improve training stability is a thoughtful addition.', 'The paper provides a comprehensive evaluation on multiple 2D datasets, using various metrics such as training time, evaluation loss, KL divergence, and sample quality.'], 'Weaknesses': ['The methodology section lacks detailed explanations for certain components, such as the exact architecture of the discriminator network and the choice of hyperparameters.', \"The improvements in evaluation loss and KL divergence are not consistent across all datasets, indicating that the model's performance may be dataset-dependent.\", \"The experimental scope is limited to 2D datasets. Further research is needed to evaluate the model's performance on higher-dimensional data.\", 'The paper lacks sufficient ablation studies to isolate the contributions of different components of the proposed method.', 'The evaluation metrics are somewhat limited; including metrics like FID could strengthen the evaluation.', 'The paper does not sufficiently address the limitations of the approach, particularly its dataset dependency and scalability to higher-dimensional data.', 'There is no discussion on potential negative societal impacts or ethical concerns related to the work.'], 'Originality': 3, 'Quality': 2, 'Clarity': 2, 'Significance': 2, 'Questions': ['Can you provide more details on the architecture of the discriminator network?', \"How do the hyperparameters λadv and λgp affect the model's performance?\", 'Can you explain why the improvements are inconsistent across different datasets?', 'Can the authors provide more detailed descriptions of the denoiser and discriminator networks?', 'Have the authors considered using more comprehensive evaluation metrics like FID?', 'Can the authors provide more ablation studies to isolate the contributions of the gradient penalty and adversarial loss?', 'How would the proposed method perform on more complex and higher-dimensional datasets?'], 'Limitations': ['The paper acknowledges the increased training time and dataset dependency of the improvements. However, it could benefit from a more thorough exploration of different architectures and higher-dimensional datasets.', \"The empirical results show mixed improvements, indicating that the model's performance may be dataset-dependent.\", 'The paper does not explore the limitations of the proposed approach in depth, particularly in terms of scalability to higher-dimensional data.'], 'Ethical Concerns': False, 'Soundness': 2, 'Presentation': 2, 'Contribution': 2, 'Overall': 3, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240716_185529_gan_diffusion/gan_diffusion.pdf\n",
      "Generated review file for manual_papers/20240716_185529_gan_diffusion/gan_diffusion.pdf\n",
      "Decision: Reject, Score: 3\n",
      "Paper pdfs found for manual_papers: 6\n"
     ]
    }
   ],
   "source": [
    "import json\n",
    "\n",
    "model = \"gpt-4o-2024-05-13\"\n",
    "\n",
    "\n",
    "# Get paper directories in dir\n",
    "full_dir = \"manual_papers\"\n",
    "subdirs = next(os.walk(full_dir))[1]\n",
    "print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "rating_fname = os.path.join(\"manual_papers\", \"manual_paper_ratings.csv\")\n",
    "llm_ratings = pd.DataFrame(columns=llm_cols)\n",
    "llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "\n",
    "# Check if paper exists in directory and generate txt file if so\n",
    "paper_gen_counter = 0\n",
    "for s_dir in subdirs:\n",
    "    paper_name = s_dir[16:]\n",
    "    pdf_path = f\"{full_dir}/{s_dir}/{paper_name}.pdf\"\n",
    "    try:\n",
    "        if os.path.exists(pdf_path):\n",
    "            paper_paths[dir].append(pdf_path)\n",
    "            paper_gen_counter += 1\n",
    "\n",
    "            txt_path = f\"parsed_ai_papers/{full_dir}/{s_dir}.txt\"\n",
    "            os.makedirs(os.path.dirname(txt_path), exist_ok=True)\n",
    "            if not os.path.exists(txt_path):\n",
    "                text = load_paper(pdf_path, num_pages=None)\n",
    "                with open(txt_path, \"w\") as f:\n",
    "                    f.write(text)\n",
    "                print(f\"Generated txt file for {pdf_path}\")\n",
    "            else:\n",
    "                with open(txt_path, \"r\") as f:\n",
    "                    text = f.read()\n",
    "            review = perform_review(\n",
    "                text,\n",
    "                model,\n",
    "                client,\n",
    "                num_reflections,\n",
    "                num_fs_examples,\n",
    "                num_reviews_ensemble,\n",
    "                temperature,\n",
    "                reviewer_system_prompt=reviewer_system_prompt,\n",
    "                review_instruction_form=review_instruction_form,\n",
    "            )\n",
    "            print(review)\n",
    "            with open(f\"manual_papers/{s_dir}.txt\", \"w\") as f:\n",
    "                f.write(json.dumps(review, indent=4))\n",
    "            print(f\"Generated review txt file for {pdf_path}\")\n",
    "            correct_review = sum([k in review for k in llm_cols[1:]]) == len(\n",
    "                llm_cols[1:]\n",
    "            )\n",
    "            if correct_review:\n",
    "                # Add the reviews to the rankings dataframe as a new row\n",
    "                llm_ratings.loc[paper_name] = review\n",
    "                llm_ratings.to_csv(rating_fname)\n",
    "                print(f\"Generated review file for {pdf_path}\")\n",
    "                print(f\"Decision: {review['Decision']}, Score: {review['Overall']}\")\n",
    "            else:\n",
    "                print(f\"Review for {pdf_path} was incorrect\")\n",
    "    except Exception as e:\n",
    "        print(f\"Error for {pdf_path}: {e}\")\n",
    "\n",
    "print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories found for manual_papers: 1\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Summary</th>\n",
       "      <th>Questions</th>\n",
       "      <th>Limitations</th>\n",
       "      <th>Ethical Concerns</th>\n",
       "      <th>Soundness</th>\n",
       "      <th>Presentation</th>\n",
       "      <th>Contribution</th>\n",
       "      <th>Overall</th>\n",
       "      <th>Confidence</th>\n",
       "      <th>Strengths</th>\n",
       "      <th>Weaknesses</th>\n",
       "      <th>Originality</th>\n",
       "      <th>Quality</th>\n",
       "      <th>Clarity</th>\n",
       "      <th>Significance</th>\n",
       "      <th>Decision</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>paper_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>adaptive_dual_scale_denoising</th>\n",
       "      <td>The paper introduces an adaptive dual-scale de...</td>\n",
       "      <td>['Can you provide a more detailed theoretical ...</td>\n",
       "      <td>['The paper should address the high computatio...</td>\n",
       "      <td>False</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>['Novel approach to balancing global and local...</td>\n",
       "      <td>['Lacks detailed theoretical justification for...</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>layerwise_lr_grokking</th>\n",
       "      <td>The paper proposes a novel layer-wise learning...</td>\n",
       "      <td>['Can the authors provide more detailed explan...</td>\n",
       "      <td>['The methodology lacks detailed clarity, and ...</td>\n",
       "      <td>False</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>['The paper addresses an important problem in ...</td>\n",
       "      <td>['The paper lacks detailed methodological clar...</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>multi_style_adapter</th>\n",
       "      <td>The paper introduces the Multi-Style Adapter, ...</td>\n",
       "      <td>['How does the model handle unseen styles duri...</td>\n",
       "      <td>[\"The reduced inference speed and potential ov...</td>\n",
       "      <td>False</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>['The paper presents a novel approach to style...</td>\n",
       "      <td>['The model achieves perfect style consistency...</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rl_lr_adaptation</th>\n",
       "      <td>The paper explores the application of Q-learni...</td>\n",
       "      <td>['Can you provide a detailed justification for...</td>\n",
       "      <td>[\"The method's performance is sensitive to the...</td>\n",
       "      <td>False</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>['The application of Q-learning for dynamic le...</td>\n",
       "      <td>['The experimental results do not convincingly...</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>weight_initialization_grokking</th>\n",
       "      <td>The paper investigates the impact of weight in...</td>\n",
       "      <td>['Can the authors provide more theoretical exp...</td>\n",
       "      <td>['The study is limited to small Transformer mo...</td>\n",
       "      <td>False</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>['Addresses an intriguing and underexplored ph...</td>\n",
       "      <td>['The scope is limited to small Transformer mo...</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gan_diffusion</th>\n",
       "      <td>The paper proposes integrating a Generative Ad...</td>\n",
       "      <td>['Can you provide more details on the architec...</td>\n",
       "      <td>['The paper acknowledges the increased trainin...</td>\n",
       "      <td>False</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>['The integration of GAN framework with diffus...</td>\n",
       "      <td>['The methodology section lacks detailed expla...</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>layerwise_learning_rates</th>\n",
       "      <td>The paper investigates the impact of learning ...</td>\n",
       "      <td>[\"Can you provide detailed content for the pla...</td>\n",
       "      <td>['The paper is incomplete and lacks detailed c...</td>\n",
       "      <td>False</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>['The topic of learning rate schedules is rele...</td>\n",
       "      <td>['The paper is incomplete, with missing sectio...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>grid_based_noise_adaptation</th>\n",
       "      <td>The paper introduces a multi-scale grid-based ...</td>\n",
       "      <td>['Can the authors provide more detailed explan...</td>\n",
       "      <td>[\"The paper does not discuss the potential soc...</td>\n",
       "      <td>False</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>['The paper addresses a relevant problem in th...</td>\n",
       "      <td>['The paper lacks clarity in some sections, es...</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>data_augmentation_grokking</th>\n",
       "      <td>The paper investigates the impact of data augm...</td>\n",
       "      <td>['Can the authors provide more details on the ...</td>\n",
       "      <td>[\"The paper's clarity and thoroughness in disc...</td>\n",
       "      <td>False</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>['Addresses a novel and relevant topic in deep...</td>\n",
       "      <td>['Lacks clarity in some sections, particularly...</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mdl_grokking_correlation</th>\n",
       "      <td>This paper investigates the phenomenon of grok...</td>\n",
       "      <td>['Can the authors provide a more detailed desc...</td>\n",
       "      <td>['The paper needs to address the clarity of th...</td>\n",
       "      <td>False</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>['The paper addresses a significant and poorly...</td>\n",
       "      <td>['The description of the weight pruning techni...</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Reject</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                                          Summary  \\\n",
       "paper_id                                                                            \n",
       "adaptive_dual_scale_denoising   The paper introduces an adaptive dual-scale de...   \n",
       "layerwise_lr_grokking           The paper proposes a novel layer-wise learning...   \n",
       "multi_style_adapter             The paper introduces the Multi-Style Adapter, ...   \n",
       "rl_lr_adaptation                The paper explores the application of Q-learni...   \n",
       "weight_initialization_grokking  The paper investigates the impact of weight in...   \n",
       "gan_diffusion                   The paper proposes integrating a Generative Ad...   \n",
       "layerwise_learning_rates        The paper investigates the impact of learning ...   \n",
       "grid_based_noise_adaptation     The paper introduces a multi-scale grid-based ...   \n",
       "data_augmentation_grokking      The paper investigates the impact of data augm...   \n",
       "mdl_grokking_correlation        This paper investigates the phenomenon of grok...   \n",
       "\n",
       "                                                                        Questions  \\\n",
       "paper_id                                                                            \n",
       "adaptive_dual_scale_denoising   ['Can you provide a more detailed theoretical ...   \n",
       "layerwise_lr_grokking           ['Can the authors provide more detailed explan...   \n",
       "multi_style_adapter             ['How does the model handle unseen styles duri...   \n",
       "rl_lr_adaptation                ['Can you provide a detailed justification for...   \n",
       "weight_initialization_grokking  ['Can the authors provide more theoretical exp...   \n",
       "gan_diffusion                   ['Can you provide more details on the architec...   \n",
       "layerwise_learning_rates        [\"Can you provide detailed content for the pla...   \n",
       "grid_based_noise_adaptation     ['Can the authors provide more detailed explan...   \n",
       "data_augmentation_grokking      ['Can the authors provide more details on the ...   \n",
       "mdl_grokking_correlation        ['Can the authors provide a more detailed desc...   \n",
       "\n",
       "                                                                      Limitations  \\\n",
       "paper_id                                                                            \n",
       "adaptive_dual_scale_denoising   ['The paper should address the high computatio...   \n",
       "layerwise_lr_grokking           ['The methodology lacks detailed clarity, and ...   \n",
       "multi_style_adapter             [\"The reduced inference speed and potential ov...   \n",
       "rl_lr_adaptation                [\"The method's performance is sensitive to the...   \n",
       "weight_initialization_grokking  ['The study is limited to small Transformer mo...   \n",
       "gan_diffusion                   ['The paper acknowledges the increased trainin...   \n",
       "layerwise_learning_rates        ['The paper is incomplete and lacks detailed c...   \n",
       "grid_based_noise_adaptation     [\"The paper does not discuss the potential soc...   \n",
       "data_augmentation_grokking      [\"The paper's clarity and thoroughness in disc...   \n",
       "mdl_grokking_correlation        ['The paper needs to address the clarity of th...   \n",
       "\n",
       "                                Ethical Concerns  Soundness  Presentation  \\\n",
       "paper_id                                                                    \n",
       "adaptive_dual_scale_denoising              False          3             3   \n",
       "layerwise_lr_grokking                      False          2             2   \n",
       "multi_style_adapter                        False          3             3   \n",
       "rl_lr_adaptation                           False          2             2   \n",
       "weight_initialization_grokking             False          3             3   \n",
       "gan_diffusion                              False          2             2   \n",
       "layerwise_learning_rates                   False          1             1   \n",
       "grid_based_noise_adaptation                False          2             2   \n",
       "data_augmentation_grokking                 False          3             3   \n",
       "mdl_grokking_correlation                   False          2             2   \n",
       "\n",
       "                                Contribution  Overall  Confidence  \\\n",
       "paper_id                                                            \n",
       "adaptive_dual_scale_denoising              3        5           4   \n",
       "layerwise_lr_grokking                      3        4           4   \n",
       "multi_style_adapter                        3        5           4   \n",
       "rl_lr_adaptation                           2        3           4   \n",
       "weight_initialization_grokking             3        5           4   \n",
       "gan_diffusion                              2        3           4   \n",
       "layerwise_learning_rates                   1        2           4   \n",
       "grid_based_noise_adaptation                2        4           4   \n",
       "data_augmentation_grokking                 3        5           4   \n",
       "mdl_grokking_correlation                   2        3           4   \n",
       "\n",
       "                                                                        Strengths  \\\n",
       "paper_id                                                                            \n",
       "adaptive_dual_scale_denoising   ['Novel approach to balancing global and local...   \n",
       "layerwise_lr_grokking           ['The paper addresses an important problem in ...   \n",
       "multi_style_adapter             ['The paper presents a novel approach to style...   \n",
       "rl_lr_adaptation                ['The application of Q-learning for dynamic le...   \n",
       "weight_initialization_grokking  ['Addresses an intriguing and underexplored ph...   \n",
       "gan_diffusion                   ['The integration of GAN framework with diffus...   \n",
       "layerwise_learning_rates        ['The topic of learning rate schedules is rele...   \n",
       "grid_based_noise_adaptation     ['The paper addresses a relevant problem in th...   \n",
       "data_augmentation_grokking      ['Addresses a novel and relevant topic in deep...   \n",
       "mdl_grokking_correlation        ['The paper addresses a significant and poorly...   \n",
       "\n",
       "                                                                       Weaknesses  \\\n",
       "paper_id                                                                            \n",
       "adaptive_dual_scale_denoising   ['Lacks detailed theoretical justification for...   \n",
       "layerwise_lr_grokking           ['The paper lacks detailed methodological clar...   \n",
       "multi_style_adapter             ['The model achieves perfect style consistency...   \n",
       "rl_lr_adaptation                ['The experimental results do not convincingly...   \n",
       "weight_initialization_grokking  ['The scope is limited to small Transformer mo...   \n",
       "gan_diffusion                   ['The methodology section lacks detailed expla...   \n",
       "layerwise_learning_rates        ['The paper is incomplete, with missing sectio...   \n",
       "grid_based_noise_adaptation     ['The paper lacks clarity in some sections, es...   \n",
       "data_augmentation_grokking      ['Lacks clarity in some sections, particularly...   \n",
       "mdl_grokking_correlation        ['The description of the weight pruning techni...   \n",
       "\n",
       "                                Originality  Quality  Clarity  Significance  \\\n",
       "paper_id                                                                      \n",
       "adaptive_dual_scale_denoising             4        3        3             3   \n",
       "layerwise_lr_grokking                     3        2        3             3   \n",
       "multi_style_adapter                       3        3        3             3   \n",
       "rl_lr_adaptation                          2        2        2             2   \n",
       "weight_initialization_grokking            3        3        3             3   \n",
       "gan_diffusion                             3        2        2             2   \n",
       "layerwise_learning_rates                  1        1        1             1   \n",
       "grid_based_noise_adaptation               3        2        2             3   \n",
       "data_augmentation_grokking                3        3        3             3   \n",
       "mdl_grokking_correlation                  3        2        2             3   \n",
       "\n",
       "                               Decision  \n",
       "paper_id                                 \n",
       "adaptive_dual_scale_denoising    Reject  \n",
       "layerwise_lr_grokking            Reject  \n",
       "multi_style_adapter              Reject  \n",
       "rl_lr_adaptation                 Reject  \n",
       "weight_initialization_grokking   Reject  \n",
       "gan_diffusion                    Reject  \n",
       "layerwise_learning_rates         Reject  \n",
       "grid_based_noise_adaptation      Reject  \n",
       "data_augmentation_grokking       Reject  \n",
       "mdl_grokking_correlation         Reject  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import json\n",
    "\n",
    "model = \"gpt-4o-2024-05-13\"\n",
    "\n",
    "\n",
    "# Get paper directories in dir\n",
    "full_dir = \"manual_papers\"\n",
    "subdirs = [\n",
    "    \"20240805_071251_dual_expert_denoiser\",\n",
    "    \"20240805_104019_grid_based_noise_adaptation\",\n",
    "    \"20240804_022805_data_augmentation_grokking\",\n",
    "    \"20240804_045218_mdl_grokking_correlation\",\n",
    "]\n",
    "print(f\"Directories found for {full_dir}: {len(subdirs)}\")\n",
    "rating_fname = os.path.join(\"manual_papers\", \"manual_paper_ratings.csv\")\n",
    "\n",
    "llm_ratings = pd.read_csv(rating_fname)\n",
    "llm_ratings.set_index(\"paper_id\", inplace=True)\n",
    "llm_ratings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "manual_papers/20240805_071251_dual_expert_denoiser/dual_expert_denoiser.pdf\n",
      "Generated txt file for manual_papers/20240805_071251_dual_expert_denoiser/dual_expert_denoiser.pdf\n",
      "{'Summary': \"The paper 'DualDiff: Enhancing Mode Capture in Low-Dimensional Diffusion Models via Dual-Expert Denoising' introduces a dual-expert denoising architecture aimed at enhancing diffusion models' performance on low-dimensional datasets. The method uses a gating mechanism to combine two specialized expert networks dynamically, which helps in capturing multiple modes in low-dimensional data distributions. The paper demonstrates substantial improvements in terms of mode capture and sample diversity, validated through various experiments on 2D datasets like 'circle', 'dino', 'line', and 'moons'.\", 'Strengths': ['The paper addresses a relevant and challenging problem in the field of generative modeling.', 'The dual-expert architecture and dynamic gating mechanism are novel and well-formulated.', \"Extensive experiments provide strong evidence of the approach's effectiveness.\", 'The introduction of a diversity loss term to encourage multiple mode capture is a valuable contribution.'], 'Weaknesses': ['The novelty of combining two expert networks with a gating mechanism is somewhat incremental.', 'The choice of datasets is limited to simple 2D shapes, which might not fully demonstrate the generalizability of the approach.', 'The evaluation of gating mechanism behavior is not sufficiently detailed.', 'The increased training and inference times are a significant drawback that may limit practical applicability.', 'The diversity loss term is weighted arbitrarily without thorough justification for the chosen value.', 'The paper lacks detailed ablation studies to isolate the impact of different components (e.g., gating mechanism, diversity loss).', 'Potential limitations and negative societal impacts are not adequately addressed.'], 'Originality': 3, 'Quality': 3, 'Clarity': 3, 'Significance': 3, 'Questions': ['Could you provide more detailed analysis on how the gating mechanism adapts during training?', 'How would the model perform on higher-dimensional datasets or more complex low-dimensional datasets?', 'Is the choice of the diversity loss weight (λ) empirically validated? Could different values lead to significantly different results?', 'Can the authors provide more details on the gating mechanism and how it determines the weight for each expert network?', 'How does the performance vary with different configurations of the gating network?', 'Can the authors explain the choice of hyperparameters, particularly the value of lambda in the diversity loss term?', 'Can the authors provide more detailed ablation studies to quantify the impact of each component (e.g., gating mechanism, diversity loss)?', 'How does the model perform with different types of aggregators for the expert networks?', 'Can more qualitative examples and visualizations be provided to substantiate the claims of improved mode capture?', 'Can you provide more details on the architecture of the expert networks and the gating mechanism?', 'How does the diversity loss term impact the final performance, and what are the trade-offs?', 'Can you include more comprehensive ablation studies to evaluate the impact of each component of the proposed method?', 'What are the computational costs associated with the dual-expert architecture, and how do they compare to the baseline?'], 'Limitations': ['The increased computational cost and the focus on low-dimensional datasets are the primary limitations of the proposed approach.', 'The generalizability to higher-dimensional settings remains unclear.', 'Potential negative societal impacts and limitations are not adequately addressed.'], 'Ethical Concerns': False, 'Soundness': 3, 'Presentation': 3, 'Contribution': 3, 'Overall': 5, 'Confidence': 4, 'Decision': 'Reject'}\n",
      "Generated review txt file for manual_papers/20240805_071251_dual_expert_denoiser/dual_expert_denoiser.pdf\n",
      "Generated review file for manual_papers/20240805_071251_dual_expert_denoiser/dual_expert_denoiser.pdf\n",
      "Decision: Reject, Score: 5\n",
      "Paper pdfs found for manual_papers: 1\n"
     ]
    }
   ],
   "source": [
    "# Check if paper exists in directory and generate txt file if so\n",
    "paper_gen_counter = 0\n",
    "for s_dir in subdirs:\n",
    "    paper_name = s_dir[16:]\n",
    "    pdf_path = f\"{full_dir}/{s_dir}/{paper_name}.pdf\"\n",
    "    print(pdf_path)\n",
    "    try:\n",
    "        if os.path.exists(pdf_path):\n",
    "            paper_paths[dir].append(pdf_path)\n",
    "            paper_gen_counter += 1\n",
    "\n",
    "            txt_path = f\"parsed_ai_papers/{full_dir}/{s_dir}.txt\"\n",
    "            os.makedirs(os.path.dirname(txt_path), exist_ok=True)\n",
    "            if not os.path.exists(txt_path):\n",
    "                text = load_paper(pdf_path, num_pages=None)\n",
    "                with open(txt_path, \"w\") as f:\n",
    "                    f.write(text)\n",
    "                print(f\"Generated txt file for {pdf_path}\")\n",
    "            else:\n",
    "                with open(txt_path, \"r\") as f:\n",
    "                    text = f.read()\n",
    "            review = perform_review(\n",
    "                text,\n",
    "                model,\n",
    "                client,\n",
    "                num_reflections,\n",
    "                num_fs_examples,\n",
    "                num_reviews_ensemble,\n",
    "                temperature,\n",
    "                reviewer_system_prompt=reviewer_system_prompt,\n",
    "                review_instruction_form=review_instruction_form,\n",
    "            )\n",
    "            print(review)\n",
    "            with open(f\"manual_papers/{s_dir}.txt\", \"w\") as f:\n",
    "                f.write(json.dumps(review, indent=4))\n",
    "            print(f\"Generated review txt file for {pdf_path}\")\n",
    "            correct_review = sum([k in review for k in llm_cols[1:]]) == len(\n",
    "                llm_cols[1:]\n",
    "            )\n",
    "            if correct_review:\n",
    "                # Add the reviews to the rankings dataframe as a new row\n",
    "                llm_ratings.loc[paper_name] = review\n",
    "                llm_ratings.to_csv(rating_fname)\n",
    "                print(f\"Generated review file for {pdf_path}\")\n",
    "                print(f\"Decision: {review['Decision']}, Score: {review['Overall']}\")\n",
    "            else:\n",
    "                print(f\"Review for {pdf_path} was incorrect\")\n",
    "    except Exception as e:\n",
    "        print(f\"Error for {pdf_path}: {e}\")\n",
    "\n",
    "print(f\"Paper pdfs found for {full_dir}: {paper_gen_counter}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "llmopt",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}