compute_metrics 시그니처
Trainer 가 eval_steps 마다 compute_metrics(pred) 호출. pred.predictions 가 raw logit/예측; pred.label_ids 가 gold. dict 돌려주면 Trainer 가 로깅 + 추적.
evaluate 라이브러리
HF evaluate 라이브러리가 표준 metric wrap: accuracy, F1, BLEU, ROUGE, METEOR, BERTScore, perplexity, exact_match, 수십 개. 각각 데이터셋처럼 Hub 에서 로드: evaluate.load("accuracy"). metric 객체가 one-shot eval 엔 compute(), streaming aggregation 엔 add_batch() expose.
loss 표면에 매치되는 metric 골라
Accuracy 는 균형 분류용. 불균형 클래스엔 F1. translation/summarization 엔 BLEU/ROUGE 지만 짧은 응답에 human judgment 와 weakly correlate — 의미적 유사도 metric (BERTScore, embedding cosine) 과 페어해 챗 eval.