University of Sussex

File(s) under permanent embargo

Okapi: generalising better by making statistical matches match

We propose Okapi, a simple, efficient, and general method for robust semi-supervised learning based on online statistical matching. Our method uses a nearest-neighbours-based matching procedure to generate cross-domain views for a consistency loss, while eliminating statistical outliers. In order to perform the online matching in a runtime- and memory-efficient way, we draw upon the self-supervised literature and combine a memory bank with a slow-moving momentum encoder. The consistency loss is applied within the feature space, rather than on the predictive distribution, making the method agnostic to both the modality and the task in question. We experiment on the WILDS 2.0 datasets (Sagawa et al., 2022), which significantly expands the range of modalities, applications, and shifts available for studying and benchmarking real-world unsupervised adaptation. Contrary to Sagawa et al., 2022, we show that it is in fact possible to leverage additional unlabelled data to improve upon empirical risk minimisation (ERM) results with the right method. Our method outperforms the baseline methods in terms of out-of-distribution (OOD) generalisation on the iWildCam (a multi-class classification task) and PovertyMap (a regression task) image datasets as well as the CivilComments (a binary classification task) text dataset. Furthermore, from a qualitative perspective, we show the matches obtained from the learned encoder are strongly semantically related. Code for our paper is publicly available at


BayesianGDPR - Bayesian Models and Algorithms for Fairness and Transparency; G2903; European Union; 10.3030/851538


Publication status

  • Published

File Version

  • Accepted version


Advances in Neural Information Processing Systems 35 (NeurIPS 2022)





Event name

36th Conference on Neural Information Processing Systems (NeurIPS2022)

Event location

New Orleans

Event type


Event date

28 November - 09 December 2022



Department affiliated with

  • Informatics Publications

Full text available

  • No

Peer reviewed?

  • Yes


S. Koyejo and S. Mohamed and A. Agarwal and D. Belgrave and K. Cho and A. Oh

Legacy Posted Date


First Compliant Deposit (FCD) Date


Usage metrics

    University of Sussex (Publications)


    No categories selected