u7122029 / text_gen_calibration

0 stars 0 forks source link

FrequencyTS Abalation Study #4

Closed u7122029 closed 2 months ago

u7122029 commented 3 months ago

Includes testing the FrequencyTS variants on other datasets.

u7122029 commented 2 months ago

So far it seems that the mean only version of the model seems to be performing the best.

u7122029 commented 2 months ago
|------------------|------------------------------------|
| Split            | Calibration                        |
| LLM              | microsoft/Phi-3-mini-128k-instruct |
| Prompt Version   | DEFAULT                            |
| Input Formatter  | GSMCoT                             |
| Loss Function    | CALIB_AWARE                        |
| ece_logits       | 0.15578128397464752                |
| ece_verbalised   | 0.22621174156665802                |
| brier_logits     | 0.20584067702293396                |
| brier_verbalised | 0.22959531843662262                |
| auroc_logits     | 0.6745377779006958                 |
| auroc_verbalised | 0.5864825248718262                 |
| auprc_logits     | 0.8284844756126404                 |
| auprc_verbalised | 0.7854215502738953                 |

D:\git_d\text_gen_calibration\.venv\Lib\site-packages\torch\storage.py:414: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  return torch.load(io.BytesIO(b))
                  Calibrator  ece_calib  brier_calib  auroc_calib  auprc_calib
0  LastHiddenStateCalibrator   0.189656     0.168193     0.958026     0.982502
1         TemperatureScaling   0.136373     0.199047     0.678914     0.831768
2                FrequencyTS   0.135528     0.198880     0.677972     0.830972
3            FrequencyScaler   0.137950     0.199537     0.678995     0.831898
4          FrequencyTSNoMean   0.135302     0.198671     0.680966     0.832219
5           FrequencyTSNoRFR   0.134987     0.198670     0.679519     0.832254
6           FrequencyTSNoStd   0.134022     0.198169     0.680685     0.833420

|------------------|------------------------------------|
| Split            | Test                               |
| LLM              | microsoft/Phi-3-mini-128k-instruct |
| Prompt Version   | DEFAULT                            |
| Input Formatter  | GSMCoT                             |
| Loss Function    | CALIB_AWARE                        |
| ece_logits       | 0.2165231555700302                 |
| ece_verbalised   | 0.2743990123271942                 |
| brier_logits     | 0.2538386285305023                 |
| brier_verbalised | 0.2754667401313782                 |
| auroc_logits     | 0.7039114236831665                 |
| auroc_verbalised | 0.5927540063858032                 |
| auprc_logits     | 0.8092725276947021                 |
| auprc_verbalised | 0.7309845685958862                 |

                  Calibrator  ece_calib  brier_calib  auroc_calib  auprc_calib
0  LastHiddenStateCalibrator   0.249472     0.236201     0.851395     0.914893
1         TemperatureScaling   0.197681     0.243937     0.706982     0.811924
2                FrequencyTS   0.196864     0.243713     0.705830     0.810939
3            FrequencyScaler   0.199280     0.244630     0.707660     0.812422
4          FrequencyTSNoMean   0.196596     0.243452     0.708517     0.812351
5           FrequencyTSNoRFR   0.196178     0.243403     0.704649     0.809657
6           FrequencyTSNoStd   0.193812     0.242725     0.709284     0.814416

The best frequency-based model is eluding me. For some models, there are some variants that perform better. The best course of action would probably be to propose all of the methods and suggest that they should all be tried to see which one performs best.

u7122029 commented 2 months ago
|------------------|----------------------|
| Split            | Calibration          |
| LLM              | google/gemma-2-2b-it |
| Prompt Version   | DEFAULT              |
| Input Formatter  | GSMCoT               |
| Loss Function    | CALIB_AWARE          |
| ece_logits       | 0.5382483005523682   |
| ece_verbalised   | 0.3518233299255371   |
| brier_logits     | 0.5128852128982544   |
| brier_verbalised | 0.37362125515937805  |
| auroc_logits     | 0.7491283416748047   |
| auroc_verbalised | 0.5002670288085938   |
| auprc_logits     | 0.6541314125061035   |
| auprc_verbalised | 0.3858625292778015   |

D:\git_d\text_gen_calibration\.venv\Lib\site-packages\torch\storage.py:414: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  return torch.load(io.BytesIO(b))
                  Calibrator  ece_calib  brier_calib  auroc_calib  auprc_calib
0  LastHiddenStateCalibrator   0.217939     0.203720     0.853089     0.821463
1         TemperatureScaling   0.068890     0.193849     0.769588     0.692037
2                FrequencyTS   0.064972     0.193712     0.769405     0.691937
3            FrequencyScaler   0.066107     0.196979     0.757364     0.679391
4          FrequencyTSNoMean   0.064972     0.193712     0.769405     0.691937
5           FrequencyTSNoRFR   0.066682     0.194218     0.765310     0.691827
6           FrequencyTSNoStd   0.072959     0.193370     0.770220     0.693753

|------------------|----------------------|
| Split            | Test                 |
| LLM              | google/gemma-2-2b-it |
| Prompt Version   | DEFAULT              |
| Input Formatter  | GSMCoT               |
| Loss Function    | CALIB_AWARE          |
| ece_logits       | 0.5230602025985718   |
| ece_verbalised   | 0.3747606575489044   |
| brier_logits     | 0.4976734220981598   |
| brier_verbalised | 0.39396512508392334  |
| auroc_logits     | 0.7550089359283447   |
| auroc_verbalised | 0.4478442966938019   |
| auprc_logits     | 0.66771399974823     |
| auprc_verbalised | 0.3814283013343811   |

                  Calibrator  ece_calib  brier_calib  auroc_calib  auprc_calib
0  LastHiddenStateCalibrator   0.247514     0.247554     0.808747     0.745559
1         TemperatureScaling   0.090757     0.195741     0.776186     0.706548
2                FrequencyTS   0.089305     0.195384     0.776663     0.706524
3            FrequencyScaler   0.086074     0.199056     0.760635     0.692546
4          FrequencyTSNoMean   0.089305     0.195384     0.776663     0.706524
5           FrequencyTSNoRFR   0.090161     0.194927     0.775283     0.705871
6           FrequencyTSNoStd   0.091927     0.195556     0.775894     0.707451
u7122029 commented 2 months ago

There is no frequency/occurrence-based method that consistently performs the best. We will hence propose all methods equally, suggesting that all types should be tried.