File size: 77,934 Bytes
cf4cc7a | 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 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | wandb: Detected [huggingface_hub.inference, openai] in use.
wandb: Use W&B Weave for improved LLM call tracing. Install Weave with `pip install weave` then add `import weave` to the top of your script.
wandb: For more information, check out the docs at: https://weave-docs.wandb.ai/
Initial GPU Memory Stats:
Allocated: 0.00 MB
Cached: 0.00 MB
Max Allocated: 0.00 MB
Initializing bidirectional cross-attention model abhinand/MedEmbed-large-v0.1...
============================================================
π¦₯ UNSLOTH MODE: Loading encoder with optimized kernels
============================================================
π¦₯ Unsloth Status:
Available: β
Yes
FastSentenceTransformer: β
Yes (preferred)
Version: 2026.1.4
CUDA: β
Yes
GPU: NVIDIA GeForce RTX 4080 SUPER
GPU Memory: 16.71 GB
API: FastSentenceTransformer (specialized for embeddings) β
Target modules: ['q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj']
[INFO] Auto-detected max_seq_length for abhinand/MedEmbed-large-v0.1: 512
============================================================
π¦₯ UNSLOTH MODE: Creating optimized sentence encoder
============================================================
API: FastSentenceTransformer (specialized for embeddings)
Model: abhinand/MedEmbed-large-v0.1
Max seq length: 512
Full finetuning: False
Unsloth: Using fast encoder path for bert (torch.compile + SDPA)
`torch_dtype` is deprecated! Use `dtype` instead!
Unsloth: Enabled gradient checkpointing
β οΈ Unsloth loading failed: Target modules {'down_proj', 'v_proj', 'up_proj', 'k_proj', 'o_proj', 'q_proj', 'gate_proj'} not found in the base model. Please check the target modules and try again.
Traceback (most recent call last):
File "/home/dtim/Ataur/LOKI/Cross_Attention/run_cross_attention.py", line 847, in main
sentence_encoder = create_unsloth_sentence_encoder(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dtim/Ataur/LOKI/Cross_Attention/unsloth_encoder.py", line 462, in create_unsloth_sentence_encoder
sentence_encoder = FastSentenceTransformer.get_peft_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/unsloth/models/sentence_transformer.py", line 1685, in get_peft_model
peft_model = peft_get_peft_model(inner_model, lora_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/peft/mapping_func.py", line 122, in get_peft_model
return MODEL_TYPE_TO_PEFT_MODEL_MAPPING[peft_config.task_type](
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/peft/peft_model.py", line 2966, in __init__
super().__init__(model, peft_config, adapter_name, **kwargs)
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/peft/peft_model.py", line 129, in __init__
self.base_model = cls(model, {adapter_name: peft_config}, adapter_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/peft/tuners/tuners_utils.py", line 298, in __init__
self.inject_adapter(self.model, adapter_name, low_cpu_mem_usage=low_cpu_mem_usage, state_dict=state_dict)
File "/home/dtim/anaconda3/envs/LOKI/lib/python3.12/site-packages/peft/tuners/tuners_utils.py", line 880, in inject_adapter
raise ValueError(error_msg)
ValueError: Target modules {'down_proj', 'v_proj', 'up_proj', 'k_proj', 'o_proj', 'q_proj', 'gate_proj'} not found in the base model. Please check the target modules and try again.
Falling back to standard SentenceTransformer loading...
Encoder fine-tuning enabled (trainable_encoder=True). No encoder LoRA adapters are attached by default.
Initialized model without Flash Attention
Embedding dimension: 1024
Max sequence length: 512
Loading datasets...
Loaded 19516 training examples
β‘ Sampled 10000 training examples (deterministic, seed=42)
Loaded 2444 evaluation examples
β‘ Sampled 1000 evaluation examples (deterministic)
Using top_k_sparse attention mechanism
Initializing Top-K Sparse Attention (k=5)
Initializing top-k sparse attention with method: zeros
Successfully applied zeros initialization to top-k sparse attention
Initializing top-k sparse attention with method: zeros
Successfully applied zeros initialization to top-k sparse attention
Using cosine pair scoring method
Bidirectional model initialized with top_k=5, pair_score_method=cosine, share_weights=True, use_refinement=False
Using initialization method: zeros
Initialization parameters: {'bias_value': 0.0}
Sentence encoder is trainable
Sentence encoder dtype detected: torch.float32
Model initialized with standard cross-attention layers
π Model Parameter Statistics:
Total parameters: 354,040,343
Trainable parameters: 354,040,343
Frozen parameters: 0
Trainable percentage: 100.00%
π― Loss and Aggregation Configuration:
Architecture: Bidirectional
Loss type: bidirectional_triplet
Aggregation method: top_k_pairs
Top-k value: 5
Norm type: rmsnorm
Q/K RMSNorm: False
Embedding caching: β Disabled
Triplet batching: π Isolated examples
Triplet strategy: LIMITED
Max triplets/example: 2
π² Initialization Configuration:
Method: zeros
Description: Initialize all weights to zero (tests uniform attention baseline)
Parameters: {'bias_value': 0.0}
π Loss Component Weights (will be normalized):
Triplet weight: 0.5
Attention weight: 0.0
Pair weight: 0.3
βοΈ Loss Parameters:
Margin: 0.3
Scale: 10.0
Pair margin: 0.3
Pair score method: cosine
Share attention weights: True
Join path extraction: True
Join path threshold: 0.15
Self-attention enabled: False
Attention mechanism: top_k_sparse
Sparse top-k: 5
π― Attention Mechanism Configuration:
Attention type: top_k_sparse
Sparse top-k: 5
Initialization method: zeros
π Bidirectional-Specific Configuration:
Pair margin: 0.3
Pair score method: cosine
Share attention weights: True
Join path extraction: True
Join path threshold: 0.15
Self-attention enabled: False
Output will be saved to: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945
Training configuration saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_config.json
Starting Model Training...
==================================================
Starting training with ID-based triplet batches...
π― Training curves tracker initialized:
π Output directory: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945
π Tracking batch losses: True
π Tracking validation loss: True
π Tracking row-sentence metrics: True
πΎ Auto-save: True
π¨ Auto-plot: False
π― Training curves tracking enabled
π Test-based model saving enabled - will save best models by test metrics
π Loading row-sentence evaluation data...
π Row-sentence evaluation data:
Test examples: 36
Annotations: 0
Examples with annotations: 0
βΉοΈ Row-sentence data in MIMIC format - will sync with MIMIC loader
π Loading MIMIC evaluation data...
[INFO] Loaded 18 MIMIC annotations
Diagnosis row groundings: 114
Medication row groundings: 162
[INFO] MIMIC evaluation data loaded:
Test examples: 36
Annotations: 18 admissions
Matched examples: 36
β
MIMIC evaluation enabled (all 36 test examples)
π Cache disabled: MIMIC test will be re-encoded each epoch
π Syncing generic row-sentence evaluation with loaded MIMIC data for consistent AP tracking...
Preparing triplet batches...
Triplet sampling strategy: LIMITED
Max triplets per example: 2
Using ISOLATED triplet batching (triplets from the same example stay together)
Processing examples (isolated batches): 100%|ββββββββββ| 10000/10000 [00:01<00:00, 5335.99it/s]
π Triplet Generation Statistics (Isolated Batching):
Total examples: 10000
Total triplets: 16502
Avg triplets/example: 1.65
Min triplets/example: 1
Max triplets/example: 2
Examples with 0 triplets: 0
Created 10000 triplet batches for training (all triplets included, adaptive batching)
Scheduler configured for 200000 steps with 20000 warmup steps
π₯ STAGE 0: FROZEN ENCODER ONLY EVALUATION...
Evaluating with ONLY the frozen sentence encoder (no cross-attention at all)...
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:05<00:00, 4.21s/it]
π₯ FROZEN ENCODER ONLY Accuracy: 0.806
(Total comparisons: 24296)
π Stage 0: Evaluating row-sentence alignment...
βΉοΈ Using MIMIC evaluator (Level A)...
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.185
Medication: 18 examples, F1=0.242
π₯ Stage 0 Row-Sent Avg Precision: 0.419
π₯ Stage 0 Row-Sent Overall Accuracy: 0.213
π STAGE 1: SOPHISTICATED MODEL EVALUATION (PRE-TRAINING)...
Evaluating sophisticated model BEFORE training...
π Using CUDA device for evaluation
π― TRAINING CONFIGURATION: Starting from Stage 0
π Configuration detected:
Encoder trainable: True
Use cache: False
Use LoRA: False
Encoder-only training: True
Mode: Encoder-only training (cross-attention heads frozen)
Encoder tuning mode: gradual unfreezing
π Gradual unfreezing initialized: 2/24 top layers trainable (layers 22..23)
Enabling gradient checkpointing for memory efficiency
Optimizer groups configured: head=0 @ 1.00e-04, encoder=391 @ 1.00e-05
Initialized EncoderOnlyTripletLoss with margin=0.3, scale=10.0, ranking=infonce
Initialized EncoderOnlyTripletLoss with margin=0.3, scale=10.0
Using cosine LR schedule with warmup
π§ Using bidirectional evaluation for bidirectional model
Evaluating bidirectional model with join path extraction...
Evaluating examples: 100%|ββββββββββ| 1000/1000 [1:10:13<00:00, 4.21s/it]
π SOPHISTICATED MODEL Accuracy (Pre-training): 0.806
π Stage 1: Evaluating row-sentence alignment (Sophisticated Untrained)...
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.185
Medication: 18 examples, F1=0.242
π Stage 1 Row-Sent Avg Precision: 0.418
π Stage 1 Row-Sent Overall Accuracy: 0.213
π ARCHITECTURE BENEFIT:
π₯βπ Sophisticated model benefit: +0.000 (0.0%)
π ROW-SENTENCE PROGRESSION (Avg Precision):
π₯ Stage 0 (Frozen): 0.419
π Stage 1 (Sophisticated): 0.418 (+-0.000)
β οΈ WARNING: Sophisticated model barely improves over frozen encoder!
Consider if the architecture complexity is necessary for this task.
π Logging initial stage metrics to wandb...
β
Baseline metrics logged to wandb (epoch 0)
π Adding initial stage metrics to training curves...
π Initial stage metrics recorded:
π₯ Stage 0 (Frozen): 0.81 acc, 0.42 row-sent AP
π Stage 1 (Sophisticated Untrained): 0.81 acc, 0.42 row-sent AP
π― Stage 2 (Initial): 0.00 acc, 0.00 row-sent AP
π Adding Epoch 0 (untrained model) baseline to training curves...
π STARTING TRAINING OF ENCODER ONLY (NO HEADS)
Training model type: Encoder Only (No Heads)
Training from Stage: 0
==================== Epoch 1/20 ====================
Training model has 26242048 trainable parameters
Epoch 1: 100%|ββββββββββ| 10000/10000 [4:48:51<00:00, 1.73s/it, batch_loss=0.687]
Current learning rates: 5.00e-06 | margin=0.300
Epoch 1 loss statistics - Mean: 0.689, Min: 0.520, Max: 0.854
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:57<00:00, 4.20s/it]
Epoch 1 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36305.59it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.58it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.203
Medication: 18 examples, F1=0.244
Row-Sent Overall Acc: 0.224
Row-Sent Avg Precision: 0.435
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37328.79it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.44it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.203
Medication: 18 examples, F1=0.244
MIMIC Diagnosis - P: 0.119, R: 0.847, F1: 0.203
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.244
π Epoch 1 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21544.8s
π Learning Rate: 5.00e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.44
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
New best model! Accuracy: 0.806
New best test overall accuracy! 0.224 (Epoch 1)
New best test average precision! 0.435 (Epoch 1)
==================== Epoch 2/20 ====================
π Gradual unfreezing: enabled layers 21..21 (total 3/24)
Epoch 2: 100%|ββββββββββ| 10000/10000 [4:49:35<00:00, 1.74s/it, batch_loss=0.683]
Current learning rates: 1.00e-05 | margin=0.300
Epoch 2 loss statistics - Mean: 0.689, Min: 0.523, Max: 0.871
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:21<00:00, 4.22s/it]
Epoch 2 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36314.32it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.60it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.203
Medication: 18 examples, F1=0.244
Row-Sent Overall Acc: 0.223
Row-Sent Avg Precision: 0.435
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37748.74it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.77it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.203
Medication: 18 examples, F1=0.244
MIMIC Diagnosis - P: 0.118, R: 0.847, F1: 0.203
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.244
π Epoch 2 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21613.4s
π Learning Rate: 1.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.44
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 3/20 ====================
π Gradual unfreezing: enabled layers 20..20 (total 4/24)
Epoch 3: 100%|ββββββββββ| 10000/10000 [4:50:32<00:00, 1.74s/it, batch_loss=0.683]
Current learning rates: 9.92e-06 | margin=0.300
Epoch 3 loss statistics - Mean: 0.689, Min: 0.504, Max: 0.875
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:17<00:00, 4.22s/it]
Epoch 3 Accuracy: 0.805
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 35511.51it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.69it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.435
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36846.01it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.21it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.244
MIMIC Diagnosis - P: 0.117, R: 0.847, F1: 0.201
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.244
π Epoch 3 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21666.8s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.44
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 4/20 ====================
π Gradual unfreezing: enabled layers 19..19 (total 5/24)
Epoch 4: 100%|ββββββββββ| 10000/10000 [4:50:41<00:00, 1.74s/it, batch_loss=0.683]
Current learning rates: 9.70e-06 | margin=0.300
Epoch 4 loss statistics - Mean: 0.689, Min: 0.525, Max: 0.854
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:11<00:00, 4.21s/it]
Epoch 4 Accuracy: 0.805
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36756.32it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.76it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.244
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.435
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 18810.88it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 56.02it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.244
MIMIC Diagnosis - P: 0.117, R: 0.847, F1: 0.201
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.244
π Epoch 4 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21669.1s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 5/20 ====================
π Gradual unfreezing: enabled layers 18..18 (total 6/24)
Epoch 5: 100%|ββββββββββ| 10000/10000 [4:50:47<00:00, 1.74s/it, batch_loss=0.686]
Current learning rates: 9.33e-06 | margin=0.300
Epoch 5 loss statistics - Mean: 0.689, Min: 0.535, Max: 0.854
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:56<00:00, 4.20s/it]
Epoch 5 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36054.19it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.85it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.434
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 39097.60it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.19it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
MIMIC Diagnosis - P: 0.117, R: 0.849, F1: 0.201
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.243
π Epoch 5 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21660.5s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 6/20 ====================
Epoch 6: 100%|ββββββββββ| 10000/10000 [4:50:51<00:00, 1.75s/it, batch_loss=0.688]
Current learning rates: 8.83e-06 | margin=0.300
Epoch 6 loss statistics - Mean: 0.689, Min: 0.532, Max: 0.857
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:18<00:00, 4.22s/it]
Epoch 6 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 35603.62it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.66it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.244
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.434
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36756.32it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 58.97it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.244
MIMIC Diagnosis - P: 0.117, R: 0.851, F1: 0.201
MIMIC Medication - P: 0.153, R: 0.840, F1: 0.244
π Epoch 6 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21686.2s
π Learning Rate: 8.83e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 7/20 ====================
Epoch 7: 100%|ββββββββββ| 10000/10000 [4:51:28<00:00, 1.75s/it, batch_loss=0.682]
Current learning rates: 8.21e-06 | margin=0.300
Epoch 7 loss statistics - Mean: 0.689, Min: 0.512, Max: 0.866
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:17<00:00, 4.22s/it]
Epoch 7 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37504.95it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.92it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.16it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.435
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 16710.37it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 57.66it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
MIMIC Diagnosis - P: 0.117, R: 0.851, F1: 0.201
MIMIC Medication - P: 0.152, R: 0.840, F1: 0.243
π Epoch 7 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21722.1s
π Learning Rate: 8.21e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 8/20 ====================
Epoch 8: 100%|ββββββββββ| 10000/10000 [4:51:15<00:00, 1.75s/it, batch_loss=0.682]
Current learning rates: 7.50e-06 | margin=0.300
Epoch 8 loss statistics - Mean: 0.689, Min: 0.536, Max: 0.865
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:14<00:00, 4.21s/it]
Epoch 8 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37099.49it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.28it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.201
Medication: 18 examples, F1=0.243
Row-Sent Overall Acc: 0.222
Row-Sent Avg Precision: 0.434
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36587.10it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.93it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.243
MIMIC Diagnosis - P: 0.117, R: 0.851, F1: 0.200
MIMIC Medication - P: 0.152, R: 0.840, F1: 0.243
π Epoch 8 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21706.6s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 9/20 ====================
Epoch 9: 100%|ββββββββββ| 10000/10000 [4:51:10<00:00, 1.75s/it, batch_loss=0.681]
Current learning rates: 6.71e-06 | margin=0.300
Epoch 9 loss statistics - Mean: 0.689, Min: 0.522, Max: 0.859
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:14<00:00, 4.21s/it]
Epoch 9 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 33149.27it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.62it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
Row-Sent Overall Acc: 0.221
Row-Sent Avg Precision: 0.434
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 35704.65it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 58.34it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
MIMIC Diagnosis - P: 0.116, R: 0.851, F1: 0.200
MIMIC Medication - P: 0.151, R: 0.840, F1: 0.241
π Epoch 9 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 1)
β±οΈ Epoch Time: 21701.2s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 10/20 ====================
Epoch 10: 100%|ββββββββββ| 10000/10000 [4:51:09<00:00, 1.75s/it, batch_loss=0.678]
Current learning rates: 5.87e-06 | margin=0.300
Epoch 10 loss statistics - Mean: 0.689, Min: 0.531, Max: 0.860
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:17<00:00, 4.22s/it]
Epoch 10 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 34735.44it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.24it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
Row-Sent Overall Acc: 0.221
Row-Sent Avg Precision: 0.434
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 38101.17it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.52it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
MIMIC Diagnosis - P: 0.116, R: 0.851, F1: 0.200
MIMIC Medication - P: 0.151, R: 0.840, F1: 0.241
π Epoch 10 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21704.0s
π Learning Rate: 5.87e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
New best model! Accuracy: 0.806
==================== Epoch 11/20 ====================
Epoch 11: 100%|ββββββββββ| 10000/10000 [4:51:28<00:00, 1.75s/it, batch_loss=0.678]
Current learning rates: 5.00e-06 | margin=0.300
Epoch 11 loss statistics - Mean: 0.689, Min: 0.530, Max: 0.859
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:21<00:00, 4.22s/it]
Epoch 11 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 35229.80it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.53it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
Row-Sent Overall Acc: 0.221
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 34976.82it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.47it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.17it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.241
MIMIC Diagnosis - P: 0.116, R: 0.851, F1: 0.200
MIMIC Medication - P: 0.151, R: 0.840, F1: 0.241
π Epoch 11 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21726.3s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 12/20 ====================
Epoch 12: 100%|ββββββββββ| 10000/10000 [4:51:23<00:00, 1.75s/it, batch_loss=0.685]
Current learning rates: 4.13e-06 | margin=0.300
Epoch 12 loss statistics - Mean: 0.689, Min: 0.508, Max: 0.865
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:16<00:00, 4.22s/it]
Epoch 12 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 33391.19it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.82it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.220
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37588.98it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.78it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.11it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.200
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.116, R: 0.847, F1: 0.200
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 12 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21717.2s
π Learning Rate: 4.13e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 13/20 ====================
Epoch 13: 100%|ββββββββββ| 10000/10000 [4:51:05<00:00, 1.75s/it, batch_loss=0.684]
Current learning rates: 3.29e-06 | margin=0.300
Epoch 13 loss statistics - Mean: 0.689, Min: 0.528, Max: 0.890
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:57<00:00, 4.20s/it]
Epoch 13 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36711.63it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.63it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 39808.84it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.23it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 13 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21679.7s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 14/20 ====================
Epoch 14: 100%|ββββββββββ| 10000/10000 [4:50:45<00:00, 1.74s/it, batch_loss=0.686]
Current learning rates: 2.50e-06 | margin=0.300
Epoch 14 loss statistics - Mean: 0.689, Min: 0.542, Max: 0.859
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:57<00:00, 4.20s/it]
Epoch 14 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36114.55it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.32it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 38796.23it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.26it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 14 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21660.1s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 15/20 ====================
Epoch 15: 100%|ββββββββββ| 10000/10000 [4:50:47<00:00, 1.74s/it, batch_loss=0.688]
Current learning rates: 1.79e-06 | margin=0.300
Epoch 15 loss statistics - Mean: 0.689, Min: 0.532, Max: 0.869
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:03<00:00, 4.20s/it]
Epoch 15 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37356.49it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.65it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36428.21it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.69it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 15 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21666.9s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 16/20 ====================
Epoch 16: 100%|ββββββββββ| 10000/10000 [4:50:44<00:00, 1.74s/it, batch_loss=0.689]
Current learning rates: 1.17e-06 | margin=0.300
Epoch 16 loss statistics - Mean: 0.689, Min: 0.534, Max: 0.860
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:57<00:00, 4.20s/it]
Epoch 16 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 36393.09it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.83it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 39250.05it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.32it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 16 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21658.9s
π Learning Rate: 1.17e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 17/20 ====================
Epoch 17: 100%|ββββββββββ| 10000/10000 [4:50:45<00:00, 1.74s/it, batch_loss=0.686]
Current learning rates: 1.00e-06 | margin=0.300
Epoch 17 loss statistics - Mean: 0.689, Min: 0.534, Max: 0.849
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:57<00:00, 4.20s/it]
Epoch 17 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37467.73it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.80it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37035.80it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.21it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 17 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21660.2s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 18/20 ====================
Epoch 18: 100%|ββββββββββ| 10000/10000 [4:50:43<00:00, 1.74s/it, batch_loss=0.679]
Current learning rates: 1.00e-06 | margin=0.300
Epoch 18 loss statistics - Mean: 0.689, Min: 0.532, Max: 0.872
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:09:58<00:00, 4.20s/it]
Epoch 18 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 37090.38it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.83it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 34647.76it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.39it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.19it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 18 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21658.0s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 19/20 ====================
Epoch 19: 100%|ββββββββββ| 10000/10000 [4:50:59<00:00, 1.75s/it, batch_loss=0.687]
Current learning rates: 1.00e-06 | margin=0.300
Epoch 19 loss statistics - Mean: 0.689, Min: 0.518, Max: 0.866
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:17<00:00, 4.22s/it]
Epoch 19 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 32640.50it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.64it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 34799.48it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 52.03it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 19 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21693.0s
π Learning Rate: 1.00e-06
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
==================== Epoch 20/20 ====================
Epoch 20: 100%|ββββββββββ| 10000/10000 [4:51:12<00:00, 1.75s/it, batch_loss=0.684]
Current learning rates: 1.00e-06 | margin=0.300
Epoch 20 loss statistics - Mean: 0.689, Min: 0.538, Max: 0.871
Loss not decreasing. Patience: 1/1
Reset learning rate to 5.00e-05
Evaluating after epoch...
π Validation evaluator: Stage 0 (frozen encoder baseline)
π₯ Evaluating with FROZEN ENCODER ONLY (no cross-attention, aggregation=top_k_pairs)
Evaluating frozen encoder baseline: 100%|ββββββββββ| 1000/1000 [1:10:14<00:00, 4.21s/it]
Epoch 20 Accuracy: 0.806
Collecting tables and contexts for test_row_sent_epoch split...
Processing test_row_sent_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 34560.53it/s]
Found 36 unique tables and 39 unique contexts in test_row_sent_epoch split
Using device: cuda for embedding cache
Encoding test_row_sent_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 61.65it/s]
Encoding test_row_sent_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.18it/s]
π Row-sent evaluator: Stage 0 (frozen encoder baseline)
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
Row-Sent Overall Acc: 0.219
Row-Sent Avg Precision: 0.433
Examples evaluated: 36
Collecting tables and contexts for mimic_test_epoch split...
Processing mimic_test_epoch examples: 100%|ββββββββββ| 36/36 [00:00<00:00, 38333.32it/s]
Found 36 unique tables and 39 unique contexts in mimic_test_epoch split
Using device: cuda for embedding cache
Encoding mimic_test_epoch tables: 100%|ββββββββββ| 36/36 [00:00<00:00, 59.05it/s]
Encoding mimic_test_epoch contexts: 100%|ββββββββββ| 39/39 [00:07<00:00, 5.14it/s]
[INFO] MIMIC Row Grounding evaluation: 36 examples
Diagnosis: 18 examples, F1=0.198
Medication: 18 examples, F1=0.240
MIMIC Diagnosis - P: 0.115, R: 0.847, F1: 0.198
MIMIC Medication - P: 0.149, R: 0.840, F1: 0.240
π Epoch 20 Summary:
π₯ Train Loss: 0.69 Β± 0.04
π― Val Accuracy: 0.81
π Best Accuracy: 0.81 (Epoch 10)
β±οΈ Epoch Time: 21702.7s
π Learning Rate: 5.00e-05
π Row-Sent Overall Acc: 0.22
π Best Test Overall Acc: 0.22 (Epoch 1)
π Row-Sent Avg Precision: 0.43
π Best Test Avg Precision: 0.44 (Epoch 1)
Stage 0 note: encoder fine-tuning active; eval uses on-the-fly embeddings (no cache)
Loading best model from epoch 10 with accuracy 0.806
Best model saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/abhinand/MedEmbed-large-v0.1/best_model_epoch_10/model.pt
π― SAVING BEST TEST-BASED MODELS:
Loading best test overall accuracy model from epoch 1 (0.224)
Best test overall accuracy model saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/abhinand/MedEmbed-large-v0.1/best_test_overall_acc_epoch_1/model.pt
Loading best test average precision model from epoch 1 (0.435)
Best test average precision model saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/abhinand/MedEmbed-large-v0.1/best_test_avg_precision_epoch_1/model.pt
Reloaded validation-based best model for final analysis
==========================================================================================
π― COMPREHENSIVE 3-STAGE IMPACT ANALYSIS
==========================================================================================
π COMPLETE PERFORMANCE BREAKDOWN:
π₯ Stage 0 - Frozen Encoder Only: 0.806
π Stage 1 - Sophisticated (Pre): 0.806 (+0.000)
π Stage 2 - Trained Model: 0.806 (+0.000)
π Total Improvement: +0.000 (0.0%)
π TEST METRICS SUMMARY:
π― Best Test Overall Accuracy: 0.224 (Epoch 1)
π― Best Test Average Precision: 0.435 (Epoch 1)
π Validation vs Test Performance:
- Validation Best: 0.806 (Epoch 10)
- Test Overall Acc: 0.224 (Epoch 1)
- Test Avg Precision: 0.435 (Epoch 1)
β οΈ NOTE: Best test overall accuracy occurred at epoch 1, not at best validation epoch 10β
Final summary logged to wandb
π¨ Skipping 3-STAGE example visualizations (skip_four_stage_viz=True)
==========================================================================================
======================================================================
π― TRAINING CURVES SUMMARY
======================================================================
======================================================================
π― TRAINING SUMMARY - abhinand/MedEmbed-large-v0.1
======================================================================
π Total Epochs: 20
π Best Accuracy: 0.81 (Epoch 10)
π Final Accuracy: 0.81
π Accuracy Improvement: -0.00
π₯ Initial Loss: 0.69
π― Final Loss: 0.69
π Loss Reduction: -0.00
β±οΈ Average Epoch Time: 21674.9s
π Total Training Time: 433497.5s (7225.0 min)
π Best Test Metrics:
π Best Overall Accuracy: 0.22 (Epoch 1)
π Best Average Precision: 0.44 (Epoch 1)
π Initial Stage Metrics:
π₯ Stage 0 (Frozen): 0.81 acc, 0.42 row-sent AP
π Stage 1 (Sophisticated Untrained): 0.81 acc, 0.42 row-sent AP
π― Stage 2 (Initial): 0.00 acc, 0.00 row-sent AP
======================================================================
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_final_training_curves.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_final_training_curves.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_training_loss.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_training_loss.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_validation_accuracy.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_validation_accuracy.pdf
π Generating batch-level analysis...
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_heatmap.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_heatmap.pdf
π‘οΈ Batch losses heatmap saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_heatmap.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_1.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_1.pdf
π Batch losses plot for epoch 1 saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_1.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_21.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_21.pdf
π Batch losses plot for epoch 21 saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots/abhinand_MedEmbed-large-v0.1_batch_losses_epoch_21.png
β
Training curves analysis complete!
π All plots saved to: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_plots
πΎ Training data saved to: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/training_data
π TRAINING COMPLETED: Returning trained Encoder Only (No Heads)
β
Training completed! The returned model is the BEST performing model from training.
π Check the training logs above to see which epoch achieved the highest validation accuracy.
Saved best model to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/MedEmbed-large-v0.1_best.pt
Evaluating on Test Set...
Loaded 36 test examples
Cache disabled - evaluation will compute embeddings on-the-fly
Evaluating bidirectional model with join path extraction...
Evaluating examples: 100%|ββββββββββ| 36/36 [00:18<00:00, 1.94it/s]
Saved 36 join path examples to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/extracted_join_paths.json
Test Accuracy: 0.931
Join Paths Extracted: 36
Evaluation results saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/test_metrics.json
π¨ Generating visualizations using the BEST model (highest validation accuracy)...
β
CONFIRMED: Using BEST model checkpoint from training
π Best model path: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/MedEmbed-large-v0.1_best.pt
π§ Using aggregation method: top_k_pairs
β
Best model file confirmed to exist
Running comprehensive visualizations using top_k_pairs...
π Loading trained model from: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/MedEmbed-large-v0.1_best.pt
π Loading TRAINED model from checkpoint: output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/MedEmbed-large-v0.1_best.pt
β
CONFIRMED: Loading BEST model checkpoint (highest validation accuracy)
π Found configuration file: args.json
β
Loaded from config: model_type=Bidirectional, embedding_dim=1024, attention_type=top_k_sparse
Creating dynamic encoder for 1024 dimensions on cuda
π Final embedding dimension: 1024
Creating BidirectionalTableTextModel...
π Using top_k_sparse attention mechanism
π Using top-5 sparse attention
Using top_k_sparse attention mechanism
Initializing Top-K Sparse Attention (k=5)
Initializing top-k sparse attention with method: xavier_uniform
Successfully applied xavier_uniform initialization to top-k sparse attention
Initializing top-k sparse attention with method: xavier_uniform
Successfully applied xavier_uniform initialization to top-k sparse attention
Using cosine pair scoring method
Bidirectional model initialized with top_k=3, pair_score_method=cosine, share_weights=False, use_refinement=True
Using initialization method: xavier_uniform
Sentence encoder is frozen
Sentence encoder dtype detected: torch.float32
Loading trained weights from output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/MedEmbed-large-v0.1_best.pt
β
Trained weights loaded successfully (custom layers only)
π VERIFICATION: Best model weights are now active for visualization
π― Model ready for visualization: BEST TRAINED model on cuda
β
Trained model loaded with dynamic dimension detection on cuda
Processing example 16 (ID: 2221973625275923611):
8 rows, 69 sentences
Using aggregation method: top_k_pairs
Generating comprehensive 4-panel analysis...
π Creating comprehensive analysis for Example 16...
Found 8 rows and 69 sentences
Computing comprehensive similarities...
Computing raw embedding similarities...
Computing bidirectional attention and contextualized similarities...
Applying top_k_sparse attention mechanism...
Computing contextualized similarities...
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.pdf
πΎ Saved comprehensive analysis to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.png
π Analysis Summary for Example 16:
Raw Embeddings - Range: [-0.101, 0.082]
Contextualized Similarities - Range: [-0.071, 0.396]
Final Model Similarities - Range: [-0.091, 0.082]
Cross-Attention - Range: [0.000, 0.200]
π Top 3 pairs by Raw Embeddings:
1. Row 2 - Sentence 57: 0.082
2. Row 6 - Sentence 55: 0.079
3. Row 6 - Sentence 45: 0.074
π Top 3 pairs by Contextualized Similarities:
1. Row 1 - Sentence 3: 0.396
2. Row 3 - Sentence 2: 0.379
3. Row 5 - Sentence 4: 0.377
π Top 3 pairs by Final Model Similarities:
1. Row 4 - Sentence 27: 0.082
2. Row 5 - Sentence 20: 0.082
3. Row 4 - Sentence 10: 0.079
π Top 3 pairs by Cross-Attention:
1. Row 5 - Sentence 2: 0.200
2. Row 5 - Sentence 3: 0.200
3. Row 5 - Sentence 4: 0.200
π Detailed analysis saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/example_16_similarity_analysis.txt
All visualizations saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations
π¬ Creating comprehensive model analysis...
π¬ Creating comprehensive analysis for example 16 using BEST model...
π Creating comprehensive analysis for Example 16...
Found 8 rows and 69 sentences
Computing comprehensive similarities...
Computing raw embedding similarities...
Computing bidirectional attention and contextualized similarities...
Applying top_k_sparse attention mechanism...
Computing contextualized similarities...
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.pdf
πΎ Saved comprehensive analysis to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/comprehensive_analysis_example_16.png
π Analysis Summary for Example 16:
Raw Embeddings - Range: [0.456, 0.725]
Contextualized Similarities - Range: [0.834, 0.949]
Final Model Similarities - Range: [0.456, 0.725]
Cross-Attention - Range: [0.000, 0.200]
π Top 3 pairs by Raw Embeddings:
1. Row 8 - Sentence 25: 0.725
2. Row 6 - Sentence 25: 0.723
3. Row 2 - Sentence 28: 0.717
π Top 3 pairs by Contextualized Similarities:
1. Row 4 - Sentence 38: 0.949
2. Row 1 - Sentence 2: 0.943
3. Row 4 - Sentence 4: 0.943
π Top 3 pairs by Final Model Similarities:
1. Row 8 - Sentence 25: 0.725
2. Row 6 - Sentence 25: 0.723
3. Row 2 - Sentence 28: 0.717
π Top 3 pairs by Cross-Attention:
1. Row 5 - Sentence 2: 0.200
2. Row 5 - Sentence 3: 0.200
3. Row 5 - Sentence 4: 0.200
π Detailed analysis saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/example_16_similarity_analysis.txt
π¬ Generating step-by-step diagnostics for example 16...
π¬ Generating step-by-step diagnostics for example 16...
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step1_raw_similarities.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step1_raw_similarities.pdf
Applying top_k_sparse attention mechanism...
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step2_forward_attention.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step2_forward_attention.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step3_reverse_attention.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step3_reverse_attention.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step4_contextualized_similarities.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step4_contextualized_similarities.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step5_refined_similarities.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step5_refined_similarities.pdf
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step6_final_pair_scores.png
Saved plot to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/step6_final_pair_scores.pdf
Generating validation report...
Validation report saved to output_best_model/bidirectional_MedEmbed-large-v0.1_20260128_011945/visualizations/diagnostics_example_16/validation_report_example_16.txt
π― Skipping 4-STAGE example visualizations (--skip_four_stage_viz is set) |