Text2DSL: LLM-Based Code Generation for Domain-Specific Languages
Not on the map. Why?
Abstract (arXiv)
Domain-specific languages (DSLs) are widely used for managing operating system security policies, yet manually authoring rules in such languages demands high expertise and is error-prone. This paper formalises the task of automatic DSL code generation from natural language descriptions - Text2DSL - as a distinct problem class, separate from Text-to-SQL and general-purpose code generation. We introduce the PolkitBench dataset comprising 4,204 verified natural-language-to-Polkit-rule pairs, each validated through a three-level AST-based pipeline. Controlled prompt experiments on two MoE models of different scale and provenance - GigaChat-10B-A1.8B (1.8B active parameters) and Nemotron-3-Nano-30B-A3B (3B active) - demonstrate the critical role of structured context (BNF grammar, API specification, permitted identifier vocabulary) for LLM-based DSL code generation. Across both models, supplying context raises syntactic validity to 98.6-99.4%, structural validity by +9.7 to +35.5 pp, and the CodeBLEU score by +60% to +95%. The consistency of the effect across models of different scale and provenance indicates that, for the Text2DSL class of problems, injecting a formal target-language specification into the prompt context is a robust enabling factor for high-quality generation without model fine-tuning.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 16 of its 29 references that are in the map. First posted on arXiv 21 Jun 2026.
Builds on
16 of 29 references.
References · 16
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2023StarCoder: may the source be with you!cited by 799
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 687
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 477
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
4 more
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
- 2023RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLcited by 195
- 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
- 2021Jigsaw: Large Language Models meet Program Synthesiscited by 103
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Context-Aware Distillation and Ablation for Text2DSL
- 2024A Comparative Study of DSL Code Generation: Fine-Tuning vs. Optimized Retrieval Augmentation
- 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanisms
- 2025Exploring Code Language Models for Automated HLS-based Hardware Generation: Benchmark, Infrastructure and Analysis
- 2024Assessing, Exploiting, and Mitigating Syntactic Robustness Failures in LLM-Based Code Generation
- 2025Smoke and Mirrors: Jailbreaking LLM-based Code Generation via Implicit Malicious Prompts
- 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generation
- 2026LLM4RTL: Tool-Assisted LLM for RTL Generation