Large language models for G-code generation in CNC machining: A comparison of ChatGPT-3.5 and ChatGPT-4o - Šket, Kristijan (Advances in production engineering and management, 2025)
This research explores the viability of producing ISO G-code for 3-axis machining with OpenAI's Chat Generative Pre-Trained Transformer models, particularly ChatGPT-3.5 and the newer GPT-4o. G-code (RS-274-D, ISO 6983) converts human directives into commands that machines can understand, controlling toolpaths, spindle velocities, and feed rates to produce particular aspects of an object. Previously, G-code was generated either by hand or through the use of computer-aided manufacturing (CAM) software along with machine-specific post-processors, both of which may require considerable time and expense. This research aimed to assess the practicality and effectiveness of specific large language models (LLMs) in generating G-code. The assessment took place in three distinct phases on a sample component that required 3-axis machining. These phases included: (1) the self-generated production of G-code for the sample component, (2) the examination of the independently generated G-code in the CAM application, and (3) the recognition and justification of mistakes in the G-code. The outcomes indicated varying abilities with promising findings. This method could accelerate and possibly enhance manufacturing workflows by decreasing reliance on expensive CAM software and specialized knowledge.
Keywords: ChatGPT; CNC machining; CNC obdelava; G-code programming; generative artificial intelligence; generativna umetna inteligenca; intelligent manufacturing; large language models (LLM); pametna proizvodnja; programiranje z G-kodo; veliki jezikovni modeli