Submitted:
13 June 2026
Posted:
15 June 2026
You are already at the latest version
Abstract
Keywords:
1. Introduction
- Assess the potential of SLM architectures for DSL tasks.
- Propose a DSL classification that determines adaptation requirements.
- Analyze the effectiveness of SLM adaptation methods (PEFT, distillation, GCD, RAG).
- Assess limitations of current benchmarks.
- Systematize promising research directions in the field.
2. Language Models for Code Generation: From LLMs to SLMs
2.1. Evolution of Code Language Models
- Code Llama [2], a family of 7-34B models based on Llama 2 and additionally trained on code.
- DeepSeek-Coder [3], models from 1.3B to 33B parameters trained on 2 trillion code tokens using fill-in-the-middle (FIM).
- Qwen2.5-Coder [4], a model family whose 1.5B version outperforms Code Llama-7B on HumanEval.
2.2. Architectures of Modern SLMs for Code Generation
2.3. Training Data: DSL Coverage
2.4. Standard Benchmarks and Their Limitations for DSLs
- HumanEval [1], 164 Python tasks with functional tests; metric: pass@k.
- MBPP (Mostly Basic Python Problems) [25], 974 Python tasks for basic programming skills.
- MultiPL-E [26], a HumanEval extension to 18 programming languages.
- DS-1000 [27], 1000 data-science tasks focused on library use.
- CodeBLEU [28], a metric that accounts for syntactic and semantic code similarity.
3. DSL Classification from the Perspective of Language Modeling
3.1. Definition and Basic DSL Classifications
- External DSLs have their own syntax and parser (HCL, Rego, iptables rules).
- Internal/embedded DSLs are implemented on top of a host language (Kotlin DSL for Gradle, Ruby DSL for Chef).
- Declarative DSLs describe a desired state (Kubernetes YAML, Terraform HCL).
- Imperative / rule-based DSLs contain logic, conditions, and decision rules (OPA/Rego, iptables).
- Configuration DSLs define system parameters (YAML configurations, INI files, .env).
- Formally verifiable DSLs have a strict grammar and/or validation schema (Kubernetes YAML -> OpenAPI schema, Terraform -> HCL parser).
- Partially verifiable DSLs allow syntax checking, but semantic correctness depends on the runtime environment (OPA/Rego).
- Free-form DSLs lack a strict formal specification (Markdown, arbitrary YAML).
3.2. Proposed C1 / C2 / C3 Classification
3.2.1. Class C1 - Regular DSLs
- Limited vocabulary of allowed keys and atomic values.
- No or minimal inter-object references.
- Deterministic validation: correctness checking reduces to matching a regular expression or a simple schema.
- Context-model size is minimal (tens of rules).
3.2.2. Class C2 - Context-Free DSLs
- Hierarchical structure (nested objects, lists, blocks).
- Inter-object references (resource names, labels, selectors).
- Value typing (integers, strings, enums, references).
- Validation requires AST construction and schema checking.
- Context-model size is medium (hundreds of rules, dozens of object types).
3.2.3. Class C3 - Context-Sensitive DSLs
- Recursive and aggregating constructs.
- Semantic dependencies resolved only in a runtime environment (references to external data, query results).
- Logical expressions with variable substitution.
- Validation requires not only parsing but also interpretation/evaluation.
- Context-model size is significant (hundreds of rules, semantics + examples + runtime dependencies).
3.3. Summary of DSL Classes
| Characteristic | C1 (Regular) | C2 (Context-free) | C3 (Context-sensitive) |
|---|---|---|---|
| Grammar | Regular | Context-free | Context-sensitive |
| Nesting | Fixed (0-2) | Arbitrary | Arbitrary + recursion |
| Links | None | References, selectors | Semantic + runtime environment |
| Validation | Regex / schema | AST + schema | Parser + interpreter |
| Adaptation method | Few-shot prompting | QLoRA + GCD | Full fine-tuning |
| Expected quality (≤ 3B, expert estimate) | High | Medium / high with validation | Unstable, semantics-dependent |
| Typical examples | .env, INI | Kubernetes, Terraform, Docker Compose | OPA/Rego, SQL, Dhall |
3.4. Impact of DSL Class on Adaptation Strategy
- C1 DSLs often require only few-shot prompting or GCD over a formal grammar. Fine-tuning is often excessive.
- C2 DSLs are well suited to a combination of QLoRA + domain context model + GCD as a syntactic-control mechanism.
- C3 DSLs require full fine-tuning or QLoRA on a large corpus + semantic verification.
4. Methods for Adapting SLMs to Domain-Specific Tasks
4.1. Parameter-Efficient Fine-Tuning (PEFT)
4.2. Knowledge Distillation for Code Models
4.3. Grammar-Constrained Decoding (GCD) and Structured Decoding
- C1. GCD usually solves syntactic correctness. A C1 DSL’s regular grammar is easy to express in GBNF or Outlines.
- C2. GCD ensures syntactic but not always semantic correctness. For example, Kubernetes YAML that passes grammar checking may contain invalid references to nonexistent objects.
- C3. GCD is of limited use because context-sensitive properties, such as referential integrity and type constraints, cannot be expressed by a context-free grammar.
4.4. Retrieval-Augmented Generation (RAG) for Code
4.5. Prompting and In-Context Learning
4.6. Hybrid Approaches
4.7. Summary of Adaptation Methods
5. Verification and Evaluation of DSL Artifact Generation
5.1. Metrics for Evaluating Code Generation
- pass@k [1], the probability that at least one of k generated variants passes all tests. This is the de facto standard for evaluating code models.
- Test-case success rate, the share of test cases passed by generated code.
- BLEU [49], which estimates n-gram overlap between generated and reference text. BLEU is often inadequate for code because it ignores syntactic structure.
- CodeBLEU [28], an extension of BLEU that accounts for AST structure and data flow.
- CrystalBLEU [50], a modification that reduces the influence of frequently occurring tokens.
- Manual expert evaluation, the most accurate but slow and expensive method.
- LLM-as-a-judge, using large models such as GPT-4 to evaluate the output quality of a student model.
5.2. Formal Verifiability as an Advantage of DSLs
5.3. Existing Benchmarks and Their Limitations
| Benchmark | Languages | Tasks | Metric | DSL |
|---|---|---|---|---|
| HumanEval [1] | Python | 164 | pass@k | No |
| MBPP [25] | Python | 974 | pass@k | No |
| MultiPL-E [26] | 18 GPLs | ~3000 | pass@k | No |
| DS-1000 [27] | Python + libraries | 1000 | pass@k | No |
| APPS [52] | Python | 10K | pass@k | No |
| ClassEval [53] | Python (OOP) | 100 classes | pass@k | No |
| Spider [54] | SQL | 10K | execution accuracy | Limited |
6. Security and Knowledge Management in Domain SLMs
6.1. Threat Model
6.2. Protection Methods
6.3. Machine Unlearning and Epistemic Isolation
- Gradient-based unlearning, applying gradient ascent to the subset of data that should be forgotten.
- Prompt-based unlearning, modifying system prompts and fine-tuning on instructions not to generate certain patterns.
7. Priority Directions for Future Research
8. Conclusion
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Chen M., Tworek J., Jun H. et al. Evaluating Large Language Models Trained on Code // arXiv: 2107.03374. 2021. [CrossRef]
- Roziere B., Gehring J., Gloeckle F. et al. Code Llama: Open Foundation Models for Code // arXiv: 2308.12950. 2023. [CrossRef]
- Guo D., Zhu Q., Yang D. et al. DeepSeek-Coder: When the Large Language Model Meets Programming - The Rise of Code Intelligence // arXiv: 2401.14196. 2024. [CrossRef]
- Hui B., Yang J., Cui Z. et al. Qwen2.5-Coder Technical Report // arXiv: 2409.12186. 2024. [CrossRef]
- Gunasekar S., Zhang Y., Anber J. et al. Textbooks Are All You Need // arXiv: 2306.11644. 2023. [CrossRef]
- Xu T., Jin Y. Systems Approaches to Tackling Configuration Errors: A Survey // ACM Computing Surveys. 2015. Vol. 48, no. 4. P. 1-33. [CrossRef]
- Google Cloud Security. Threat Horizons Report H2 2024. Google Cloud, 2024. URL: https://services.google.com/fh/files/misc/threat_horizons_report_h2_2024.pdf.
- Accelerate State of DevOps Report 2024 / DORA Team. Google Cloud, 2024.
- Cloud-Native Computing Foundation Annual Survey / CNCF. 2024.
- Raychev V., Bielik P., Vechev M. Probabilistic Model for Code with Decision Trees // Proc. OOPSLA. 2016. P. 1-25. [CrossRef]
- Vaswani A., Shazeer N., Parmar N. et al. Attention Is All You Need // Proc. NeurIPS. 2017. P. 5998-6008.
- Brown T.B., Mann B., Ryder N. et al. Language Models are Few-Shot Learners // Proc. NeurIPS. 2020. P. 1877-1901.
- Arutyunov G.A., Avdoshin S.M. Large transformers for code generation // Proceedings of ISP RAS. 2022. Vol. 34, issue 4. P. 79-88. [CrossRef]
- Li Y., Choi D., Chung J. et al. Competition-Level Code Generation with AlphaCode // Science. 2022. Vol. 378, no. 6624. P. 1092-1097. [CrossRef]
- Nijkamp E., Pang B., Hayashi H. et al. CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis // Proc. ICLR. 2023.
- Li R., Allal L.B., Zi Y. et al. StarCoder: May the Source Be With You! // Transactions on Machine Learning Research (TMLR). 2023.
- Lozhkov A., Li R., Allal L.B. et al. StarCoder 2 and The Stack v2: The Next Generation // arXiv: 2402.19173. 2024. [CrossRef]
- Lomshakov V.M., Nikolenko S.I. Applications of large language models to generation and processing of program code // Notes of Scientific Seminars of POMI. 2024. Vol. 540. P. 276-350.
- Abdin M., Jacobs S.A., Awan A.A. et al. Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone // arXiv: 2404.14219. 2024. [CrossRef]
- Zhu Q., Guo D., Shao Z. et al. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence // arXiv: 2406.11931. 2024. [CrossRef]
- CodeGemma: Open Code Models Based on Gemma / Google DeepMind. Technical Report. 2024.
- Wang Y., Le H., Gotmare A.D. et al. CodeT5+: Open Code Large Language Models for Code Understanding and Generation // Proc. EMNLP. 2023. P. 1069-1088.
- Liu N.F., Lin K., Hewitt J. et al. Lost in the Middle: How Language Models Use Long Contexts // Trans. ACL. 2024. Vol. 12. P. 157-173.
- Zmitrovich D., Abramov A., Kalmykov A. et al. A Family of Pretrained Transformer Language Models for Russian // Proc. LREC-COLING. 2024. P. 507-524.
- Austin J., Odena A., Nye M. et al. Program Synthesis with Large Language Models // arXiv: 2108.07732. 2021. [CrossRef]
- Cassano F., Gouwar J., Nguyen D. et al. MultiPL-E: A Scalable and Polyglot Approach to Benchmarking Neural Code Generation // IEEE Trans. Software Engineering. 2023. Vol. 49, no. 7. P. 3675-3691.
- Lai Y., Li C., Wang Y. et al. DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation // Proc. ICML. 2023. P. 18319-18345.
- Ren S., Guo D., Lu S. et al. CodeBLEU: A Method for Automatic Evaluation of Code Synthesis // arXiv: 2009.10297. 2020. [CrossRef]
- Mernik M., Heering J., Sloane A.M. When and How to Develop Domain-Specific Languages // ACM Computing Surveys. 2005. Vol. 37, no. 4. P. 316-344. [CrossRef]
- Fowler M. Domain-Specific Languages. Addison-Wesley, 2010. 640 p.
- Koznov D.V. Methodology and tools for domain-specific modeling: doctoral dissertation. St. Petersburg, 2016. 315 p.
- Terekhov A.N., Bryksin T.A., Litvinov Yu.V. QReal: a platform for visual domain-specific modeling // Software Engineering. 2013. No. 6. P. 11-19.
- Hu E.J., Shen Y., Wallis P. et al. LoRA: Low-Rank Adaptation of Large Language Models // Proc. ICLR. 2022.
- Dettmers T., Pagnoni A., Holtzman A. et al. QLoRA: Efficient Finetuning of Quantized Language Models // Proc. NeurIPS. 2023.
- Abodo Elundu B., Quanyu W. Extended text classification using DistilBERT with low-rank LoRA adaptation: a comparative study // Proceedings of ISP RAS. 2025. Vol. 37, issue 3. P. 159-170.
- Houlsby N., Giampiccolo A., Morber S. et al. Parameter-Efficient Transfer Learning for NLP // Proc. ICML. 2019. P. 2790-2799.
- Li X.L., Liang P. Prefix-Tuning: Optimizing Continuous Prompts for Generation // Proc. ACL-IJCNLP. 2021. P. 4582-4597.
- Lester B., Al-Rfou R., Constant N. The Power of Scale for Parameter-Efficient Prompt Tuning // Proc. EMNLP. 2021. P. 3045-3059.
- Hinton G., Vinyals O., Dean J. Distilling the Knowledge in a Neural Network // Proc. NIPS Deep Learning and Representation Learning Workshop. 2015.
- Luo Z., Xu C., Zhao P. et al. WizardCoder: Empowering Code Large Language Models with Evol-Instruct // Proc. ICLR. 2024.
- Wei Y., Wang Z., Liu J. et al. Magicoder: Source Code Is All You Need // Proc. ICML. 2024.
- Willard B.T., Louf R. Efficient Guided Generation for Large Language Models // arXiv: 2307.09702. 2023. [CrossRef]
- Beurer-Kellner L., Fischer M., Vechev M. Prompting Is Programming: A Query Language for Large Language Models // Proc. PLDI. 2023. P. 1946-1969. [CrossRef]
- Park M. et al. CRANE: Reasoning-Augmented Constrained Decoding // arXiv preprint. 2025.
- Geng S., Josifoski M., Peyrard M. et al. Grammar-Constrained Decoding for Structured NLP Tasks Using LLMs // Proc. ACL. 2024.
- Lewis P., Perez E., Piktus A. et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks // Proc. NeurIPS. 2020. P. 9459-9474.
- Zhang F., Chen B., Zhang Y. et al. RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation // Proc. EMNLP. 2023.
- Sprague Z., Yin F., Rodriguez J.D. et al. To CoT or Not to CoT? Chain-of-Thought Helps Mainly on Math and Symbolic Reasoning // arXiv: 2409.12183. 2024. [CrossRef]
- Papineni K., Roukos S., Ward T. et al. BLEU: A Method for Automatic Evaluation of Machine Translation // Proc. ACL. 2002. P. 311-318.
- Eghbali A., Pradel M. CrystalBLEU: Precisely and Efficiently Measuring the Similarity of Code // Proc. ASE. 2022. P. 1-12.
- Kulyamin V.V. Methods of software verification // Proceedings of ISP RAS. 2008. Vol. 14, issue 1. P. 121-144.
- Hendrycks D., Basart S., Kadavath S. et al. Measuring Coding Challenge Competence with APPS // Proc. NeurIPS Datasets and Benchmarks. 2021.
- Du X., Liu M., Wang K. et al. ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-Level Code Generation // arXiv: 2308.01861. 2023. [CrossRef]
- Yu T., Zhang R., Yang K. et al. Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task // Proc. EMNLP. 2018. P. 3911-3921.
- Carlini N., Tramer F., Wallace E. et al. Extracting Training Data from Large Language Models // Proc. USENIX Security Symposium. 2021. P. 2633-2650.
- Carlini N., Ippolito D., Jagielski M. et al. Quantifying Memorization Across Neural Language Models // Proc. ICLR. 2023.
- Bespalova N.V. Cloud technology security // Computational Nanotechnology. 2024. Vol. 11, no. 5. P. 124-132.
- Ivannikov V.P., Belevantsev A.A., Borodin A.E. et al. Svace static analyzer for detecting defects in source code // Proceedings of ISP RAS. 2014. Vol. 26, issue 1. P. 231-250. [CrossRef]
- Shaikhelislamov D.S., Varetsa M.S., Semkin A.S., Rogov O.Yu. Tuning a language model for secure code generation // Proceedings of ISP RAS. 2025. Vol. 37, issue 5. P. 111-122.
- Jang J., Yoon D., Yang S. et al. Knowledge Unlearning for Mitigating Language Models’ Memorization // arXiv: 2210.01504. 2023. [CrossRef]




