{"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/on-the-efficacy-of-sampling-adapters","title":"On the Efficacy of Sampling Adapters","arxiv_id":"2307.03749","date":"2023-07-07","proceeding":null,"authors":["Clara Meister","Tiago Pimentel","Luca Malagutti","Ethan G. Wilcox","Ryan Cotterell"],"abstract":"Sampling is a common strategy for generating text from probabilistic models, yet standard ancestral sampling often results in text that is incoherent or ungrammatical. To alleviate this issue, various modifications to a model's sampling distribution, such as nucleus or top-k sampling, have been introduced and are now ubiquitously used in language generation systems. We propose a unified framework for understanding these techniques, which we term sampling adapters. Sampling adapters often lead to qualitatively better text, which raises the question: From a formal perspective, how are they changing the (sub)word-level distributions of language generation models? And why do these local changes lead to higher-quality text? We argue that the shift they enforce can be viewed as a trade-off between precision and recall: while the model loses its ability to produce certain strings, its precision rate on desirable text increases. While this trade-off is not reflected in standard metrics of distribution quality (such as perplexity), we find that several precision-emphasizing measures indeed indicate that sampling adapters can lead to probability distributions more aligned with the true distribution. Further, these measures correlate with higher sequence-level quality scores, specifically, Mauve.","url_abs":"https://arxiv.org/abs/2307.03749v2","url_pdf":"https://arxiv.org/pdf/2307.03749v2.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":"on-the-efficacy-of-sampling-adapters","repo_url":"https://github.com/rycolab/sampling-adapters","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.03749","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.03749"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rycolab/sampling-adapters","reach":{"status":"ok"}}],"summary":{"ran":6},"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":"25466aac44e0d840","entry":"clean_text","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/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":"25466aac44e0d840"}},{"code_sha256_prefix":"13bce9552d1cbfb4","entry":"entropy","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"13bce9552d1cbfb4"}},{"code_sha256_prefix":"ea8ae4d33a3cc0df","entry":"get_mauve_scores_from_files","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/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":"ea8ae4d33a3cc0df"}},{"code_sha256_prefix":"8ff0286d671749bc","entry":"jensen_shannon","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8ff0286d671749bc"}},{"code_sha256_prefix":"1f59deb3086dd8e5","entry":"load_gpt2_dataset","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"utils.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/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":"1f59deb3086dd8e5"}},{"code_sha256_prefix":"a4bc26865f74a4c5","entry":"tvd","repo":"rycolab/sampling-adapters","repo_kind":"official","path":"metrics.py","file_url":"https://github.com/rycolab/sampling-adapters/blob/HEAD/metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a4bc26865f74a4c5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}