TruncProof: A Guardrail for LLM-based JSON Generation under Token-Length Constraints
- lab Hugging Face
- lab arXiv
- lab arXivLabs
- location UTC
- model LLM
- person Yoshio Kato
- product Hugging Face
- product JSON
A new method called TruncProof forces large language models to produce grammatically valid JSON outputs that stay within a predefined token limit, solving a problem that causes truncated or infinite generations in existing systems [1]. The technique, detailed in a paper by Yoshio Kato, addresses a gap in current grammar-constrained generation approaches, which cannot strictly enforce a maximum number of tokens [1]. Without such a guardrail, LLMs generating machine-readable formats like JSON can produce truncated outputs that trigger system malfunctions [1]. TruncProof works by leveraging the properties of LL(1) parsers to efficiently approximate the minimum number of tokens required to complete a grammatically valid output at each decoding step [1]. Experiments on Text-to-JSON instruction tasks showed the method successfully generates syntactically correct outputs even under strict token constraints [1]. The paper also demonstrates that TruncProof can be combined with advanced decoding strategies to produce outputs that are not only grammatically valid but also semantically accurate [1]. The source code is publicly available on GitHub [2]. The release comes as the broader field of LLM-based code and structured-output generation grapples with evaluation standards. A recent scoping review of thirteen generative systems for quantum circuit and code generation found that while all reviewed systems addressed syntax and most addressed semantics, none reported end-to-end evaluation on quantum hardware, leaving a gap between generated artifacts and practical deployment [3]. LLMs are machine learning models with many parameters, trained with self-supervised learning on vast amounts of text for tasks such as language generation [8]. Their integration with external systems has driven demand for reliable structured outputs. Platforms like Hugging Face have built infrastructure to connect research papers with executable demos, including an integration with arXiv that embeds Spaces demos directly alongside paper abstract pages [5]. The Hub also supports paper pages that link to models, datasets, and community discussions [4]. Major LLM developers have pursued different strategies for model access. DeepSeek, a Chinese AI company founded in July 2023, makes its models available under free and open-source software licenses, primarily the MIT License [7]. Alibaba Cloud's Qwen family of models is distributed under a mix of Apache 2.0, source-available, and proprietary licenses [9].
research-paper
Background sources we checked (8)
- arxiv.org ↗ 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 trunca…
- arxiv.org ↗ We review thirteen generative systems and five supporting datasets for quantum circuit and quantum code generation, identified through a structured scoping review of Hugging Face, arXiv, and provenance tracing (January-February 2026). We organize the field along two axes: artifac…
- huggingface.co ↗ # Paper Pages Paper pages allow people to find artifacts related to a paper such as models, datasets and apps/demos (Spaces). Paper pages also enable the community to discuss about the paper. ## Linking a Paper to a model, dataset or Space If the repository card (`README.md`) …
- huggingface.co ↗ # How to Add a Space to ArXiv ... Demos on Hugging Face Spaces allow a wide audience to try out state-of-the-art machine learning research without writing any code. Hugging Face and ArXiv have collaborated to embed these demos directly along side papers on ArXiv! ... Thanks to th…
- huggingface.co ↗ Daily Papers - Hugging Face new Get trending papers in your email inbox once a day! Get trending papers in your email inbox! Subscribe # Daily Papers ## byAK and the research community - Daily - Weekly - Monthly Trending Papers https://huggingface.co/papers/date/2026-06-…
- en.wikipedia.org ↗ Hangzhou DeepSeek Artificial Intelligence Basic Technology Research Co., Ltd., doing business as DeepSeek, is a Chinese artificial intelligence (AI) company that develops large language models (LLMs). Based in Hangzhou, Zhejiang, DeepSeek is owned and funded by High-Flyer, a Chin…
- en.wikipedia.org ↗ A large language model (LLM) is a type of machine learning model designed for natural language processing tasks such as language generation. LLMs are language models with many parameters, and are trained with self-supervised learning on a vast amount of text.…
- en.wikipedia.org ↗ Qwen (also known as Tongyi Qianwen, Chinese: 通义千问; pinyin: Tōngyì Qiānwèn) is a family of large language models developed by Alibaba Cloud. Many Qwen models are distributed under the free and open-source Apache 2.0 license, the source-available Qwen License, or the non-commercial…