IC-559Contextual calibration is most effective for prompt classification while temperature scaling is more effective for response classification, but no single post-hoc method fully resolves miscalibration

Hongfu Liu, Hengguan Huang, Xiangming Gu, Hao Wang, Ye Wang

SourceOn Calibration of LLM-based Guard Models for Reliable Content Moderation

Three post-hoc calibration methods (temperature scaling, contextual calibration, batch calibration) are applied to all 9 guard models. Contextual calibration reduces prompt classification ECE for most models (e.g., Llama-Guard2 from 26.8% to 15.3%, Aegis-Guard-D from 22.7% to 12.4%), while temperature scaling reduces response classification ECE (e.g., HarmBench-Mistral from 17.8% to 14.6%, WildGuard from 15.9% to 16.5%). Batch calibration underperforms both. The authors note that contextual calibration struggles with multi-sentence response classification and that no method generalizes across all models and datasets.

Evidence
correlational
Key metric
Llama-Guard2 prompt ECE: 26.8% (orig) → 15.3% (CC); Aegis-Guard-D prompt ECE: 22.7% (orig) → 12.4% (CC); HarmBench-Mistral response ECE: 17.8% (orig) → 14.6% (TS); WildGuard response ECE: 15.9% (orig) → 16.5% (TS)
Caveat
Temperature scaling optimized on XSTest validation set (potentially different distribution from target); contextual calibration uses space token for bias estimation; batch calibration assumes access to full test set; no single method generalizes to all models and datasets
Model
Llama Guard, Llama Guard 2, Llama-Guard 3, Aegis-Guard-Defensive, Mistral 7B / Mistral / Mistral 3 7B / Mistral-0.2-7B / Mistral-v0.1 HarmBench-Mistral, WildGuard
Datasets
XSTest [eval], OpenAI Moderation [eval], SimpleSafetyTests [eval], HarmBench / HarmBench Prompt / HarmBench Response / HarmBench-adv [eval], BeaverTails / BeaverTails Test [eval], SafeRLHF Test [eval]
Methods
Temperature Scaling [primary], Contextual Calibration [primary], Batch Calibration [compared-to], Expected Calibration Error / Integral Calibration Error (ECE) [eval]
Related work
Temperature Scaling [builds-on], Contextual Calibration [builds-on], Batch Calibration [builds-on]
Related findings
IC-556, IC-557, IC-558
Extraction
automatic-extraction