{"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/decoding-game-on-minimax-optimality-of","title":"Decoding Game: On Minimax Optimality of Heuristic Text Generation Strategies","arxiv_id":"2410.03968","date":"2024-10-04","proceeding":null,"authors":["Sijin Chen","Omar Hagrass","Jason M. Klusowski"],"abstract":"Decoding strategies play a pivotal role in text generation for modern language models, yet a puzzling gap divides theory and practice. Surprisingly, strategies that should intuitively be optimal, such as Maximum a Posteriori (MAP), often perform poorly in practice. Meanwhile, popular heuristic approaches like Top-$k$ and Nucleus sampling, which employ truncation and normalization of the conditional next-token probabilities, have achieved great empirical success but lack theoretical justifications. In this paper, we propose Decoding Game, a comprehensive theoretical framework which reimagines text generation as a two-player zero-sum game between Strategist, who seeks to produce text credible in the true distribution, and Nature, who distorts the true distribution adversarially. After discussing the decomposibility of multi-step generation, we derive the optimal strategy in closed form for one-step Decoding Game. It is shown that the adversarial Nature imposes an implicit regularization on likelihood maximization, and truncation-normalization methods are first-order approximations to the optimal strategy under this regularization. Additionally, by generalizing the objective and parameters of Decoding Game, near-optimal strategies encompass diverse methods such as greedy search, temperature scaling, and hybrids thereof. Numerical experiments are conducted to complement our theoretical analysis.","url_abs":"https://arxiv.org/abs/2410.03968v3","url_pdf":"https://arxiv.org/pdf/2410.03968v3.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":[],"tasks":[{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.03968","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.03968"}},"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/omar-hagrass/decoding-game","reach":{"status":"ok"}}],"summary":{"ran":13,"unverified":1},"by_repo_kind":{"found_in_text":{"samples":14,"ran":13,"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":14,"samples":[{"code_sha256_prefix":"0d835437222e1e6d","entry":"calc_banned_bad_words_ids","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/transformers_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/transformers_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":"0d835437222e1e6d"}},{"code_sha256_prefix":"0cd7c4bac19d0a72","entry":"calc_banned_ngram_tokens","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/transformers_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/transformers_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":"0cd7c4bac19d0a72"}},{"code_sha256_prefix":"b09e82915aef7777","entry":"get_default_batch_size","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/generation_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/generation_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":"b09e82915aef7777"}},{"code_sha256_prefix":"97257a99af745347","entry":"get_device_from_arg","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/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":"97257a99af745347"}},{"code_sha256_prefix":"45247d3017cb5356","entry":"get_save_filename_from_args","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/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":"45247d3017cb5356"}},{"code_sha256_prefix":"1ec3ed89ec1e6fe0","entry":"get_tokenwise_log_probs_seq","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/model_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/model_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":"1ec3ed89ec1e6fe0"}},{"code_sha256_prefix":"8a290c9c72f2e73a","entry":"js_score_1_naive","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/metrics.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/metrics.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":"8a290c9c72f2e73a"}},{"code_sha256_prefix":"13bc3a2c1b6935e2","entry":"kl","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/metrics.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/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":"13bc3a2c1b6935e2"}},{"code_sha256_prefix":"608dc997f8339999","entry":"my_top_k_top_p_filtering","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/model_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/model_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":"608dc997f8339999"}},{"code_sha256_prefix":"1ae24b697c22fe66","entry":"postprocess_next_token_scores","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/transformers_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/transformers_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":"1ae24b697c22fe66"}},{"code_sha256_prefix":"4c1e687ffecb3ee8","entry":"reshape_logit_scores","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/model_utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/model_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":"4c1e687ffecb3ee8"}},{"code_sha256_prefix":"67a0f936fc116fcb","entry":"sp_score_1","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/metrics.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/metrics.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":"67a0f936fc116fcb"}},{"code_sha256_prefix":"7a47a92a0aa77a70","entry":"split_dataset","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/utils.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/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":"7a47a92a0aa77a70"}},{"code_sha256_prefix":"58f653b7d38067cb","entry":"cluster_feats","repo":"omar-hagrass/decoding-game","repo_kind":"found_in_text","path":"src/mauve_metrics.py","file_url":"https://github.com/omar-hagrass/decoding-game/blob/HEAD/src/mauve_metrics.py","link_basis":"plan_row","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"58f653b7d38067cb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}