{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/otter-improving-zero-shot-classification-via","title":"OTTER: Effortless Label Distribution Adaptation of Zero-shot Models","arxiv_id":"2404.08461","date":"2024-04-12","proceeding":null,"authors":["Changho Shin","Jitian Zhao","Sonia Cromp","Harit Vishwakarma","Frederic Sala"],"abstract":"Popular zero-shot models suffer due to artifacts inherited from pretraining. One particularly detrimental issue, caused by unbalanced web-scale pretraining data, is mismatched label distribution. Existing approaches that seek to repair the label distribution are not suitable in zero-shot settings, as they have mismatching requirements, such as needing access to labeled downstream task data or knowledge of the true label balance in the pretraining distribution. We sidestep these challenges and introduce a simple and lightweight approach to adjust pretrained model predictions via optimal transport. Our technique requires only an estimate of the label distribution of a downstream task. Theoretically, we characterize the improvement produced by our procedure under certain mild conditions and provide bounds on the error caused by misspecification. Empirically, we validate our method in a wide array of zero-shot image and text classification tasks, improving accuracy by 4.8% and 15.9% on average, and beating baselines like prior matching -- often by significant margins -- in 17 out of 21 datasets.","url_abs":"https://arxiv.org/abs/2404.08461v2","url_pdf":"https://arxiv.org/pdf/2404.08461v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"otter-improving-zero-shot-classification-via","repo_url":"https://github.com/sprocketlab/otter","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"zero-shot-learning","task_name":"Zero-Shot Learning"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.08461","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.08461"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/SprocketLab/OTTER","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sprocketlab/otter","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":1,"ran_honours":3,"ran":2},"by_repo_kind":{"official":{"samples":6,"ran":6,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":6,"samples":[{"code_sha256_prefix":"1cfa2c1ff434c8e4","entry":"get_dirichlet_marginal","repo":"SprocketLab/OTTER","repo_kind":"official","path":"src/label_shift_utils.py","file_url":"https://github.com/SprocketLab/OTTER/blob/HEAD/src/label_shift_utils.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1cfa2c1ff434c8e4"}},{"code_sha256_prefix":"906d7af106469e1c","entry":"get_pred_proba","repo":"sprocketlab/otter","repo_kind":"official","path":"src/inference.py","file_url":"https://github.com/sprocketlab/otter/blob/HEAD/src/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"906d7af106469e1c"}},{"code_sha256_prefix":"cc97ef5fea3909c0","entry":"get_uniformly_resampled_indices","repo":"SprocketLab/OTTER","repo_kind":"official","path":"src/label_shift_utils.py","file_url":"https://github.com/SprocketLab/OTTER/blob/HEAD/src/label_shift_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cc97ef5fea3909c0"}},{"code_sha256_prefix":"9a9b5fe4892aeffb","entry":"get_uniformly_resampled_indices_split","repo":"SprocketLab/OTTER","repo_kind":"official","path":"src/label_shift_utils.py","file_url":"https://github.com/SprocketLab/OTTER/blob/HEAD/src/label_shift_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9a9b5fe4892aeffb"}},{"code_sha256_prefix":"4392943c8aa127bf","entry":"nlh_cost_matrix","repo":"sprocketlab/otter","repo_kind":"official","path":"src/inference.py","file_url":"https://github.com/sprocketlab/otter/blob/HEAD/src/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4392943c8aa127bf"}},{"code_sha256_prefix":"9edefb19aec9bef9","entry":"zs_predict","repo":"sprocketlab/otter","repo_kind":"official","path":"src/inference.py","file_url":"https://github.com/sprocketlab/otter/blob/HEAD/src/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9edefb19aec9bef9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}