为生产环境中的自然语言到领域特定代码生成进行SLM微调
SLM Finetuning for Natural Language to Domain Specific Code Generation in Production
AI总结:
本文研究了通过微调小型语言模型提升自然语言到领域代码生成的性能与效率,展示了在生产环境中优于大模型的延迟和成本效益。
摘要:
当今许多应用使用大语言模型进行代码生成,但生产系统对延迟有严格要求,难以满足。小型语言模型资源高效,但可能面临推理能力有限、幻觉或长上下文保留差的问题。微调通过将领域知识直接嵌入模型权重,提高任务特定准确性,减少对运行时上下文的依赖。我们先前实现了一种基于检索增强生成的自然语言到代码生成方法,动态选择少量示例嵌入领域特定语言上下文。在本研究中,我们评估了微调Mistral和其他模型在自然语言代码对数据集上的表现,结果表明微调模型在测试数据集上比大模型表现更优,且可进一步微调以适应客户特定场景而不影响通用性能。负载测试和生产部署确认了延迟和质量的最佳性能。这些发现表明,使用小型语言模型进行任务特定微调为领域特定语言生成提供了高效、快速且经济的替代方案。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。