Text2DSL: LLM-Based Code Generation for Domain-Specific Languages
- URL: http://arxiv.org/abs/2606.22586v1
- Date: Sun, 21 Jun 2026 16:44:20 GMT
- Title: Text2DSL: LLM-Based Code Generation for Domain-Specific Languages
- Abstract summary: This paper formalises the task of automatic DSL code generation from natural language descriptions - Text2.<n>We introduce the PolkitBench dataset comprising 4,204 verified natural-language-to-Polkit-rule pairs.
- Score: 78.29352305480285
- License: http://creativecommons.org/licenses/by-nc-nd/4.0/
- Abstract: 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.
Related papers
- Context-Aware Distillation and Ablation for Text2DSL [78.29352305480285]
We replace prompt-only synthetic generation with context-aware distillation.<n>A teacher large language model operates under an explicitly defined structured context.<n>This scales the verified PolkitBench corpus from 4,204 to 10,073 pairs.
arXiv Detail & Related papers (2026-06-21T16:27:24Z) - From Text to DSL: Evaluating Grammar-Based Model Generation Using Open LLMs [2.5576448583538514]
Large Language Models (LLMs) have shown increasing potential in automating model-driven software engineering tasks.<n>We evaluate whether open-source LLMs of varying sizes can generate DSL-conformant models using only few-shot prompting.
arXiv Detail & Related papers (2026-05-15T11:33:48Z) - Leveraging LLMs for Multi-File DSL Code Generation: An Industrial Case Study [39.936784974007644]
Large language models (LLMs) perform strongly on general-purpose code generation, yet their applicability to enterprise domain-specific languages (s) remains underexplored.<n>We report an industrial case study at BMW that adapts code-oriented LLMs to generate and modify project-root DSL artifacts for an Xtext-based DSL.<n>We encode as structured, path-response generation at repository scale and learning cross-file dependencies.
arXiv Detail & Related papers (2026-04-27T16:38:01Z) - Bilingual Text-to-Motion Generation: A New Benchmark and Baselines [52.71312720094036]
We introduce BiHumanML3D, the first bilingual text-to-motion benchmark, constructed via LLM-assisted annotation and rigorous manual correction.<n>We also propose a simple yet effective baseline, Bilingual Motion Diffusion synthesis (BiMD), featuring Cross-Lingual Alignment (CLA)<n>BiMD with CLA achieves an FID of 0.045 vs. 0.169 and R@3 of 82.8% vs. 80.8%, significantly outperforms monolingual diffusion models and translation baselines on BiHumanML3D.
arXiv Detail & Related papers (2026-03-26T08:48:27Z) - Anka: A Domain-Specific Language for Reliable LLM Code Generation [0.0]
Large Language Models (LLMs) exhibit systematic errors on complex, multi-step programming tasks.<n>We introduce Anka, a domain-specific language () for data transformation pipelines designed with explicit, constrained syntax.<n>Anka achieves 99.9% parse success and 95.8% overall task accuracy across 100 benchmark problems.
arXiv Detail & Related papers (2025-12-29T05:28:17Z) - InstructLR: A Scalable Approach to Create Instruction Dataset for Under-Resourced Languages [5.046479786355341]
In this paper, we introduce InstructLR, a novel framework designed to generate high-quality instruction datasets for low-resource languages (LRLs)<n>Our approach integrates LLM-driven text generation with a dual-layer quality filtering mechanism.<n>InstructLR has facilitated the creation of three multi-domain instruction benchmarks: ZarmaInstruct-50k, BambaraInstruct-50k, and FulfuldeInstruct-50k.
arXiv Detail & Related papers (2025-12-01T21:25:33Z) - IFEvalCode: Controlled Code Generation [69.28317223249358]
The paper introduces forward and backward constraints generation to improve the instruction-following capabilities of Code LLMs.<n>The authors present IFEvalCode, a multilingual benchmark comprising 1.6K test samples across seven programming languages.
arXiv Detail & Related papers (2025-07-30T08:08:48Z) - Type-Constrained Code Generation with Language Models [51.03439021895432]
We introduce a type-constrained decoding approach that leverages type systems to guide code generation.<n>For this purpose, we develop novel prefix automata and a search over inhabitable types, forming a sound approach to enforce well-typedness on LLM-generated code.<n>Our approach reduces compilation errors by more than half and significantly increases functional correctness in code synthesis, translation, and repair tasks.
arXiv Detail & Related papers (2025-04-12T15:03:00Z) - Guiding Large Language Models to Generate Computer-Parsable Content [0.6798775532273751]
We propose a method to guide Large Language Models (LLMs) in generating structured content adhering to specific conventions without fine-tuning.
This enhances stability and consistency in generating target data structures, types, or instructions, reducing application development complexities.
arXiv Detail & Related papers (2024-04-08T13:22:24Z) - PolyLM: An Open Source Polyglot Large Language Model [57.64420154135178]
We present PolyLM, a multilingual large language model (LLMs) trained on 640 billion (B) tokens, avaliable in two model sizes: 1.7B and 13B.
To enhance its multilingual capabilities, we 1) integrate bilingual data into training data; and 2) adopt a curriculum learning strategy that increases the proportion of non-English data from 30% in the first stage to 60% in the final stage during pre-training.
Further, we propose a multilingual self-instruct method which automatically generates 132.7K diverse multilingual instructions for model fine-tuning.
arXiv Detail & Related papers (2023-07-12T09:00:37Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.