DocCGen: Document-based Controlled Code Generation
Not on the map. Why?
Abstract (arXiv)
Recent developments show that Large Language Models (LLMs) produce state-of-the-art performance on natural language (NL) to code generation for resource-rich general-purpose languages like C++, Java, and Python. However, their practical usage for structured domain-specific languages (DSLs) such as YAML, JSON is limited due to domain-specific schema, grammar, and customizations generally unseen by LLMs during pre-training. Efforts have been made to mitigate this challenge via in-context learning through relevant examples or by fine-tuning. However, it suffers from problems, such as limited DSL samples and prompt sensitivity but enterprises maintain good documentation of the DSLs. Therefore, we propose DocCGen, a framework that can leverage such rich knowledge by breaking the NL-to-Code generation task for structured code languages into a two-step process. First, it detects the correct libraries using the library documentation that best matches the NL query. Then, it utilizes schema rules extracted from the documentation of these libraries to constrain the decoding. We evaluate our framework for two complex structured languages, Ansible YAML and Bash command, consisting of two settings: Out-of-domain (OOD) and In-domain (ID). Our extensive experiments show that DocCGen consistently improves different-sized language models across all six evaluation metrics, reducing syntactic and semantic errors in structured code. We plan to open-source the datasets and code to motivate research in constrained code generation.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 10 of its 22 references that are in the map. First posted on arXiv 17 Jun 2024.
Builds on
10 of 22 references.
References · 10
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2021ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interactioncited by 476
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2021Retrieval Augmented Code Generation and Summarizationcited by 149
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2018NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating Systemcited by 98
- 2022When Language Model Meets Private Librarycited by 54
- 2023Benchmarking and Improving Text-to-SQL Generation under Ambiguitycited by 34
Built on by
Citing papers per year: 2024: 2; 2025: 4; 2026: 5.
11 papers.
- 2024A Survey on LLM-based Code Generation for Low-Resource and Domain-Specific Programming Languagescited by 66
- 2025A Mixture of Linear Corrections Generates Secure Codecited by 4
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injectioncited by 2
- 2024ConCodeEval: Evaluating Large Language Models for Code Constraints in Domain-Specific Languagescited by 1
- 2025Prompt engineering and framework: implementation to increase code reliability based guideline for LLMscited by 1
- 2026ReproAgent: Contract-Guided Paper-to-Code Reproductioncited by 1
- 2025Natural Language Interaction with Databases on Edge Devices in the Internet of Battlefield Thingscited by 0
- 2026CangjieBench: Benchmarking LLMs on a Low-Resource General-Purpose Programming Languagecited by 0
- 2026SmartHomeSecure: Automated Detection and Repair of Smart Home Configuration Errors Using Large Language Modelscited by 0
- 2026PHITSBench: an execution-scored benchmark for AI-assisted PHITS radiation-transport input generation using natural languagecited by 0
- 2026Beyond Tokens: A Survey on Decoding Methods for Large Language and Vision-Language Modelscited by 0
- 2026ReproAgent: Contract-Guided Paper-to-Code Reproduction25 Aug 2026
- 2026Beyond Tokens: A Survey on Decoding Methods for Large Language and Vision-Language Models14 Aug 2026
- 2026PHITSBench: an execution-scored benchmark for AI-assisted PHITS radiation-transport input generation using natural language8 Jul 2026
- 2026SmartHomeSecure: Automated Detection and Repair of Smart Home Configuration Errors Using Large Language Models7 Jul 2026
- 2026CangjieBench: Benchmarking LLMs on a Low-Resource General-Purpose Programming Language15 Mar 2026
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injection16 Dec 2025
- 2025A Mixture of Linear Corrections Generates Secure Code13 Jul 2025
- 2025Natural Language Interaction with Databases on Edge Devices in the Internet of Battlefield Things5 Jun 2025
- 2025Prompt engineering and framework: implementation to increase code reliability based guideline for LLMs19 Mar 2025
- 2024A Survey on LLM-based Code Generation for Low-Resource and Domain-Specific Programming Languages4 Oct 2024
- 2024ConCodeEval: Evaluating Large Language Models for Code Constraints in Domain-Specific Languages3 Jul 2024