| Indicator | LLMs (cloud, via API) | SLMs (≤ 7B, local) | Practical effect |
|---|---|---|---|
| Cost of 10,000 generations | Tens to hundreds of USD | A few USD or less | Lower operating cost |
| Required resources | Server GPUs / external API | Consumer GPU or quantization | Availability at the edge |
| Generation latency | Seconds, API-dependent | Fractions of a second to seconds, model- and quantization-dependent | Predictability |
| Data privacy | Data are sent to the provider | Data remain inside the local perimeter | Critical for CII |
| Offline operation | Usually impossible | Possible | Autonomy |
| Model | Parameters | Architecture | Context | Corpus / training | HumanEval pass@1 |
|---|---|---|---|---|---|
| CodeGen2.5 [15] | 7B | Decoder-only | 2K | StarCoderData + Python fine-tuning | 33.4% (monolingual) |
| StarCoder 2 [17] | 3B / 7B | Decoder-only | 16K | The Stack v2 | 31.7% / 35.4% |
| Code Llama [2] | 7B | Decoder-only | 16K | Llama 2 + code fine-tuning | 33.5% |
| DeepSeek-Coder [3] | 1.3B / 6.7B | Decoder-only | 16K | 2T tokens | 34.8% / 49.4% |
| Qwen2.5-Coder [4] | 1.5B / 7B | Decoder-only | 128K | 5.5T code tokens | 43.8% / 61.6% |
| Phi-3-mini [19] | 3.8B | Decoder-only | 128K | curated and synthetic data | 60.4% (instruction-tuned) |
| DeepSeek-Coder-V2-Lite [20] | 16B (2.4B)* | MoE | 128K | +6T continued pretraining tokens | depends on model variant |
| CodeGemma [21] | 2B / 7B | Decoder-only | 8K | +500B tokens, mostly code | 31.1% / 44.5% |
| CodeT5+ [22] | 0.2-16B | Encoder-decoder | 2K | CodeSearchNet+ | not reported |
| Language / format | Type | Coverage estimate | Comment |
|---|---|---|---|
| Python | GPL | High | One of the core languages of code corpora and benchmarks |
| JavaScript | GPL | High | A widely used web and infrastructure scripting language |
| Java | GPL | High | Broadly represented in public repositories |
| YAML / JSON | Mix | High | Common configuration and data formats |
| HCL (Terraform) | DSL | Low | Much narrower than GPLs and mass formats |
| Rego (OPA) | DSL | Very low | A niche language for security policies |
| iptables rules | DSL | Very low | Often stored as configuration fragments rather than full projects |
| Method | Type | Data | Guarantees | Resources | C1 | C2 | C3 |
|---|---|---|---|---|---|---|---|
| Full fine-tuning | Parametric | 10K+ | None | 40-80 GB | ++ | ++ | ++ |
| LoRA / QLoRA | PEFT | 1K-5K | None | 8-24 GB | ++ | ++ | + |
| Adapter modules | PEFT | 1K-5K | None | 8-16 GB | ++ | + | + |
| Prefix / prompt | PEFT | 0.5K-2K | None | 4-8 GB | + | +/- | - |
| GCD | Decoding | Grammar | Syntax | Low | ++ | + | +/- |
| Distillation | Data | Teacher | None | API / GPU | ++ | ++ | + |
| RAG | Context | Corpus | None | Vector DB | + | + | +/- |
| Few-shot prompting | Context | 3-10 | None | None | ++ | +/- | - |
| Hybrid | Combined | 1K-5K | Syntax + schema | 8-24 GB | ++ | ++ | + |
| DSL | Validator | Check | Time |
|---|---|---|---|
| Kubernetes | kubeval, kubectl | Syntax + schema | < 100 ms |
| Terraform | terraform, tflint | Syntax + semantics | < 500 ms |
| OPA/Rego | opa check | Syntax + semantics | < 200 ms |
| GitHub | actionlint | Syntax + schema | < 100 ms |
| iptables | iptables-restore | Syntax + rule processing | < 50 ms |
| Direction | Problem description (relevance) | Proposed research direction | Target classes | Related methods |
|---|---|---|---|---|
| 1. Domain formalization | There is no mathematical model of DSL knowledge representation. Specifications are informal (prompts and documentation). | Develop a formal ontology CM = <META, GRAMMAR, API, PATTERNS> with an algebra of context narrowing/expansion operations. | C1, C2, C3 | All methods |
| 2. Comparative benchmarking | DSLs lack standardized measurement tools; HumanEval and MBPP target algorithmic Python/C++. | Develop an open DSL-Bench with multi-level evaluation (syntax, schema, semantics, security parameters). | All classes | All methods |
| 3. Verified data | Existing LLM-teacher synthesis methods allow erroneous messages and incorrect structures, contaminating student-model training sets. | Use formal DSL validators as automatic syntax and schema filters; introduce self-training loops. | C1, C2, C3 | Distillation, self-training |
| 4. GCD and QLoRA integration | The effect of strict grammar constraints during decoding on final quality for complex DSLs is not studied. | Empirically study “QLoRA + GBNF” synergy and balance algorithmic constraints with semantic flexibility [44]. | C2, C3 | PEFT, GCD |
| 5. Cross-language transfer | It is unknown whether fine-tuned LoRA adapters can be reused across grammatically related languages (K8s -> Terraform). | Analyze cross-DSL transfer and define structural-similarity metrics for weight transfer. | C1 <-> C2, C2 <-> C2 | PEFT, context-model transfer |
| 6. Security perimeter | Infrastructure is highly vulnerable to hidden defects and prompt injection when a model learns unsafe generation patterns. | Build automated red-teaming tools based on tfsec / Checkov; formalize machine unlearning. | C2, C3 | Adversarial training, unlearning |
| 7. Adaptation-effectiveness evaluation | Lightweight methods such as LoRA and prefix tuning have not been objectively compared on hierarchical DSL tasks. | Conduct a large-scale comparative study of final metrics by DSL class and parameter count. | C2, C3 | PEFT, full fine-tuning |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).