This paper introduces GLLM, an innovative tool that leverages Large Language Models (LLMs) to automatically generate G-code from natural language instructions for Computer Numerical Control (CNC) machining. GLLM addresses the challenges of manual G-code writing by bridging the gap between human-readable task descriptions and machine-executable code. The system incorporates a fine-tuned StarCoder-3B model, enhanced with domain-specific training data and a Retrieval-Augmented Generation (RAG) mechanism. GLLM employs advanced prompting strategies and a novel self-corrective code generation approach to ensure both syntactic and semantic correctness of the generated G-code. The architecture includes robust validation mechanisms, including syntax checks, G-code-specific verifications, and functional correctness evaluations using Hausdorff distance. By combining these techniques, GLLM aims to democratize CNC programming, making it more accessible to users without extensive programming experience while maintaining high accuracy and reliability in G-code generation.
翻译:本文介绍了一种创新工具GLLM,该工具利用大型语言模型(LLMs)从自然语言指令自动生成计算机数控(CNC)加工所需的G代码。GLLM通过弥合人类可读任务描述与机器可执行代码之间的鸿沟,解决了手动编写G代码的难题。该系统整合了经过微调的StarCoder-3B模型,并通过领域特定训练数据和检索增强生成(RAG)机制进行增强。GLLM采用先进的提示策略和一种新颖的自校正代码生成方法,确保生成G代码的语法与语义正确性。其架构包含鲁棒的验证机制,包括语法检查、G代码专项验证以及基于豪斯多夫距离的功能正确性评估。通过结合这些技术,GLLM致力于推动CNC编程的普及化,使不具备丰富编程经验的用户也能便捷使用,同时在G代码生成过程中保持高精度与可靠性。