Industry-specific operational data
CNC G-code and Machining Data for AI: Programs, Setups and Outcomes
Quick answer
A useful G-code dataset for CNC AI is not a pile of .nc files. It is proven programs linked to the part model, stock, fixturing, tool list, controller and post-processor, plus what happened when the program ran: prove-out edits, cycle time, alarms, scrap and tool life. Public G-code corpora mostly cover 3D printing, so buyers usually source machining data from job shops and OEM plants under a license that settles customer IP and export-control questions first.
By SourceX Editorial · Updated
Why public G-code datasets do not cover CNC machining
The most prominent public G-code corpus is built for extrusion 3D printing, so it teaches slicer output, not subtractive machining strategy. Slice-100K, published at NeurIPS 2024, pairs more than 100,000 G-code files with CAD models drawn from Objaverse-XL and Thingi10K, and its authors note that few curated CAD-to-G-code collections exist [1][2]. Printer G-code is dominated by G1 extrusion moves with an E axis; it carries no work offsets, tool changes, canned cycles, cutter compensation or spindle strategy.
Research on LLM-based CNC program generation is emerging, but it has no large public corpus of real shop programs to learn from. The Hugging Face papers index lists GLLM, an LLM CNC-programming system that checks output with syntax validation and compares resulting geometry with Hausdorff distance [3]. That evaluation design is a good template, but it also shows the gap: models can be scored on whether code parses and approximates shape long before anyone has real programs showing how machinists actually cut a part.
For a buyer building CAM agents or G-code copilots, that gap is the reason to source operational data. The value is in the strategy a shop converged on after prove-out, which is invisible in syntax-only corpora.
What a complete CNC program record contains
A complete record joins the program to the part, the setup and the run history; without those joins, a model learns dialect but not decisions. Plan your request around these linked objects, and keep the cross-family picture in mind by reviewing the industry-specific operational data hub.
- Program files: the posted NC file per operation (OP10, OP20), the CAM source (for example Mastercam, NX CAM, Fusion, hyperMILL or Esprit project files) where licensable, and setup sheets.
- Controller and post-processor: controller family and model (Fanuc 0i/30i, Haas NGC, Siemens Sinumerik 840D, Heidenhain TNC, Okuma OSP, Mazak Mazatrol or EIA), post name and version. Dialects differ in macro syntax (Fanuc Custom Macro B #variables versus Heidenhain conversational versus Siemens cycles), so a program without its controller label is close to unusable for training.
- Part and stock: STEP AP242 or Parasolid geometry, stock size and material grade, tolerances and GD&T callouts from the drawing. Design-file sourcing is covered separately on our CAD and PCB design dataset page; this page owns the machining layer.
- Workholding and offsets: fixture or vise description, work offsets (G54 to G59, extended G54.1 P-values), probing routines and datum strategy.
- Tooling: tool library entries with holder, stick-out, flute count, coating, corner radius, and the feeds, speeds, stepover and stepdown actually used per operation.
- Revision history: DNC or program-management revisions (for example from Cimco, Predator DNC or a PLM vault) with timestamps and author roles, showing what changed between first post and released program.
- Outcomes: first-article inspection result, cycle time, scrap and rework counts, tool-life records and alarm history.
Prove-out edits are the strongest supervision signal
The diff between the CAM-posted program and the released program shows what an expert machinist corrected, which is stronger supervision than the final program alone. Typical edits include feed overrides baked into F words, added dwell or peck changes in G83 cycles, reordered operations to reduce tool changes, extra spring passes for tolerance, and changed approach moves after a near miss.
Ask suppliers whether revision history survives in their DNC or file system, and whether edits can be tied to an outcome such as a scrapped first piece or a measured dimension out of tolerance. Paired (posted, released, reason) triples behave like the review-outcome pairs described in our guide to code preference and reward data from review outcomes, applied to toolpaths instead of pull requests.
A common failure mode is a shop that edits at the control and never pushes the program back to the server. In that case the server copy is the posted version, and the true released program lives only in controller memory, so collection needs a control backup step, not just a file share export.
Machine monitoring logs add measured outcomes
Machine monitoring data supplies the outcome labels that programs lack: actual cycle time, feed hold events, spindle load traces and alarms. MTConnect, a read-only standard for machine tool data, reports controller execution state, spindle speed, feed rate, load and part count through a shared vocabulary. OPC UA serves similar data on many newer controls, and its Part 9 Alarms and Conditions model standardizes how alarm state is exposed [4]; plant historians often hold the same signals.
Three checks matter before you buy logs. First, confirm which data items the specific control exposes, because support for items such as spindle load varies by builder and adapter. Second, confirm that sample rate is fine enough for your task: cycle-level summaries suit cycle-time prediction, while tool-wear or chatter models need sub-second load or vibration traces. Third, demand a join key from log events to program number (O-number), tool number and part serial, or the logs cannot label anything.
Monitoring data overlaps with controller alarm streams covered in our page on PLC, SCADA and DCS alarm and event logs and with order and downtime context in MES production records. For broader sensor licensing, see sensor and IoT data.
Matching data to the model you are building
Each application needs a different minimum set of links, so specify the use before you specify the volume. The table below maps common manufacturing AI products to the data they depend on.
| Application | Must-have fields | Outcome label | Common gap |
|---|---|---|---|
| G-code generation or translation LLM | Program, controller, post, part geometry, tool list | Released vs posted diff, first-article pass | Programs with no controller label |
| CAM agent or toolpath planner | CAM project, stock, fixture, operation sequence | Cycle time, scrap, rework | CAM files under vendor license limits |
| Cycle-time prediction | Program, machine model, feeds and speeds | Measured cycle time from monitoring | No join from log to O-number |
| Tool-wear and tool-life prediction | Tool ID, material, cutting parameters, load trace | Tool change reason, measured wear | Changes logged as "scheduled" only |
| G-code verification or collision check | Program, machine kinematics, fixture model | Simulation result, crash or alarm record | Fixture geometry never modeled |
Rights, customer IP and export control come first
Most job-shop programs encode a customer's part, so the shop may not hold the right to license them, and some may be export controlled. Program files, setup sheets and part models often fall under the customer's purchase order terms, NDA or quality agreement, which can restrict use beyond production of the order. Ask suppliers to segment programs by customer and confirm, per customer, that the shop's agreements permit licensing for AI training.
Defense and aerospace work adds a regulatory layer. Under ITAR, technical data includes information required for the production or manufacture of defense articles, and the definition also reaches software directly related to defense articles [5]. Under the EAR, releasing controlled technology to a foreign person inside the United States can be a deemed export [6], which matters if your labeling team or model developers include foreign nationals.
Practical screens include excluding programs for parts on ITAR-controlled jobs or jobs involving EAR technology controlled under a specific ECCN, stripping title blocks, part numbers and customer names from setup sheets and comments, and checking that G-code comments (text in parentheses) carry no customer identifiers. Treat geometry as potentially identifying: a program can reveal a controlled part shape even after names are removed.
This page is general information, not legal advice. Confirm requirements with counsel for your jurisdiction and use case.
Acceptance checks and evaluation set design
Acceptance testing should prove the data is parseable, linked and labeled before you pay for volume. ISO/IEC 5259-2 gives a vocabulary of data quality measures such as completeness and consistency that can be written into acceptance criteria [7]. Apply them to concrete machining checks:
- Every program parses under its declared controller dialect; reject files with mixed dialects or missing tool-change blocks.
- Every program joins to a part model, tool list and controller label; report the join rate by field.
- Units (G20 or G21), plane (G17 to G19) and absolute or incremental mode (G90 or G91) are explicit at program start.
- Outcome labels have a stated source (inspection report, monitoring log, operator entry) and a date.
- Hold out evaluation sets by part family and customer, not by random file split, so near-duplicate programs for revisions of one part do not leak across train and test.
- Score generated programs with simulation (for example Vericut or the CAM system's own verifier) for collisions, gouges and over-travel, alongside syntax and geometric distance checks of the kind used in GLLM [3].
Sample request template for CNC machining data
A precise request lets a supplier check fit quickly and keeps sensitive work out of scope from the start.
Illustrative example: invented to show structure; it does not describe an available dataset.
request: cnc_program_and_outcome_data
use: fine-tune G-code generation model; build held-out eval set
processes: [3-axis milling, 5-axis milling, 2-axis turning]
controllers: [Fanuc 30i, Haas NGC, Heidenhain TNC 640]
per_program_fields:
- posted_program_file
- released_program_file
- revision_history: {timestamp, author_role, change_note}
- controller_family, post_processor_name, post_version
- part_geometry: STEP AP242
- stock: {material_grade, dimensions}
- fixture_description, work_offsets
- tool_list: {tool_no, type, diameter, corner_radius, holder, stickout}
- cutting_parameters: {rpm, feed, stepover, stepdown}
outcomes:
- first_article_result: pass | fail | rework
- cycle_time_measured_s
- tool_change_reason
- alarm_codes
monitoring_join: MTConnect or OPC UA events keyed to O-number and tool_no
exclusions: [ITAR or EAR controlled jobs, customer names, part numbers in comments]
rights: per-customer confirmation that AI training licensing is permitted
How SourceX handles CNC and machining data requests
SourceX sources operational datasets from US companies, including engineering records, and manages the commercial process through licensing and ongoing purchases. Data is sourced on request rather than held in stock, so a request does not guarantee a match, and every release is approved by the supplying company. Each dataset is rights-reviewed for ownership and consents and delivered under a license that defines records, uses, term and delivery. Personal details such as names and emails are removed or replaced before delivery, with the method recorded and a sample checked, though no method is perfect. You can describe the machining data you need, and see related manufacturing needs on our manufacturing buyers page.
Request CNC program and machining data
Describe the programs, controllers, setups and outcome signals you need, and SourceX looks for US businesses that hold that data. Nothing is contracted until a supplier agrees, and pricing and allowed uses are set in a license per deal. Start a buyer request.
Sources
- arXiv, "Slice-100K: A Multimodal Dataset for Extrusion-based 3D Printing" (2024). https://arxiv.org/html/2407.04180v3
- NeurIPS Proceedings, "Slice-100K (NeurIPS 2024 Datasets and Benchmarks proceedings)" (2024). https://proceedings.neurips.cc/paper_files/paper/2024/hash/e8699fa39bf3117065b6727dccaafd54-Abstract.html
- Hugging Face, "Papers matching G-code". https://www.huggingface.co/papers?q=G-code
- OPC Foundation, "OPC UA Part 9: Alarms and Conditions". https://reference.opcfoundation.org/Core/Part9/v105/docs/3
- eCFR (U.S. Government), "22 CFR 120.33 Technical data". https://www.ecfr.gov/current/title-22/chapter-I/subchapter-M/part-120/subpart-C/section-120.33
- U.S. Bureau of Industry and Security, "Deemed exports". https://bis.gov/node/6307
- ISO, "ISO/IEC 5259-2:2024 Artificial intelligence: Data quality for analytics and machine learning, Part 2: Data quality measures" (2024). https://www.iso.org/standard/81860.html
Tell us what your models need
Share scope, volume, language, format, timing and licensing requirements.