An Efficient Plugin Method for Metric Optimization of Black-Box Models
Siddartha Devic, Nurendra Choudhary, Anirudh Srinivasan, Sahika Genc, Branislav Kveton, Gaurush Hiranandani
TL;DR
This work tackles post-hoc adaptation of black-box multiclass predictors under distribution shift by learning class weights to reweight predictions. The CWPlugin method uses coordinate-wise line searches over restricted pairwise classifiers to produce a weight vector $\mathbf{w}\in[0,1]^m$ and forms $b_{\mathbf{w}}(x)=\arg\max_k b(x)_k\mathbf{w}_k$, optimizing metrics that are functions of the confusion matrix, including linear-diagonal metrics. The authors prove consistency for linear-diagonal metrics and provide finite-sample guarantees, with runtime speedups achievable via quasi-concavity and parallelization. Empirically, CWPlugin improves metric performance on tabular income data and various NLP tasks, particularly when the labeled target set is small, and remains competitive with or surpasses calibration and probing baselines before full model retraining. Overall, CWPlugin offers a scalable, strictly post-hoc approach to aligning black-box predictions with target distributions and bespoke evaluation metrics across diverse domains.
Abstract
Many machine learning algorithms and classifiers are available only via API queries as a ``black-box'' -- that is, the downstream user has no ability to change, re-train, or fine-tune the model on a particular target distribution. Indeed, the downstream user may not even have knowledge of the \emph{original} training distribution or performance metric used to construct and optimize the black-box model. We propose a simple and efficient method, Plugin, which \emph{post-processes} arbitrary multiclass predictions from any black-box classifier in order to simultaneously (1) adapt these predictions to a target distribution; and (2) optimize a particular metric of the confusion matrix. Importantly, Plugin is a completely \textit{post-hoc} method which does not rely on feature information, only requires a small amount of probabilistic predictions along with their corresponding true label, and optimizes metrics by querying. We empirically demonstrate that Plugin is both broadly applicable and has performance competitive with related methods on a variety of tabular and language tasks.
