arXiv:2512.11296cs.CVcs.AI2025-12

用视觉语言模型联合检测G代码与操作界面错误,提升数控编程教学验证效果。

Few-Shot VLM-Based G-Code and HMI Verification in CNC Machining

  • 基于少样本提示,融合文本与界面图像进行联合验证。
  • 在15种工况下,对界面错误和代码不一致的检测准确率显著提升。
  • 适合数控机床教学中手动编写代码的纠错与安全检查场景。

手工编写G代码对学习数控机床操作至关重要。以往的G代码验证多依赖大语言模型(LLM),主要关注代码语法错误,但忽略了人机界面(HMI)显示的机器状态与错误信息。由于LLM无法访问视觉模态,难以利用HMI知识。本文提出一种少样本视觉语言模型(VLM)验证方法,同时评估G代码与对应HMI截图中的错误及安全状态。数据集包含来自15滑块-PRO车床的成对G代码文本与HMI截图,涵盖正确与错误案例。为支持少样本学习,VLM采用基于先验启发式知识的结构化JSON模式,并以含错或无错的实例作为提示示例。在多种错误场景下对比零样本与少样本VLM的逐槽位准确率,结果表明少样本提示显著提升了对HMI错误及代码-界面不一致的检测能力。该框架适用于手工生成的、常用于数控教学的G代码验证。

原文摘要 · Abstract (English)

Manual generation of G-code is important for learning the operation of CNC machines. Prior work in G-code verification uses Large-Language Models (LLMs), which primarily examine errors in the written programming. However, CNC machining requires extensive use and knowledge of the Human-Machine Interface (HMI), which displays machine status and errors. LLMs currently lack the capability to leverage knowledge of HMIs due to their inability to access the vision modality. This paper proposes a few-shot VLM-based verification approach that simultaneously evaluates the G-code and the HMI display for errors and safety status. The input dataset includes paired G-code text and associated HMI screenshots from a 15-slant-PRO lathe, including both correct and error-prone cases. To enable few-shot learning, the VLM is provided with a structured JSON schema based on prior heuristic knowledge. After determining the prompts, instances of G-code and HMI that either contain errors or are error free are used as few-shot examples to guide the VLM. The model was then evaluated in comparison to a zero-shot VLM through multiple scenarios of incorrect G-code and HMI errors with respect to per-slot accuracy. The VLM showed that few-shot prompting led to overall enhancement of detecting HMI errors and discrepancies with the G-code for more comprehensive debugging. Therefore, the proposed framework was demonstrated to be suitable for verification of manually generated G-code that is typically developed in CNC training.

G代码验证视觉语言模型数控加工少样本学习

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。