{"paper":{"title":"TruncProof: A Guardrail for LLM-based JSON Generation under Token-Length Constraints","license":"http://arxiv.org/licenses/nonexclusive-distrib/1.0/","headline":"TruncProof uses an LL(1) parser to approximate the fewest tokens still needed for a valid JSON at every decoding step, letting the model finish inside a hard token budget.","cross_cats":["cs.FL","cs.SE"],"primary_cat":"cs.CL","authors_text":"Shuhei Tarashima, Yoshio Kato","submitted_at":"2026-05-13T06:49:08Z","abstract_excerpt":"The LLM-based generation of machine-readable outputs such as JSON has attracted significant attention for integration with external systems. However, existing approaches cannot strictly enforce the maximum number of tokens to be generated, leading to infinite generation or truncated outputs that cause a system malfunction. To address this limitation, we propose TruncProof, a novel grammar-constrained generation method that enables LLMs to produce grammatically valid JSONs while adhering to a predefined token limit. By leveraging the properties of LL(1) parsers, TruncProof efficiently approxima"},"claims":{"count":4,"items":[{"kind":"strongest_claim","text":"TruncProof successfully generates syntactically correct outputs even under strict token constraints.","source":"verdict.strongest_claim","status":"machine_extracted","claim_id":"C1","attestation":"unclaimed"},{"kind":"weakest_assumption","text":"That the LL(1) parser approximation of minimum completion tokens remains accurate enough across varied JSON structures and does not cause premature termination or invalid outputs when the grammar is complex.","source":"verdict.weakest_assumption","status":"machine_extracted","claim_id":"C2","attestation":"unclaimed"},{"kind":"one_line_summary","text":"TruncProof lets LLMs generate syntactically valid JSON within strict token limits by approximating completion token counts via LL(1) parser lookahead.","source":"verdict.one_line_summary","status":"machine_extracted","claim_id":"C3","attestation":"unclaimed"},{"kind":"headline","text":"TruncProof uses an LL(1) parser to approximate the fewest tokens still needed for a valid JSON at every decoding step, letting the model finish inside a hard token budget.","source":"verdict.pith_extraction.headline","status":"machine_extracted","claim_id":"C4","attestation":"unclaimed"}],"snapshot_sha256":"3f821131802b67ec8468a42e99d9bccc32ca6a306d41f4735235eacb03cf6db7"},"source":{"id":"2605.13076","kind":"arxiv","version":1},"verdict":{"id":"b0cdc912-b690-4319-b38f-ae1abb1d259f","model_set":{"reader":"grok-4.3"},"created_at":"2026-05-14T19:42:56.875782Z","strongest_claim":"TruncProof successfully generates syntactically correct outputs even under strict token constraints.","one_line_summary":"TruncProof lets LLMs generate syntactically valid JSON within strict token limits by approximating completion token counts via LL(1) parser lookahead.","pipeline_version":"pith-pipeline@v0.9.0","weakest_assumption":"That the LL(1) parser approximation of minimum completion tokens remains accurate enough across varied JSON structures and does not cause premature termination or invalid outputs when the grammar is complex.","pith_extraction_headline":"TruncProof uses an LL(1) parser to approximate the fewest tokens still needed for a valid JSON at every decoding step, letting the model finish inside a hard token budget."},"references":{"count":32,"sample":[{"doi":"","year":2024,"title":"MathCoder: Seamless Code Integration in LLMs for Enhanced Mathematical Reasoning,","work_id":"e1fd2666-7f52-4663-ad1c-6f2b396ca6e2","ref_index":1,"cited_arxiv_id":"","is_internal_anchor":false},{"doi":"","year":2023,"title":"Visual Programming: Compositional Visual Reasoning Without Training,","work_id":"c0f1ef14-9018-4b33-9857-8cc846fea0db","ref_index":2,"cited_arxiv_id":"","is_internal_anchor":false},{"doi":"","year":2025,"title":"OpenAI, “Structured model outputs,” https://platform.openai.com/docs/guides/structured-outputs/json-mode (accessed December 2025)","work_id":"488b2043-a3df-4b0b-b59f-9963392eac5f","ref_index":3,"cited_arxiv_id":"","is_internal_anchor":false},{"doi":"","year":2025,"title":"Increase output consistency (JSON mode),","work_id":"8edecd9d-a0f0-46e0-af38-b87af06b61b7","ref_index":4,"cited_arxiv_id":"","is_internal_anchor":false},{"doi":"","year":2025,"title":"Google, “Structured Outputs,” https://ai.google.dev/gemini- api/docs/structured-output (accessed December 2025)","work_id":"77eefaa8-9370-4f46-8a46-033a5e3dabe0","ref_index":5,"cited_arxiv_id":"","is_internal_anchor":false}],"resolved_work":32,"snapshot_sha256":"a36816cd9668abb893bc112cf073a84c1fb41eff25e91ff0161b57b59bdfeb7a","internal_anchors":2},"formal_canon":{"evidence_count":0,"snapshot_sha256":"258153158e38e3291e3d48162225fcdb2d5a3ed65a07baac614ab91432fd4f57"},"author_claims":{"count":0,"strong_count":0,"snapshot_sha256":"258153158e38e3291e3d48162225fcdb2d5a3ed65a07baac614ab91432fd4f57"},"builder_version":"pith-number-builder-2026-05-17-v1"}