{"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/sketch-guided-constrained-decoding-for","title":"Sketch-Guided Constrained Decoding for Boosting Blackbox Large Language Models without Logit Access","arxiv_id":"2401.09967","date":"2024-01-18","proceeding":null,"authors":["Saibo Geng","Berkay Döner","Chris Wendler","Martin Josifoski","Robert West"],"abstract":"Constrained decoding, a technique for enforcing constraints on language model outputs, offers a way to control text generation without retraining or architectural modifications. Its application is, however, typically restricted to models that give users access to next-token distributions (usually via softmax logits), which poses a limitation with blackbox large language models (LLMs). This paper introduces sketch-guided constrained decoding (SGCD), a novel approach to constrained decoding for blackbox LLMs, which operates without access to the logits of the blackbox LLM. SGCD utilizes a locally hosted auxiliary model to refine the output of an unconstrained blackbox LLM, effectively treating this initial output as a \"sketch\" for further elaboration. This approach is complementary to traditional logit-based techniques and enables the application of constrained decoding in settings where full model transparency is unavailable. We demonstrate the efficacy of SGCD through experiments in closed information extraction and constituency parsing, showing how it enhances the utility and flexibility of blackbox LLMs for complex NLP tasks.","url_abs":"https://arxiv.org/abs/2401.09967v4","url_pdf":"https://arxiv.org/pdf/2401.09967v4.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":"sketch-guided-constrained-decoding-for","repo_url":"https://github.com/epfl-dlab/sketchgcd","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"constituency-parsing","task_name":"Constituency Parsing"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2401.09967","atlas_url":"https://app.syntology.ai/?focus=2401.09967","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.09967"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/epfl-dlab/sketchgcd","reach":null}],"summary":{"ran_draft_wrong":1,"ran_honours":1,"unverified":5},"by_repo_kind":{"official":{"samples":7,"ran":2,"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":7,"samples":[{"code_sha256_prefix":"97f53de2469e4a78","entry":"discard_last_incomplete_triplet","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"97f53de2469e4a78"}},{"code_sha256_prefix":"af1e43bd7b90239e","entry":"encode","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"af1e43bd7b90239e"}},{"code_sha256_prefix":"1737c26d0c0b8473","entry":"FullyExpandedLinearization","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","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":"1737c26d0c0b8473"}},{"code_sha256_prefix":"313fe6298b464995","entry":"LinearizationType","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","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":"313fe6298b464995"}},{"code_sha256_prefix":"632dd34355f1c573","entry":"SubjectCollapsedLinearization","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","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":"632dd34355f1c573"}},{"code_sha256_prefix":"c8f57072a4b89c0e","entry":"_get_prefix_allowed_tokens_fn","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","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":"c8f57072a4b89c0e"}},{"code_sha256_prefix":"9c568eb7a994df48","entry":"get_linearization_class","repo":"epfl-dlab/sketchgcd","repo_kind":"official","path":"src/constrained_generation/trie_constraint.py","file_url":"https://github.com/epfl-dlab/sketchgcd/blob/HEAD/src/constrained_generation/trie_constraint.py","link_basis":"first_harvest_node","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":"9c568eb7a994df48"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}