SLM Finetuning for Natural Language to Domain Specific Code Generation in Production
Not on the map. Why?
Abstract (arXiv)
Many applications today use large language models for code generation; however, production systems have strict latency requirements that can be difficult to meet with large models. Small language models with a few billion parameters are resource efficient but may suffer from limited reasoning, hallucinations, or poor retention of longer context. Fine tuning improves task specific accuracy by embedding domain knowledge directly into model weights, reducing reliance on runtime context. We previously implemented a baseline natural language to code generation approach using a retrieval augmented generation pipeline that dynamically selected few shot examples to embed domain specific language context for a large language model. In this study, we evaluate small language models for generating domain specific language from natural language by fine tuning variants of Mistral and other models on a dataset of natural language code pairs. Our results show that the fine-tuned models achieve improved performance and latency on test datasets compared to larger models. We also demonstrate that the trained model can be further fine-tuned for customer specific scenarios without degrading general performance, helping resolve production issues. Load testing followed by production deployment confirmed optimal performance in terms of latency and quality. These findings demonstrate that task specific fine tuning with small language models provides an efficient, faster, and cost-effective alternative to large language models for domain specific language generation.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 21 of its 34 references that are in the map. First posted on arXiv 10 Apr 2026.
Builds on
21 of 34 references.
References · 21
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2024GPT-4o System Cardcited by 4,588
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,512
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,418
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2020It's Not Just Size That Matters: Small Language Models Are Also Few-Shot Learnerscited by 669
- 2023Textbooks Are All You Need II: phi-1.5 technical reportcited by 565
9 more
- 2021Differentially Private Fine-tuning of Language Modelscited by 400
- 2023Beyond Memorization: Violating Privacy Via Inference with Large Language Modelscited by 175
- 2023Calibrated Language Models Must Hallucinatecited by 115
- 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
- 2023Halo: Estimation and Reduction of Hallucinations in Open-Source Weak Large Language Modelscited by 36
- 2025A Survey on Privacy Risks and Protection in Large Language Modelscited by 21
- 2024Enhancing the Reasoning Capabilities of Small Language Models via Solution Guidance Fine-Tuningcited by 11
- 2024A Comparative Study of DSL Code Generation: Fine-Tuning vs. Optimized Retrieval Augmentationcited by 10
- 2024Exploring the Knowledge Mismatch Hypothesis: Hallucination Propensity in Small Models Fine-tuned on Data from Larger Modelscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2023Exploring Parameter-Efficient Fine-Tuning Techniques for Code Generation with Large Language Models
- 2026Exploring different approaches to customize language models for domain-specific text-to-code generation
- 2024Improving the Ability of Pre-trained Language Model by Imparting Large Language Model's Experience ↗
- 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generation
- 2025Building Domain-Specific Small Language Models via Guided Data Generation
- 2026Learn2Zinc: Fine-tuning Small Language Models for Text-to-Model Translation in MiniZinc
- 2023Synthetic Data Generation in Low-Resource Settings via Fine-Tuning of Large Language Models
- 2025Data-efficient LLM Fine-tuning for Code Generation