SimLLM:用于基于SimPy的排队系统模拟的代码LLM微调
SimLLM: Fine-Tuning Code LLMs for SimPy-Based Queueing System Simulation
AI总结:
SimLLM通过微调开源LLM提升SimPy排队系统模拟代码生成能力,提供替代闭源模型的可行方案。
摘要:
Python包SimPy因其灵活性、简洁性和与现代数据分析和优化框架的无缝集成而被广泛用于建模排队系统。近年来,大型语言模型(LLMs)的进步显示了在生成清晰且可执行的代码方面的强大能力,使其成为编写SimPy排队模拟代码的强大且合适的工具。然而,直接使用闭源模型如GPT-4o生成此类代码可能导致高计算成本并引发数据隐私问题。为此,我们对两个开源LLM,即Qwen-Coder-7B和DeepSeek-Coder-6.7B,在经过精心挑选的SimPy排队数据上进行了微调,从而增强了它们在可执行性、输出格式合规性和指令代码一致性方面的代码生成能力。特别地,我们提出了一种多阶段微调框架,包括两个阶段的监督微调(SFT)和一个阶段的直接偏好优化(DPO),逐步增强模型在基于SimPy的排队模拟代码生成方面的能力。广泛的评估显示,微调后的模型在可执行性、输出格式合规性和指令一致性方面均取得了显著改进。这些结果证实了领域特定微调可以有效地将紧凑的开源代码模型转化为可靠的SimPy模拟生成器,为教育、研究和运营决策支持提供了闭源LLMs的实用替代方案。
英文摘要:
The Python package SimPy is widely used for modeling queueing systems due to its flexibility, simplicity, and smooth integration with modern data analysis and optimization frameworks. Recent advances in large language models (LLMs) have shown strong ability in generating clear and executable code, making them powerful and suitable tools for writing SimPy queueing simulation code. However, directly employing closed-source models like GPT-4o to generate such code may lead to high computational costs and raise data privacy concerns. To address this, we fine-tune two open-source LLMs, Qwen-Coder-7B and DeepSeek-Coder-6.7B, on curated SimPy queueing data, which enhances their code-generating performance in executability, output-format compliance, and instruction-code consistency. Particularly, we proposed a multi-stage fine-tuning framework comprising two stages of supervised fine-tuning (SFT) and one stage of direct preference optimization (DPO), progressively enhancing the model's ability in SimPy-based queueing simulation code generation. Extensive evaluations demonstrate that both fine-tuned models achieve substantial improvements in executability, output-format compliance, and instruct consistency. These results confirm that domain-specific fine-tuning can effectively transform compact open-source code models into reliable SimPy simulation generators which provide a practical alternative to closed-source LLMs for education, research, and operational decision support.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。