System design for physical AI: weld checks that trace a defect to its supplier lot
By Muhammad Umar. This is the engineering summary of an open reference architecture from CodeNinja Atoms for physical AI system design at the station exits of a vehicle body shop, one of a series of worked examples of ph
By Muhammad Umar. This is the engineering summary of an open reference architecture from CodeNinja Atoms for physical AI system design at the station exits of a vehicle body shop, one of a series of worked examples of physical AI that get better from what named people confirm, on hardware the operator owns, without training a model on the fly. The paper, its object model as JSON and the model register are free to reuse under CC BY 4.0: https://codeatoms.ai/weld-assembly-quality-vehicle-plant-pakistan/. DOI 10.5281/zenodo.24048589. The operator is described by class, never by name.
A vehicle assembly plant in Pakistan moves bodies through a body shop with robot and manual spot welding and sealer application, then paint, then a trim and final line where harnesses, interiors and underbody parts are fitted and torqued, then end of line test and a final inspection booth. It needs one question answered every day: why did the body shop defect rate rise on a given day, and which supplier lot sits behind a defect pattern, answered while the line is still running rather than weeks later in warranty. The answer lives in pieces no system joins. When a batch of door hinges arrives slightly out of tolerance, it shows first as sealer gaps at the body shop station exit and then as door fit faults on the trim line, and today the argument that ties weld point flags to body numbers, operations, supplier lots and confirmed defects is rebuilt by hand across the robot logs, the torque records and the inspection sheets whenever auditors ask.
1. Three layers, and the records stay put
The design is one pattern in a fixed order: six systems of record below, each owning its domain and keeping it; one governed object model in the middle as a projection over them, never a replacement; six services and five surfaces above, where agents draft findings and named people confirm, approve and decide. The plant's failure is a join failure, not a sensing failure. A camera at a trim station can see a missing clip, but the question the quality manager asks crosses every system of record at once, so the design puts the join in one place, the object model, and refuses to let any application build its own private copy.
Every frame, model and inference stays inside the plant network in Pakistan, on the operator's own hardware, and no third party model service is called. The design chose against packaged smart cameras of the industrial vision vendor class, rated to 40 C ambient, below a body shop summer, with weights the operator would not own; against multi object tracking, because each body is captured once at a station exit and identity comes from the body number and MES genealogy; against on the fly fine tuning, which would change the model under audit and invalidate the validation evidence; and against agent authority to stop a line or reject a lot. Paint shop and end of line cameras are held for the phase after, gated on phase one evidence.
2. One adapter family, six sources
Six read only sources of operator provenance feed the design. The manufacturing execution system owns orders, body numbers, genealogy and routing. The robot and weld controller logs own the weld point truth, the nominal positions and the weld currents. The torque tool controllers own per fastener torque readings with tool identity on the trim and final line. The end of line test rigs own the verdict each vehicle leaves with and the outcome the phase one baseline is measured on. The quality management system owns defect records, repair tickets, corrective actions and audit findings. The supplier parts receiving records own lot identity, supplier and delivery date, which is what turns a defect cluster into a supplier lot trace.
One integration adapter family is the single door in, and no source is read directly. Debezium change data capture reads the MES and QMS databases without touching their transaction paths, collectors take the controller and rig logs, and anything crossing a network zone passes a one way transfer, so the boundary between office and plant networks stays one directional. The adapter owns a contract per source, so a schema change upstream surfaces as a broken contract rather than silent bad data. Identity is resolved once, with lineage, inside the ontology, and the reconciliation is proved against yesterday's actual production before any agent runs on it. Every event is stamped from the PTP grandmaster, an OCP Time Card with linuxptp, so a camera frame, a torque reading and a weld log sit on one timeline. The single write path back into a system of record is the approved record into the quality management system, through the adapter, never around it.
Apache Kafka 4.4 is the backbone, keyed by body number so every record for one body arrives in sequence regardless of how the partitions are laid out. Delivery is at least once with idempotent writes in the ontology, so a replayed event cannot double count a defect. Buffering is on disk at the edge, so a dropped link from a station unit never becomes a missed body, and replication inside the plant's Kafka cluster survives the loss of a broker. TimescaleDB holds telemetry and time series, Harbor is the air gapped registry, Keycloak issues identity on site, and Prometheus, Grafana and Loki watch the backbone, so capture completeness is an alert the command center sees rather than a gap found at audit time.
3. Sixteen objects, one walk
The object model holds sixteen objects in six kinds on Hyper Ontology. One site: station. Three assets: vehicle, body and part. Two events: operation and defect. Three measures: weld point, sealer bead and torque result. Five records: supplier lot, defect class, repair ticket, audit finding and corrective action. Two actors: the body shop quality inspector and the quality manager. The defect is the pivot, with a status vocabulary that runs Flagged, Confirmed, Dismissed, which keeps a machine flag and a human confirmed defect distinct; a repair ticket runs Draft to Approved.
A body carries its weld points and sealer beads and is inspected by the body shop quality inspector; an operation works on a body; a weld point is checked by the inspector; a part arrives in a supplier lot; a supplier lot accumulates defects and is traced to a defect class; a defect is classified as a defect class and found on a body; a repair ticket resolves a defect; a corrective action is opened on a supplier lot. So the auditor's question becomes one traversal: from a flagged weld point to the body, the operation, the inspector, the lots fitted that day and the open corrective actions, with lineage at every hop. A document store would force a manual rebuild across exports, because it cannot walk the edges.
4. Three tiers in the plant
Inference runs on three tiers, all inside the plant. At the body shop, trim and underbody station exits, 5 MP global shutter GigE Vision cameras with strobed lighting capture each body once on a body present trigger from the station PLC, and fanless industrial edge units on an octa core 6 TOPS NPU SoC rated minus 40 to 85 C run the check on the device under ONNX Runtime, with K3s orchestrating containers. D-FINE runs there at INT8 for weld spot, part, clip, connector and fastener presence, about 8 MB at 16 bit for the N variant and about 124 MB for the X variant. Anomalib 2.7.0 watches sealer beads, fitted on the plant's own good beads because sealer gaps are rare and varied. In the plant server room, one air cooled 48 GB PCIe inference server serves BGE-M3 at FP16, about 1.1 GB, for retrieval with citations, and rescores the borderline detections the edge flags. The central tier is GLM 5.3 under vLLM, the agentic work surface and the ontology's maintainer. D-FINE and Anomalib are Apache-2.0, BGE-M3 is MIT, and GLM 5.3 carries a bespoke licence that permits commercial use, fine tuning and redistribution.
The memory arithmetic decides the central node. 753B parameters at FP8 is 1 byte per parameter, so 753 GB of weights; the 1.2 planning factor for KV cache and activations raises the requirement to 904 GB. One node of eight 141 GB HBM GPUs holds 1,128 GB, leaving 375 GB beside the weights against the 151 GB the factor reserves. Pakistan sits in Country Groups D:2, D:3 and D:4, so the US export licence determination for the 141 GB node and for the 48 GB site server class (ECCN 3A090) is a phase one checkpoint before anything is quoted, with an approved data center or a phased precision fallback on the table rather than quietly shrinking the model.
The latency budget is set by takt. Each presence check must finish inside the station's takt, so no body waits on a model; the detector runs beside the camera with no network round trip, and its published 2.12 to 12.89 ms single image latency on a T4 leaves wide margin at station pace. The site tier works on a seconds scale budget, and the central tier on a human scale one, because conversational answers with citations are read and judged by named people. When the link fails, the edge units keep capturing and checking against the last loaded model, buffer locally and resynchronize. When the update path fails, the one way gate leaves the running detector in place while the registry holds the last complete artifact.
5. Agents draft, inspectors confirm
Six services (edge inspection, plant ontology, agents and approvals, command center, compliance and validation, and plant infrastructure) carry the work onto five surfaces: confirmation terminals at the stations, the repair ticket and torque alert queue, the supplier lot risk view, the command center views, and the edge health and capture completeness alerts. Three agents draft on GLM 5.3: weld checks, supplier lot traces, and conversational answers with citations. The body shop quality inspector confirms or dismisses every flagged weld point or missing clip at the station terminal, the quality manager approves every repair ticket draft and opens every corrective action, and no agent stops a line or rejects a supplier lot. Every confirmation and dismissal is kept as memory the next check reads. Nothing is trained into weights.
Appendix A prices the node at about 572,000 US dollars to own over three years (542,000 to 610,000): a configured eight card H200 server at 407,660, support at 8 to 12 percent of hardware value a year, and power taken as a ceiling at 10.2 kW around the clock at the national industrial tariff. Renting the same eight cards on the deepest three year commitment in AWS Asia Pacific (Mumbai) is about 751,000, so ownership costs about three quarters of it; on demand it is about 2.00 million, against which ownership costs a little over a quarter. Renting is a price reference only, because AWS lists no region in Pakistan and every rented option would carry evidence frames, process data and the decision record across the border.
The rollout is one phase carrying 15 items across six workstreams and covering the operator's 18 requirements, closed by a gate, never a date: trim and underbody presence checking must run on every body and vehicle that passes before the phase closes. Every check runs in shadow beside the manual inspection it supports, and nuisance images of dust, spatter, oil and lighting change are collected and labelled before any threshold is set. The baseline is frozen from the end of line test rigs, and the phase tracks the false flag count, held under 10 per inspector per working session, capture completeness, the confirmation rate of flagged defects, the defect clusters that resolve to a supplier lot, and the time it takes to answer auditors when they ask why a body shop rate rose on a given day. Masking, signage and retention limits are built in phase one, with worker consultation before the first camera is switched on, because the cameras check bodies and vehicles, never worker performance.
Made with CodeNinja Praxis, the CodeNinja Atoms platform for designing physical AI systems. The object model imports into Hyper Ontology. Paper, ontology and register: https://codeatoms.ai/weld-assembly-quality-vehicle-plant-pakistan/
One of the CodeNinja Atoms worked examples of physical AI system design: systems of record read and never written, a governed ontology joined by typed links, open weights on hardware the operator owns in its own country, and agents that draft while named people approve, the shape every physical AI design in the series is published in, with its object model as hyper-ontology/1 JSON under CC BY 4.0.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.