[Paper Review] Towards Foundational AI Models for Additive Manufacturing: Language Models for G-Code Debugging, Manipulation, and Comprehension
This paper evaluates six state-of-the-art foundational large language models (LLMs) for understanding, debugging, and manipulating G-code in additive manufacturing. It demonstrates that GPT-4 and Claude-2 outperform open-source models like Llama-2-70b and Starcoder in G-code comprehension, geometric transformation, and error detection, though all models struggle with full-file context and complex 3D geometry due to limited context windows and training data bias.
3D printing or additive manufacturing is a revolutionary technology that enables the creation of physical objects from digital models. However, the quality and accuracy of 3D printing depend on the correctness and efficiency of the G-code, a low-level numerical control programming language that instructs 3D printers how to move and extrude material. Debugging G-code is a challenging task that requires a syntactic and semantic understanding of the G-code format and the geometry of the part to be printed. In this paper, we present the first extensive evaluation of six state-of-the-art foundational large language models (LLMs) for comprehending and debugging G-code files for 3D printing. We design effective prompts to enable pre-trained LLMs to understand and manipulate G-code and test their performance on various aspects of G-code debugging and manipulation, including detection and correction of common errors and the ability to perform geometric transformations. We analyze their strengths and weaknesses for understanding complete G-code files. We also discuss the implications and limitations of using LLMs for G-code comprehension.
Motivation & Objective
- To assess the ability of foundational LLMs to comprehend, debug, and manipulate G-code for 3D printing.
- To identify the strengths and limitations of current LLMs in handling low-level numerical control code.
- To evaluate how context length, architecture, and training data affect LLM performance on G-code tasks.
- To explore the feasibility of using LLMs as general-purpose tools for G-code reasoning and transformation.
- To provide a foundation for future research in AI-driven additive manufacturing workflows.
Proposed method
- Design and apply structured prompts to enable LLMs to interpret and modify G-code files.
- Test models on tasks including syntax error detection, configuration mismatch identification, and geometric transformation (e.g., rotation, scaling).
- Use multi-turn, multi-chunk G-code input with explicit instructions to prevent premature analysis of partial files.
- Compare model outputs against ground-truth G-code transformations and error corrections.
- Analyze model behavior through qualitative and quantitative evaluation across six LLMs: GPT-4, Claude-2, Bard, Llama-2-70b, Starcoder, and others.
- Use a public GitHub repository to share full chat transcripts, screenshots, and generated G-code for reproducibility.
Experimental results
Research questions
- RQ1Can foundational LLMs effectively detect and correct common G-code errors such as syntax, configuration, and geometry issues?
- RQ2How well can LLMs perform geometric transformations (e.g., rotation, scaling) on complete G-code files?
- RQ3To what extent do context length and model architecture limit LLMs’ ability to reason about 3D geometry from G-code?
- RQ4How do closed-source and open-source LLMs compare in G-code comprehension and manipulation tasks?
- RQ5What are the primary failure modes and biases in LLM-generated G-code modifications?
Key findings
- GPT-4 demonstrated the strongest overall performance in G-code debugging, transformation, and comprehension tasks.
- Claude-2 outperformed other models, particularly due to its longer context length, which enabled better handling of full G-code files.
- Open-source models like Llama-2-70b and Starcoder showed significant limitations in accuracy and consistency, especially on complex geometric tasks.
- All models struggled to parse complete G-code files in a single shot, often misinterpreting or forgetting instructions when processing multi-chunk inputs.
- Bard incorrectly interpreted a cube as a Benchy boat model, indicating potential overfitting or lack of 3D printing-specific training data.
- Context length constraints severely limited spatial reasoning and geometric comprehension, especially for 3D structures beyond single layers.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.