Fine-tune notebook fits temperatures outside the runtime clamp, so the served calibration differs from the fitted one
What happens
notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb → fit_one_temp() returns
torch.clamp(log_t.exp(), 0.1, 10.0), but at load time Agent passes every temperature through
clamp_temperature() (added in #42) with TEMP_MIN=0.5, TEMP_MAX=5.0 (laya/common.py). Any fitted value in
[0.1, 0.5) or (5, 10] is silently replaced when the checkpoint is served.
Repro (real run, laya 0.3.20)
RLCD fine-tune of multilingual on a binary grounding task (single noul question, 13.7k items, 2 epochs, 2xT4).
fit_one_temp returned 9.886 for noul; exported rl_agent_config.json stores 9.886; the served agent uses 5.0.
A second, independent run (VitaminC, 28.5k items, 2 epochs) fitted raw 7.10 → served 5.0 — reproduced.
So the temperature the notebook fits (and any calibration measured with it) is not what the shipped checkpoint uses.
Suggested fix (either)
- Make
fit_one_tempclamp tolaya.common.TEMP_MIN/TEMP_MAX(one line, keeps fit == serve), or - warn at load when
temperature_raw != clamp_temperature(temperature_raw)so the change isn't silent.
Happy to open a PR for (1) + a test next to tests/test_calibration_persistence.py.
Source: NandhaKishorM/laya