Manuscript Offprint
arXiv:2609.05880Grounded and Faithful P&ID Reasoning: Constraining Vision-Language Models with Recovered Evidence Graphs
Abstract
Piping and Instrumentation Diagrams (P&IDs) are the authoritative maps of process plants: isolation, maintenance, and HAZOP decisions depend on what connects to what. Vision-language models describe these sheets fluently, yet they often invent or miss process connections—and an invented or missed link can reverse an isolation or reachability call, so a plant decision cannot trust a fluent answer that was never checked against the linework. We instead recover an explicit graph of the drawing—its symbols, the process connections between them, and the tags that name them—and then require the model to answer only by querying that graph through seven read-only operators, so a topology claim is returned only when it cites the query results that support it. On TopoPID-VQA, a new suite of 3000 topology questions over these sheets, Graph-Grounded Harness (Ours) raises exact-match accuracy from 36.7–41.3% under image-only prompting to 74.3–76.0% for Qwen3-VL-4B, Qwen3-VL-8B, and Gemma-4-E4B. It does so on an imperfect substrate: on Digitize-PID dataset the recovered graph scores 0.742 on exact process connections, and 0.801 once symbols and tags are pooled in. The residual errors track that gap—grounding pays off where the recovered graph is right, and perception error still breaks topology questions where it is not.
1 Introduction
Piping and Instrumentation Diagrams (P&IDs) are the working drawings of process plants: they record which equipment, valves, and instruments share process lines and control loops [Paliwal et al., 2021, Rahul et al., 2019]. Oil and gas, chemicals, power generation, pharmaceuticals, water treatment, and aerospace propulsion or ground-test facilities all keep P&IDs as the authoritative map for isolation, maintenance, HAZOP, and as-built checks. Those sheets are how a plant is licensed, modified, and shut down safely; an invented or missed connection is an operational error, not a caption glitch. Engineers query them for isolation planning, tag tracing, routing checks, and other calls that depend on what connects to what, not on a free-form description of the drawing.
Most plant archives still hold P&IDs as rasters. Reading topology from those pixels is slow for people and unreliable for vision-language models (VLMs): a model may name symbols fluently yet invent a path between mark A and mark B with no check against the linework. On a P&ID that invented edge can reverse an isolation or reachability call.
A useful P&ID assistant therefore needs two things. First, an explicit process graph recovered from the sheet so connectivity is a stored fact rather than a guessed relation. Second, a way to answer English questions that forces every topology claim to cite those graph facts. We ask how much accuracy that grounding buys on topology questions over these sheets, and how much remains limited by the quality of the recovered graph itself.
Preprint.

Figure 1: Grounding converts a plausible prediction into an auditable answer. An image-only VLM may invent a process connection without checking the underlying linework (left). A graph-grounded harness conditions the answer on recovered topology and returns inspectable evidence identifiers (right).
Real sheets make the difficulty concrete: hundreds of near-identical symbols, long pipe runs, fly-over crossings, and tags that look alike. Pixel-only reading is a poor fit; process topology is what the decisions depend on.
Our system has two stages. Stage 1 recovers a grounding substrate: finetuned perception finds symbols, lines, and text; deterministic rules (intersection noding, sheet-adaptive junction snap, first-symbol linker walk, tag association) build the typed process graph . An optional signal-edge layer can attach instrument links on dashed polylines; we report its recovery separately, and TopoPID-VQA questions use process edges only. Stage 2 is Graph-Grounded Harness (Ours): a VLM plans over seven fact-returning graph operators, grounds marks and tags on the sheet, and returns a structured answer that cites the supporting graph entities. Answers without cited evidence are rejected. Figure 1 contrasts the two regimes.
-
Topology benchmark. TopoPID-VQA is a 3000-question topology suite (easy/medium/hard) that scores answers under graph grounding on the recovered process graph .
-
Deployment-facing measurement. Across Qwen3-VL-4B, Qwen3-VL-8B, and Gemma-4-E4B, graph grounding lifts pooled accuracy by 33.8–37.6 percentage points over image-only inference, while exact edge 0.742 on states how much substrate error remains.
For P&ID workflows, the practical claim is narrow: graph grounding raises answer reliability on topology questions, while exact edge on states how much sheet error still propagates into those answers. Section 2 places the work; Section 4 details the two stages; Section 5 leads with TopoPID-VQA results, then substrate fidelity.
We evaluate open VLMs as the reasoning front-end on TopoPID-VQA, and we also score cloud OCR and object-localization APIs plus zero-shot line segmenters as perception controls on the same sheets. Those baselines show that stock vision services are a weak substitute for a P&ID-tuned substrate (Appendix A.8), which is why Stage 1 is finetuned perception plus deterministic graph construction rather than an off-the-shelf detector stack alone.
2 Related Work
Grounding and faithful multimodal reasoning. Document and chart VQA stress reading and layout [Mathew et al., 2021, Masry et al., 2022]; compositional suites isolate relational reasoning under clean structure [Johnson et al., 2017, Hudson and Manning, 2019]. VLMs still invent relations that the pixels never support, especially on dense graphics. Tool-using and multimodal chain methods reduce free-form guessing by calling external actions or retrievers [Yao et al., 2023, Schick et al., 2023, Lu et al., 2022]. We take the structural route: recover a typed graph from the raster, then require every topology claim to come from a tool result rather than an unverifiable rationale.
Graph- and tool-augmented agents. Agentic loops that interleave reasoning with external calls [Yao et al., 2023, Schick et al., 2023] and graph-query front-ends that translate questions into executable queries [Gupta et al., 2025, Alimin and Schweidtmann, 2026] both assume a clean, given graph or database. Our setting differs: the agent operates on built from predicted perception, and we score both answer accuracy and how far drifts from . That couples perception error to reasoning error instead of assuming a clean, hand-corrected knowledge base.
Engineering-diagram understanding. Digitize-PID and earlier extraction pipelines recover symbols, text, and pipes before linking them into a graph [Paliwal et al., 2021, Rahul et al., 2019]. PIDQA converts P&ID entities into a labeled property graph and scores LLM-generated Cypher queries against it, so QA accuracy is reported on a graph that is taken as the knowledge base rather than as a measured approximation of the sheet [Gupta et al., 2025]. ChatP&ID [Alimin and Schweidtmann, 2026] applies GraphRAG to DEXPI-style smart P&ID models, where node and edge grounding is largely supplied by the source format. Multi-agent retrieval systems for process schematics likewise target open-domain question answering over document context rather than the fidelity of a recovered topology [Sakhinana et al., 2024]. The gap we target is end-to-end: raster recovered evidence graph grounded agent, with graph imperfection measured rather than assumed away. We also keep dashed instrument links as a separate signal-edge layer, which the Digitize ground truth connectivity does not model on our partition.
3 Problem Formulation
Each instance is a marked sheet and English question . Gold answer is computed from the oracle process graph (ground-truth geometry plus Digitize ground truth connectivity) and is never shown at inference. The deployed system receives only plus the recovered process graph . An image-only baseline sees ; Graph-Grounded Harness (Ours) sees and may call a fixed tool library. We report exact-match accuracy on TopoPID-VQA and graph against so perception and reasoning failures can be separated.
4 Evidence-Grounded VLM Framework
Figure 3 follows the evidence path from raster to structured answer. Stage 1 recovers a grounding substrate: multimodal perception finds symbols, line ink, and text, then deterministic construction turns those detections into the typed process graph . Stage 2 runs Graph-Grounded Harness (Ours) under an answer contract so topology claims must come from tool results rather than free-form guessing on pixels. Keeping recovery and QA in separate stages makes it possible to pin a failure on the graph or on the planner that used it.

Raw P&ID raster

Detected lines, symbols, and text

Recovered process graph
Figure 2: Raster to evidence graph on one Digitize-PID sheet (notes and title block removed). Left: input drawing. Center: perception overlays for lines, symbols, and text. Right: process-connection graph recovered from those detections (nodes at symbol centers; edges from the first-symbol walk).
Answer contract. (1) No final answer without at least one graph-tool call. (2) Every named entity in Q must be queried through a tool before answering. (3) For closed counting questions, the number of cited supporting entities must match the reported count.
Stage 1: grounding-substrate recovery (P&ID Graph Recovery Stack (Ours) → ). The perception stack runs in fixed order on every sheet: tiled YOLO11s [Jocher et al., 2023] symbol detection (test-set detection 0.983), EfficientNet-B0 U-Net [Ronneberger et al., 2015] masks for solid and dashed ink (Dice micro 0.982), and YOLO-text with finetuned TrOCR [Li et al., 2023] for diagram OCR (detection 0.833). Those heads only locate ink. Topology is built afterward by deterministic geometry on the predicted solid layer.
Skeletonization turns solid masks into polylines. Intersection noding splits or trims runs that cross at tees and corners so branches share exact endpoints instead of overshooting past a junction. Endpoints within a per-sheet snap radius merge into junctions; that radius is set from median segment length and tip gaps rather than a global pixel threshold (fixed 10 px snap collapses exact edge to 0.193 on predicted solids). Each detected symbol attaches to the nearest solid segment within 120 px of its box center. A first-symbol walk then traverses empty scaffold junctions along the segment graph and stops at the first occupied junction, emitting undirected process-connection edges to the symbols there; symbols that share a junction form a clique. Two symbols become adjacent only under this walk—page proximity or a fly-over crossing without a shared junction never creates an edge. Geometric rules then bind OCR words to symbols and lines by containment, overlap, and proximity, with line-seed propagation along the segment graph. The product is : typed symbol nodes (class and optional tag), undirected process edges, and line-tag attachments usable by later tools.
As an optional extension, a signal-edge layer runs the same walk on dashed instrument polylines with dash-specific adaptive snap (Digitize does not attach symbols to dashes on our partition). We score that layer as recovered evidence only; TopoPID-VQA questions use process connections. Neural nets find ink; deterministic rules build topology—the graph builder does not invent edges with a learned model. Figure 2 shows one Digitize-PID sheet through this stage: raw raster, perception overlays, and the recovered process graph.
Stage 2: tool-mediated reasoning on . Each TopoPID-VQA item is a marked sheet I, an English question Q, and the frozen graph for that sheet. An image-only baseline sees only . Graph-Grounded Harness (Ours) receives and answers through a planner loop capped at six turns. Before the first tool call, colored mark letters on I (A/B/C) are detected and snapped to nearby nodes, and any tag strings named in Q are linked through OCR tags (with an optional local crop when several nodes share a string). That seed step is a helper outside the seven graph tools.
The planner may then call node lookup, neighbor listing, node search, breadth-first traversal, shortest path, edge check, and set operations. Each call returns structured facts—ids, types, tags, hop lists, distances, or membership—never a yes/no verdict on Q. Counting, comparison, thresholding, and routing stay in the model's reasoning over those returns. A typical reachability item resolves marks to node ids, asks for a breadth-first frontier or shortest-path distance, and only then states true/false or a bucket label; a tag-choice item searches by type or prefix and cites the returned ids in the answer schema. The interface is type-agnostic: the checkpoint is not told whether is a hop-count, tag-choice, or negation item, and it never receives a dumped adjacency list. Every topology claim must be fetched through a tool, so the trace records which graph facts supported the answer.
The final message must follow a fixed schema: a short interpretation, references to the tool steps used, the supporting entity ids, and a typed answer (integers clamped to ranges parsed from ; strings snapped to enumerated options). Answers that skip the tool loop, omit a named entity query, or fail the counting citation check are rejected under the answer contract above. The same VLM checkpoint (Qwen3-VL-4B, Qwen3-VL-8B, or Gemma-4-E4B) plans in text over tool traces. Pixels are used only for mark detection and optional tag disambiguation; edges, hops, reachability, and counters come only from tool results, never from re-reading pipe ink.
Deployment profile. On 100 test sheets P&ID Graph Recovery Stack (Ours) spends roughly 1.2 s/sheet on symbol stitch, 4.6 s on line inference, and 22.7 s on text detection+OCR on paired 16 GB GPUs; graph build and tagging are CPU-side minutes per batch. That cost profile targets offline batch recovery followed by interactive queries, not low-latency full-sheet chat. TopoPID-VQA stress-tests the published graph product: each sheet carries ten questions whose gold depends only on , so improvements in perception, linking, or grounded inference can be measured on the same benchmark without family-specific prompt routing.
Detailed construction rules, tool definitions, and ablations appear in Appendix A.1 and Appendix A.9.
5 Experiments
5.1 Experimental Methodology
We first score grounded versus ungrounded VLM answers on TopoPID-VQA, then report how faithful the recovered graph is against . Digitize-PID provides 500 sheets: we use a training / validation / test split of 350 / 50 / 100 (seed 0). The publisher's 400-sheet train folder supplies training and validation; the publisher's 100-sheet val folder is our held-out test set. Perception weights and graph hyperparameters are chosen on training and validation only; the test set is never used for model selection. All reported perception, , and TopoPID-VQA numbers use this same 100-sheet test set. P&ID Graph Recovery Stack (Ours) is frozen before scoring: tiled symbol detection, U-Net line masks, skeleton vectorization, adaptive junction snap on solid polylines, YOLO-text with finetuned TrOCR, and geometric tag association. Cloud and zero-shot baselines use the same test sheets and matching protocols. TopoPID-VQA compares Qwen3-VL-4B-Instruct, Qwen3-VL-8B-Instruct, and Gemma-4-E4B-it under image-only inference versus Graph-Grounded Harness (Ours) over . The graph, tools, and answer contract are scored as one system (Appendix A.9).
5.2 Benchmark Suites
Digitize-PID. Five hundred synthetic full-sheet P&ID rasters with 32 symbol classes, solid and dashed line ink, word boxes, and Digitize ground truth connectivity. Under our oracle rule a sheet carries about 118 symbols and 338 undirected process edges on average. We train perception on the 350-sheet training split, use 50 sheets for validation (early stopping), and evaluate raster-to-graph recovery on the 100-sheet test partition. Digitize ground truth connectivity on ground-truth geometry is the process-graph reference ().
TopoPID-VQA. Three 1000-question suites—easy, medium, and hard—each with 100 sheets 10 questions. Each item contains a marked diagram, an English question, and (for graph systems) built from predicted perception. Gold answers are computed from only and are never shown at answer time. Easy questions stay local (boolean and small integers within one-two hops). Medium and hard add bounded reachability, tag families, closed string choices, negation, and counterfactual routing. Appendix A.10–A.17 cover generation, family lists, chance baselines, leakage checks, boolean metrics, and scores by answer type and category.
5.3 Experimental Setup
Graph variants. is the oracle process graph: ground-truth boxes, tags, solid segments, and Digitize ground truth connectivity for symbol attach. is the recovered process graph from predicted symbols, solid lines, and OCR, plus intersection noding and sheet-adaptive junction

Figure 3: Two-stage graph-grounded reasoning pipeline. Stage 1 converts a P&ID raster into the typed evidence graph (optional signal-edge layer on dashed instrument lines). Stage 2 combines with the marked sheet and question and produces a structured answer through a graph-tool harness. The reference graph is used only for scoring and TopoPID-VQA supervision; it is never provided as agent input.
snap. An optional signal-edge layer keeps process edges and adds dashed instrument links on predicted dashed polylines (Appendix A.1); TopoPID-VQA does not query it.
Inference. Symbol detection uses 20% tile overlap and NMS at IoU 0.10. Line masks are full-sheet; polylines come from skeletonization. OCR for the end-to-end graph uses diagram-aware crops. Cloud OCR and object-detection controls use a legend-stripped native-resolution diagram crop (JPEG quality 90). Line zero-shot baselines use full sheets at 1024 px long side before resize. Finetuned training and GPU inference used paired 16 GB accelerators; graph construction and scoring are CPU-only.
VLM conditions. The image-only condition receives the marked sheet and question. The grounded condition adds and applies the seven-tool loop and answer contract described in Section 4. We evaluate Qwen3-VL-4B-Instruct, Qwen3-VL-8B-Instruct [Bai et al., 2025], and Gemma-4-E4B-it [Gemma Team, 2026] under the same harness; no condition receives or a gold question-family label at inference. Decoding details are in Appendix A.4.
Table 1: TopoPID-VQA exact-match mean accuracy (%) with sheet-clustered bootstrap CIs (). Centered band: (paired half-width). Teal: light , mid [25, 40), strong pp. = paired 95% CI excludes zero. Appendix A.5.
| Level | Qwen3-VL-4B | Qwen3-VL-8B | Gemma-4-E4B | |||
|---|---|---|---|---|---|---|
| Img. | Agent | Img. | Agent | Img. | Agent | |
| Easy | pp | pp | pp | |||
| Medium | pp | pp | pp | |||
| Hard | pp | pp | pp | |||
| Pooled | pp | pp | pp | |||
Gold-query ceiling. A non-VLM gold-query ceiling remaps gold entities/queries from onto and answers from recovered adjacency. It uses topology plus gold entity/family information the harness never sees. Pooled exact-match is (not 100%) because still errs relative to (exact edge 0.742); see Appendix A.14.
5.4 Evaluation Metrics
Unless noted, TP/FP/FN counts are micro-pooled over all 100 sheets before precision, recall, and :
Boxes and words match greedily at IoU . Symbol detection is reported in two forms: class-aware (matched class required) and class-agnostic (geometry only). Unless noted, headline symbol scores are class-aware; cloud object-API comparisons use the class-agnostic form. OCR joint requires both a box match and equal normalized strings. Exact edge scores undirected process-connection pairs after symbol alignment. Connectivity-consistency awards credit to an edge whenever its endpoints are linked by any path in the other graph (not only by a matching local edge); we report the mean of per-sheet scores. On dense sheets this score can stay high even when local wiring is wrong, so exact edge remains the stricter topology metric. Attributed micro- pools matched nodes, exact process edges, symbol-tags, and line-tags (dashed signal edges excluded from the headline 0.801). Line quality uses micro-pooled pixel Dice/IoU vs thickness-2 GT polylines. TopoPID-VQA uses exact-match accuracy; on boolean items we also report , , and with positive class true. Full definitions are in Appendix A.2.
5.5 Results and Analysis
Grounded VLM reasoning. Table 1 is the headline comparison: image-only versus Graph-Grounded Harness (Ours) on the same recovered for Qwen3-VL-4B, Qwen3-VL-8B, and Gemma-4-E4B. Graph grounding improves every tier: pooled gains of +35.9, +33.8, and +37.6 percentage points ( vs. ; vs. ; vs. ). Hard remains the weakest slice for every checkpoint, while easy and medium close most of the gap. Boolean , per-category accuracy, and answer-type splits—including family-level checkpoint differences—are in Appendix A.16–A.17. The gold-query ceiling on (Section 5.3) reaches about 88.9% pooled. The grounded condition bundles graph access, tools, grounding, and answer schemas, so the gain is for the full harness rather than any single control. A topology overclaim proxy and graph-construction ablations are in Appendix A.6 and A.7.
Grounding-substrate fidelity. Table 2 scores against the oracle. The symbol node layer is near perfect (class-aware 0.984, recall 0.999). Exact wiring remains harder (0.742): Digitize expects dense one-hop neighborhoods, and vectorized polylines overshoot junctions until intersection noding splits runs at tees and corners. Connectivity-consistency 0.958 replaces that one-hop test with reachability by any path, so it stays high when symbols land in the right connected component and only the local links are misplaced. Tags sit between the two layers—0.866 on symbol tags, 0.730 on line tags, where one OCR miss can relabel an entire polyline. Pooling the four fact layers (nodes, exact edges, symbol tags, line tags) gives attributed micro- 0.801.
Table 2: Recovered process graph () as grounding-substrate fidelity against Digitize ground truth connectivity on 100 test sheets. Only solid process-connection edges are included. The symbol row scores graph nodes after class-aware matching inside the graph pipeline; the stitched detector evaluated under the standalone detection protocol scores 0.983 (Table 5).
| Layer | P | R | |
|---|---|---|---|
| Symbols (class-aware) | 0.969 | 0.999 | 0.984 |
| Exact edges | 0.677 | 0.820 | 0.742 |
| Conn. consistency | — | — | 0.958 |
| Symbol tags | 0.792 | 0.954 | 0.866 |
| Line tags | 0.599 | 0.935 | 0.730 |
| Combined tags | — | — | 0.798 |
| Attributed (all facts) | 0.730 | 0.886 | 0.801 |
Optional signal-edge layer. Beyond process topology, we recover a signal-edge layer on dashed instrument ink (Digitize does not attach symbols to dashes here). Adaptive snap raises signal exact from 0.610 () to 0.824 (Table 3); typed process+signal exact 0.748, attributed 0.802. TopoPID-VQA scores process-connection questions only; signal QA is left for follow-up.
Table 3: Process graph and optional signal-edge layer (100 sheets). Process: vs. Digitize ground truth connectivity; signal: predicted vs. fixed geometric gold.
| Layer / rule | Exact P | Exact R | Exact | Conn. cons. |
|---|---|---|---|---|
| Process connections | 0.677 | 0.820 | 0.742 | 0.958 |
| Signal (pred. fixed ) | 0.828 | 0.483 | 0.610 | 0.646 |
| Signal (pred. adaptive) | 0.808 | 0.840 | 0.824 | 0.869 |
| Typed complete (adaptive signal) | 0.686 | 0.822 | 0.748 | — |
Perception and off-the-shelf controls. Four frozen modules (Appendix A.3): YOLO11s det. 0.983, U-Net Dice 0.982, YOLO-text+TrOCR det. 0.833, dashed coverage 0.993. Same protocols: OCR joint 0.810 (Azure Read [Microsoft, 2024] 0.779, Textract [Amazon Web Services, 2024b] 0.663, GCP Vision [Google Cloud, 2024] 0.151); class-agnostic symbol det. 0.961 (Azure/GCP empty; Rekognition [Amazon Web Services, 2024a] 0.001); line Dice 0.982 (SAM 2 [Ravi et al., 2025] 0.012; DeepLab [Chen et al., 2018] near zero). Details: Table 11, Appendix A.8.
6 Limitations
Digitize-PID is synthetic; scores do not measure shift to scanned plant drawings, handwritten redlines, or site-specific standards. TopoPID-VQA tests three open VLMs under a bundled grounded condition (, tools, mark/tag grounding, answer contract): we ablate graph construction (Appendix A.7) but not the harness factors, so the reported lift is not attributed to individual components. Pixels are for marks/tag crops only; topology is tool-read (Section 4). The signal-edge layer is scored as recovered evidence, not as TopoPID-VQA QA input. Exact edge on is 0.742, so a wrong recovered edge can yield a faithful but incorrect tool answer. There is no reported calibration or abstention; human review remains necessary for safety-relevant use.
7 Conclusion
When topology cannot be verified from pixels alone, a recovered evidence graph plus cited tool results turns an unreliable image reader into an inspectable reasoner. Stage 1 freezes from predicted ink; Stage 2 answers only through tool traces on that graph. On Digitize-PID, reaches attributed micro- 0.801 (exact edge 0.742; connectivity-consistency 0.958). Grounded access raises pooled TopoPID-VQA accuracy by 35.9/33.8/37.6 pp for Qwen3-VL-4B/8B and Gemma-4-E4B (to 76.0%/75.1%/74.3% from 40.1%/41.3%/36.7%). Hard-tier misses and family-level checkpoint gaps (Appendix A.17) show that answers track both substrate fidelity and multi-step tool use. Future work: scanned plant sheets, harness-factor ablations, abstention, and TopoPID-VQA questions over the signal-edge layer.
References
Achmad Anggawirya Alimin and Artur M. Schweidtmann. GraphRAG for engineering diagrams: ChatP&ID enables LLM interaction with P&IDs. AIChE Journal, 2026. doi: 10.1002/aic.70540. Article e70540.
Amazon Web Services. Amazon Rekognition. https://aws.amazon.com/rekognition/, 2024a.
Amazon Web Services. Amazon Textract. https://aws.amazon.com/textract/, 2024b.
Shuai Bai, Yuxuan Cai, Ruizhe Chen, Keqin Chen, Xionghui Chen, Zesen Cheng, Lianghao Deng, Wei Ding, Chang Gao, Chunjiang Ge, et al. Qwen3-VL technical report, 2025. URL https://arxiv.org/abs/2511.21631.
Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Computer Vision – ECCV 2018, volume 11208 of Lecture Notes in Computer Science, pages 833–851. Springer, 2018. doi: 10.1007/978-3-030-01234-2\49.
Gemma Team. Gemma 4 technical report, 2026. URL https://arxiv.org/abs/2607.02770.
Google Cloud. Cloud Vision API. https://cloud.google.com/vision/docs, 2024.
Mohit Gupta, Chialing Wei, Thomas Czerniawski, and Ricardo Eiris. PIDQA—question answering on piping and instrumentation diagrams. Machine Learning and Knowledge Extraction, 7(2):39, 2025. doi: 10.3390/make7020039.
Drew A. Hudson and Christopher D. Manning. GQA: A new dataset for real-world visual reasoning and compositional question answering. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 6693–6702, 2019. doi: 10.1109/CVPR.2019.00686.
Glenn Jocher, Ayush Chaurasia, and Jing Qiu. Ultralytics YOLO. https://github.com/ultralytics/ultralytics, 2023. Software; YOLO11 used in this work.
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1988–1997, 2017. doi: 10.1109/CVPR.2017.215.
Minghao Li, Tengchao Lv, Jingye Chen, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, and Furu Wei. TrOCR: Transformer-based optical character recognition with pre-trained models. Proceedings of the AAAI Conference on Artificial Intelligence, 37(11):13094–13102, 2023. doi: 10.1609/aaai.v37i11.26538.
Pan Lu, Swaroop Mishra, Tony Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. In Advances in Neural Information Processing Systems (NeurIPS), volume 35, pages 2507–2521, 2022. doi: 10.52202/068431-0182.
Ahmed Masry, Do Xuan Long, Jia Qing Tan, Shafiq Joty, and Enamul Hoque. ChartQA: A benchmark for question answering about charts with visual and logical reasoning. In Findings of the Association for Computational Linguistics: ACL 2022, pages 2263–2279. Association for Computational Linguistics, 2022. doi: 10.18653/v1/2022.findings-acl.177. URL https://aclanthology.org/2022.findings-acl.177/.
Minesh Mathew, Dimosthenis Karatzas, and C. V. Jawahar. DocVQA: A dataset for VQA on document images. In IEEE Winter Conference on Applications of Computer Vision (WACV), pages 2199–2208, 2021. doi: 10.1109/WACV48630.2021.00225.
Microsoft. Azure AI document intelligence. https://learn.microsoft.com/azure/ai-services/document-intelligence/, 2024.
Shubham Paliwal, Arushi Jain, Monika Sharma, and Lovekesh Vig. Digitize-PID: Automatic digitization of piping and instrumentation diagrams. In Trends and Applications in Knowledge Discovery and Data Mining, volume 12705 of Lecture Notes in Computer Science, pages 168–180. Springer, 2021. doi: 10.1007/978-3-030-75015-2\17.
Rohit Rahul, Shubham Paliwal, Monika Sharma, and Lovekesh Vig. Automatic information extraction from piping and instrumentation diagrams. In Proceedings of the 8th International Conference on Pattern Recognition Applications and Methods (ICPRAM), pages 163–172. SciTePress, 2019. doi: 10.5220/0007376401630172.
Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, and Christoph Feichtenhofer. SAM 2: Segment anything in images and videos. In International Conference on Learning Representations (ICLR), 2025. URL https://proceedings.iclr.cc/paper_files/paper/2025/hash/45c1f6a8cbf2da59ebf2c802b4f742cd-Abstract-Conference.html. arXiv:2408.00714.
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assisted Intervention (MICCAI), volume 9351 of Lecture Notes in Computer Science, pages 234–241. Springer, 2015. doi: 10.1007/978-3-319-24574-4\28.
Sagar Srinivas Sakhinana, Geethan Sannidhi, and Venkataramana Runkana. Towards human-level understanding of complex process engineering schematics: A pedagogical, introspective multi-agent framework for open-domain question answering, 2024. URL https://arxiv.org/abs/2409.00082.
Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems (NeurIPS), volume 36, pages 68539–68551, 2023. doi: 10.52202/075280-2997.
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. ReAct: Synergizing reasoning and acting in language models. In International Conference on Learning Representations (ICLR), 2023. URL https://openreview.net/forum?id=WE_vluYUL-X. arXiv:2210.03629.
A Technical Details and Supplementary Results
A.1 Graph construction
Perception recovers symbols, solid/dashed line masks, and OCR tags in a shared sheet frame. A fixed construction order then turns those outputs into the typed evidence graph (Figure 4). Solid arrows in that figure are geometric transforms; dashed arrows show where each perception stream may enter. Edges are not created by a learned module alone.

Figure 4: Unified perception-to-graph pipeline. Learned outputs stay in sheet coordinates and enter only at their grounding ports. The solid construction path is deterministic: no learned module can invent an edge alone.
A sheet becomes a graph by a deterministic first-symbol walk on a chosen ink layer. On the solid process layer, intersection noding (Figure 6) has already split crossing runs, so tee branches enter the walk sharing exact endpoints.
-
Keep solid segments for process connections or dashed-only segments for signal edges.
-
Cluster segment endpoints into junctions: endpoints within pixels merge (single-link closure). Here is the per-sheet adaptive radius (Figure 7), not a global constant, and the solid and dashed layers each compute their own.
-
Attach each symbol to one junction. The oracle process graph uses Digitize ground truth connectivity; the recovered process graph and every signal layer attach to the nearest segment within a fixed 120px of the symbol center.
-
Walk through empty junctions only. When the walk first reaches an occupied junction, emit edges to symbols there and stop; symbols on the same junction form a clique.
Two symbols are adjacent only under this walk, not from page proximity or fly-over crossings without a shared junction (Figure 5).

Figure 5: First-symbol linker walk. Traversal passes through empty scaffold junctions and emits an edge only when the first occupied junction on the selected continuation is reached. Spatial nearness or bounding-box overlap alone never creates a graph edge.
Solid process extras. Intersection noding splits or trims solid polylines that cross at tees and corners so branches share exact endpoints (Figure 6).

Figure 6: Intersection noding inserts an exact shared coordinate at a true tee intersection. Crossings classified as fly-overs, and crossings without a nearby terminating tip, remain separate so that the recovered topology is not artificially connected.
Adaptive junction snap sets per-sheet px with the median solid-segment length and the median tip nearest-neighbor gap (Figure 7). Fixed 10 px snap on predicted solids collapses exact edge to 0.193.

Figure 7: Adaptive snapping merges endpoints within the sheet-dependent tolerance . The capped tolerance limits both under-merging and over-merging.
Signal-edge layer. Gold signal edges use ground-truth dashed segments with fixed px. Predicted signal reuses process edges and builds dashed edges from U-Net dashed masks. Adaptive dashed uses px on predicted dashed polylines only. On test sheets the oracle dual-layer corpus averages 337.6 process edges and 31.4 signal edges per sheet;
about 20% of symbols attach to dashed ink and 7.2 undirected pairs appear in both layers. Attributed micro- with typed edges is 0.802 (adaptive predicted signal) and 0.794 (predicted fixed j=10).
Tag association. Word boxes link to symbols and lines by containment, overlap, and proximity, then line-seed propagation along the segment graph (same_line_type_only). Word NMS at IoU 0.35 runs before association.
A.2 Metric definitions
Unless noted, TP/FP/FN counts are micro-pooled over all 100 test sheets before Eqs. (1). Boxes match greedily: sort candidate pairs by descending IoU and take a disjoint matching with
OCR. Let be the set of IoU-matched word pairs under Eq. (2). Detection scores geometry only (matched pairs are TP; unmatched predictions FP; unmatched GT FN). Joint additionally requires normalized string equality on the pair. Among matched pairs only,
(lower CER is better). Symbol-tag and line-tag use the same string test on tags linked to matched symbols or line ids; combined tag is the unweighted mean of those two layer scores.
Symbol detection. Class-aware counts a TP only when Eq. (2) holds and class labels agree; class-agnostic uses geometry alone. Then Eqs. (1) apply. Headline Digitize scores use the class-aware form; API comparisons in Appendix A.8 use the class-agnostic form. Table 5 reports the same precision/recall/ on full-sheet stitched boxes after NMS.
Edges. After class-aware symbol matching , let and be undirected process-connection pairs. Exact edge scoring maps each predicted pair through ; a mapped pair is TP if it lies in and is unused, otherwise FP; unmatched or collapsed endpoints count as FP; . Counts are micro-pooled, then Eqs. (1) yield exact edge .
Connectivity-consistency scores reachability rather than one-hop identity. With adjacency graphs on matched GT indices,
then , , and the sheet score is the harmonic mean of and . We report the mean over sheets. Any connecting path suffices, so the score can stay high when local wiring is wrong; exact edge remains the stricter topology metric.
Attributed micro- . Each sheet contributes four fact layers: matched nodes, exact process edges, symbol-tags, and line-tags. Summing TP/FP/FN over layers and sheets and applying Eqs. (1) yields the headline attributed score (0.801). The optional signal-edge layer can extend this pool with typed signal edges (0.802 with adaptive predicted signal).
Line pixels. GT polylines rasterize to a thin mask and the prediction to . With , , (counts pooled over sheets),
Channel-wise solid/dashed scores use the same formulas on each channel.
Dashed coverage. GT dashed ink is stored in short chunks; predicted vectorization emits longer segments. Coverage at tolerance px uses many-to-one matching of chunks to segments (reported 0.993), then Eqs. (1).
TopoPID-VQA booleans. On boolean items only, TP = pred true and gold true; FP = pred true, gold false; FN = pred false, gold true; Eqs. (1) follow with positive class true.
A.3 Perception module scores
All three perception heads are trained on Digitize-PID [Paliwal et al., 2021] only (500 full-sheet rasters, 32 symbol classes, solid and dashed ink, word boxes). We use an explicit training / validation / test split of 350 / 50 / 100 sheets (seed 0). The publisher's 400-sheet train folder is split into the 350-sheet training set (parameter updates) and the 50-sheet validation set (early stopping). The publisher's 100-sheet val folder is our held-out test set: every score in this subsection, and every and TopoPID-VQA number in the main paper, is reported on test only. Training and validation never see test sheets; test is never used to pick weights or graph knobs. Training and GPU inference used paired 16 GB accelerators.
Symbols. The reported detector is YOLO11s, initialized from the COCO checkpoint and trained for 50 epochs on 50%-overlap tiles at (batch 32, SGD with Ultralytics' default peak LR, weight decay , 3-epoch warmup, AMP, patience 15, seed 0). Letterbox YOLO11s / YOLOv10n and RT-DETR-L in Table 4 use the same split, epoch budget, and seed; only architecture and letterbox vs. tiles change. At test time the tiled YOLO11s run is stitched on full sheets with 20% overlap; Table 5 varies NMS IoU, and IoU 0.10 is the operating point used for .
Lines. Solid and dashed masks come from a two-channel U-Net with an ImageNet EfficientNet-B0 encoder (MobileNetV2 is the ablation row). Training uses tiles with 25% overlap, batch 4, AdamW at with cosine decay, BCE+Dice per channel, AMP, 50 epochs, and seed 0. Empty tiles are mostly dropped (minimum mask area 40). Inference is overlapping tiles on the native-resolution sheet; vectorization is a later CPU step, not part of this training loop. Table 6 reports both encoders.
Text. Word boxes are predicted by YOLO11n fine-tuned for 15 epochs on 800 px patches (batch 16, 25% train overlap) from the same training/validation split (350/50). Strings are read by microsoft/trocr-base-printed fine-tuned for 15 epochs on ground-truth word crops (batch 32, AdamW , encoder frozen, AMP). Table 7 also reports detection-only YOLO-text and TrOCR on GT crops (pretrained vs. fine-tuned) so box error and recognition error can be separated. The stack uses YOLO-text boxes with the fine-tuned TrOCR head on diagram crops.
Table 4: Symbol detector zoo (Digitize-PID test set, 100 sheets).
| Model | Mode | P | R | mAP50 | mAP50–95 |
|---|---|---|---|---|---|
| Ours (YOLO11s) | tiles | 0.992 | 0.982 | 0.994 | 0.987 |
| YOLOv10n | tiles | 0.989 | 0.979 | 0.994 | 0.983 |
| RT-DETR-L | letterbox | 0.838 | 0.845 | 0.883 | 0.677 |
| YOLO11s | letterbox | 0.784 | 0.783 | 0.824 | 0.613 |
| YOLOv10n | letterbox | 0.291 | 0.488 | 0.281 | 0.180 |
Table 5: Ours (YOLO11s): full-sheet stitch (tiles, 20% overlap, test set). , , and Det. follow Eqs. (1) after greedy box matching at IoU (Appendix A.2).
| NMS IoU | P | R | Det. |
|---|---|---|---|
| 0.50 | 0.810 | 1.000 | 0.895 |
| 0.20 | 0.925 | 0.999 | 0.961 |
| 0.10 | 0.969 | 0.998 | 0.983 |
Table 6: Line U-Net pixel scores (test set, 100 sheets).
| Backbone | Dice | IoU | Dice | Dice | IoU | IoU |
|---|---|---|---|---|---|---|
| Ours (EffNet-B0) | 0.982 | 0.966 | 0.983 | 0.971 | 0.968 | 0.946 |
| MobileNetV2 | 0.980 | 0.961 | 0.981 | 0.969 | 0.963 | 0.942 |
Table 7: Text detection and OCR (test set, 100 sheets).
| Setting | P | R | Det. F | Exact | CER |
|---|---|---|---|---|---|
| YOLO-text (det.) | 0.712 | 0.999 | 0.831 | — | — |
| + pretrained TrOCR (GT crops) | — | — | — | 0.857 | 0.031 |
| Finetuned TrOCR (GT crops) | — | — | — | 0.995 | 0.001 |
| Ours (YOLO-text + finetuned TrOCR) | 0.772 | 0.906 | 0.833 | — | — |
A.4 VLM decoding and run protocol
All reported TopoPID-VQA numbers use a single greedy decode per VLM call (do_sample=False; no temperature, top-p, or top-k). Each question is evaluated once; we do not average multiple samples. Generation budgets: 96 new tokens for entity extraction, 256–512 for planner turns (medium/hard use the higher cap), and 64 for optional vision crops. Image-only answers use a 64-token budget. Qwen3-VL-4B-Instruct and Qwen3-VL-8B-Instruct load in 4-bit NF4 (bitsandbytes double quant, fp16 compute) with a capped visual-token budget ( pixels) and long-side crops of 336 px for grounding / 1024 px for image-only sheets. Gemma-4-E4B-it uses the public W4A16 QAT checkpoint. Hub revisions are the instruct/it weights named in Section 5.3 as pulled at run time (no alternate snapshots). Planner and entity system prompts are fixed strings shared across models (Appendix A.9); they were not returned on TopoPID-VQA items. Contract rejects of a final answer trigger at most one forced re-ask for a legal typed JSON answer; transient GPU out-of-memory triggers at most one generate retry.
A.5 Bootstrap CI protocol
Table 1 reports sheet-clustered percentile bootstrap 95% confidence intervals on TopoPID-VQA exact-match accuracy. For each model, difficulty tier, and condition we load per-question correct/incorrect flags from the TopoPID-VQA prediction dumps used for Table 1 (each row includes a sheet id). Harness rows exclude gold-query-ceiling runs. Image-only and harness answers are aligned by question id.
- Resampling. Sheets with replacement (). All questions on a drawn sheet are kept together (10 per tier; 30 for pooled easy+medium+hard). Score CIs resample each condition independently. Difference CIs form on shared question ids, then average those deltas inside the same sheet multiset.
- Why sheets. Questions on one sheet share graph-recovery error, so question-level Bernoulli resampling understates variance.
- Settings. sheet resamples, seed 0, percentile two-sided 95% CI. Tables show mean half-width of that interval.
- Significance. At we claim a gain only when the paired CI for mean excludes zero—not from non-overlapping score CIs alone. All easy/medium/hard/pooled paired intervals in Table 1 exclude zero.
A.6 Topology overclaim proxy
As a cheap faithfulness check that needs no new VLM runs, we measure a fabricated-true rate on topology-related boolean questions with gold answer false: the fraction predicted true. Categories: spatial_connections, structural, topology, reachability, isolation, negation, constrained_routing, spatial_topology ( pooled). Lower is better. Among incorrect harness answers, the share with nonempty evidence_ids (faithful-but-wrong) is 45.8% (Qwen3-VL-4B), 33.4% (Qwen3-VL-8B), and 52.6% (Gemma-4-E4B). Hard-tier image-only fabricated-true for Qwen3-VL-4B is low (5.1%) because that checkpoint often answers false on hard booleans; the metric is an overclaim rate, not overall boolean error. Prefer the pooled row in Table 8.
Table 8: Fabricated-true rate (%) on topology-related booleans with gold false. Lower is better. The centered band under each Img.-Agent pair is the absolute change: ↓ is a beneficial reduction, ↑ a deterioration. Grounding reduces pooled overclaim for all three models.
| Level | Qwen3-VL-4B | Qwen3-VL-8B | Gemma-4-E4B | |||
|---|---|---|---|---|---|---|
| Img. | Agent | Img. | Agent | Img. | Agent | |
| Easy | 49.0↓ 39.0 pp | 10.0 | 21.0↓ 11.3 pp | 9.7 | 33.3↓ 24.3 pp | 9.0 |
| Medium | 66.7↓ 66.7 pp | 0.0 | 76.5↓ 76.5 pp | 0.0 | 100.0↓ 90.2 pp | 9.8 |
| Hard | 5.1↑ 29.0 pp | 34.1 | 70.6↓ 29.8 pp | 40.8 | 52.2↓ 10.2 pp | 42.0 |
| Pooled | 37.0↓ 20.5 pp | 16.5 | 50.8↓ 32.0 pp | 18.8 | 54.5↓ 33.5 pp | 21.0 |
Notes. Boldface marks the lower value in each pair. Teal ↓ bands report Img. – Agent (improvement): light <25 pp, mid [25, 40), strong ≥ 40 pp. Coral ↑ bands report Agent – Img. (deterioration). Changes use the displayed values.
A.7 Graph ablations and compute
Table 9 summarizes construction knock-outs already measured on the Digitize-PID test set. Adaptive junction snap is not optional: fixed on predicted solids collapses exact edge from 0.742 to 0.193. Removing intersection noding costs 1.3 points (0.742→0.729). With ground-truth boxes and lines, topology exact is 1.000 and combined tag is 0.918. With predicted boxes and ground-truth lines, connectivity-consistency is already 0.963. With ground-truth boxes and predicted lines, exact edge is 0.777. Looser symbol NMS (IoU 0.20) gave 0.684 exact / 0.906 connectivity-consistency; IoU 0.10 is used in P&ID Graph Recovery Stack (Ours) (detection 0.983). Word NMS 0.35 yields combined tag 0.798; IoU 0.50 drops it to 0.764. Table 10 gives the wall-clock cost of P&ID Graph Recovery Stack (Ours).
Table 9: Selected graph-construction ablations (existing measurements). Exact edge on recovered process graphs unless noted.
| Setting | Exact edge |
|---|---|
| P&ID Graph Recovery Stack (Ours) | 0.742 |
| Without intersection noding | 0.729 |
| Fixed snap on predicted solids (no adaptive) | 0.193 |
| Predicted boxes + GT lines | 0.777 |
| GT boxes + GT lines (topology) | 1.000 |
| Signal: pred. fixed | 0.610 |
| Signal: pred. adaptive | 0.824 |
Table 10: P&ID Graph Recovery Stack (Ours): wall-clock on 100 test sheets.
| Stage | Device | s/sheet | 100-sheet total |
|---|---|---|---|
| Symbol stitch (YOLO11s) | 2×16 GB GPU | 1.2 | ~2 min |
| Line U-Net (EffNet-B0) | 2×16 GB GPU | 4.6 | ~8 min |
| Text det. + OCR | 2×16 GB GPU | 22.7 | ~38 min |
| Vectorize + graph + tags | CPU | ~4 | minutes |
| Oracle re-score | CPU | 0.03 | ~3 s |
A.8 Cloud baseline detail
Cloud OCR and object APIs, plus zero-shot segmenters, are run on the same 100 test sheets and matching rules as P&ID Graph Recovery Stack (Ours) (Tables 11–15). On diagram text, Azure Read is the closest commercial control (joint 0.779 vs. our 0.810); Textract trails on string accuracy, and GCP Vision floods the crop with detections (385 boxes/sheet) while joint stays at 0.151. General object APIs do not recover P&ID symbols: Azure and GCP return empty lists; Rekognition emits fewer than one box per sheet on average (class-agnostic 0.001) against our tiled detector at 0.961. Off-the-shelf line segmenters likewise fail on solid/dashed ink (SAM 2 AMG Dice 0.012; DeepLab variants near zero) while the finetuned U-Net reaches Dice 0.982. The gap is domain fit, not a matching quirk: stock vision services are not trained for schematic glyphs or thin process lines.
Table 11: Cloud and zero-shot controls on 100 test sheets. The table gives the primary metric for each task.
| Task | System | Primary score |
|---|---|---|
| OCR | Ours (YOLO-text + TrOCR) | Joint 0.810 |
| OCR | Azure Read | Joint 0.779 |
| OCR | AWS Textract | Joint 0.663 |
| OCR | GCP Vision | Joint 0.151 |
| Symbols | Ours (YOLO11s tiles) | Class-agnostic det. 0.961 |
| Symbols | Azure / GCP / AWS | Nil / Nil / 0.001 |
| Lines | Ours (U-Net EffNet-B0) | Dice micro 0.982 |
| Lines | SAM 2 AMG (union) | Dice micro 0.012 |
| Lines | DeepLabV3 (COCO) | Nil |
| Lines | DeepLabV3+ (VOC) | Dice micro 0.0009 |
Table 12: OCR on diagram crop (100 sheets; mean 156.1 GT words per crop).
| System | Det. | Joint | Exact | CER | Pred./sheet |
|---|---|---|---|---|---|
| Ours (YOLO-text + TrOCR) | 0.833 | 0.810 | 0.971 | 0.008 | 183.3 |
| Azure Read | 0.818 | 0.779 | 0.954 | 0.021 | 163.1 |
| AWS Textract | 0.824 | 0.663 | 0.807 | 0.142 | 162.5 |
| GCP Vision | 0.174 | 0.151 | 0.872 | 0.055 | 385.2 |
Table 13: OCR precision and recall (diagram crop).
| System | Det. | Det. | Det. | Joint | Joint | Joint |
|---|---|---|---|---|---|---|
| Ours (YOLO-text + TrOCR) | 0.772 | 0.906 | 0.833 | 0.750 | 0.880 | 0.810 |
| Azure Read | 0.801 | 0.836 | 0.818 | 0.762 | 0.796 | 0.779 |
| AWS Textract | 0.808 | 0.841 | 0.824 | 0.650 | 0.677 | 0.663 |
| GCP Vision | 0.122 | 0.302 | 0.174 | 0.106 | 0.261 | 0.151 |
Table 14: Class-agnostic symbol boxes (diagram crop; mean 118.4 GT symbols per sheet).
| System | Det. | Det. | Det. | Class-aware | Pred./sheet |
|---|---|---|---|---|---|
| Ours (YOLO11s tiles) | 0.925 | 0.999 | 0.961 | 0.961 | 127.76 |
| Azure objects | Nil | Nil | Nil | Nil | Nil |
| GCP Object Localization | Nil | Nil | Nil | Nil | Nil |
| AWS Rekognition | 0.115 | 0.001 | 0.001 | Nil | 0.61 |
Table 15: Line-mask Dice vs. thickness-2 GT polylines (full sheets). Zero-shot rows: long side 1024 px then resize; ours: native-resolution U-Net tiles.
| System | Dice micro | IoU micro | Dice mean | n |
|---|---|---|---|---|
| Ours (U-Net EffNet-B0) | 0.9823 | 0.9658 | 0.9823 | 100 |
| SAM 2 AMG (union) | 0.0121 | 0.0061 | 0.0098 | 100 |
| SAM 2 AMG (elongated) | 0.0005 | 0.0003 | 0.0006 | 100 |
| DeepLabV3 (COCO) | Nil | Nil | Nil | 100 |
| DeepLabV3+ (VOC) | 0.0009 | 0.0004 | 0.0003 | 100 |
A.9 Grounded Inference Details
TopoPID-VQA Table 1 reports Graph-Grounded Harness (Ours) over the . At prediction time the system receives the marked diagram, the English question, and ; it does not receive , gold mark ids, or a question-family label. The following sections specify the planner, grounding rules, answer contract, and graph interface.
VLM planner. A VLM planner may call seven fact-returning graph tools from a fixed library, receives structured tool results, and iterates until it emits a final answer or exhausts a six-turn budget (at least one tool call required before the answer is accepted). Tools return graph facts only; counting, comparison, thresholding, and routing logic are performed in the model's chain-of-thought. Planning is type-agnostic: the model is not told which question family it faces. Marks and tags are linked once on ; the planner then issues operators (at most six turns; at least one before FINAL). Unsupported candidates are pushed back by the answer-contract check (Figure 8).

Figure 8: Graph-grounded harness and planner loop. Question entities are grounded once on ; the planner composes operators over returned facts. Missing evidence starts another turn (cap six). Unsupported answers are pushed back by the answer contract. FINAL requires at least one operator call plus a passing evidence check.
Grounding and answer contract. Grounding. Colored mark letters are detected on the raster (crimson A, blue B, green C) and snapped to nearest symbol nodes. Tag strings mentioned in the question are linked to nodes via OCR tags on , with optional VLM crops when several nodes share a tag. Answer contract. The final message uses a fixed schema: a short interpretation, references to the tool steps used, the supporting graph entities, and a typed answer. Integers are clamped to ranges parsed from the question; strings are snapped to enumerated options. Role split. Qwen3-VL-4B, Qwen3-VL-8B, and Gemma-4-E4B plan in text over tool traces. Vision is used only for entity extraction, tag disambiguation, and mark grounding—not for inferring process connectivity from pipe ink.
Graph tool interface. Table 16 lists the seven primitives with arguments and return semantics. All topology reads come from adjacency. Breadth-first traversal returns hop distances (and optional target restrictions); the model interprets reachability, within-, and bucket labels. Edge check is the only tool that returns a boolean verdict. The planner does not receive serialized subgraph dumps; every fact is fetched through typed tools and recorded in a structured trace. Each tool result gets an identifier that the final answer must cite. A seed-listing helper bootstraps grounded mark/tag labels before the first planner turn and is not counted among the seven tools.
Table 16: Graph-Grounded Harness (Ours) tool library: seven fact-returning primitives on (arguments and return semantics).
| Group | Tool | Arguments | Behavior |
|---|---|---|---|
| Nodes | node_info | {id} | Class name, OCR tag, degree, and sheet coordinates for one node. |
| neighbors | {id} | One-hop neighbor ids with class, tag, degree, and coordinates. | |
| Search | find_nodes | {attr, match, value} | All node ids whose class or tag matches value (equals or case-insensitive prefix), with count and a compact attribute table. |
| Paths | bfs | {id, ids?, exclude_ids?, max_hops?} | Hop distances from id; optional ids restricts the returned map. Unreachable targets receive null. |
| shortest_path | {a, b, exclude_ids?} | Shortest node path a..b (inclusive), or null if none. Optional exclude_ids are not traversed. | |
| edge_exists | {a, b} | Boolean: true iff an undirected process-connection edge is present in . | |
| Sets | set_op | {op, a[], b[]} | Set algebra on id lists: intersect, union, or diff. |
A.10 TopoPID-VQA question generation
Gold answers never pass through a language model. Construction is:
-
Sheets. Digitize-PID test partition, seed 0 (100 sheets), the same split used for perception reporting.
-
Oracle graph . Ground-truth boxes, Digitize ground truth connectivity, and ground-truth tags. Every gold answer is computed on alone.
-
Family sampling. Typed candidates are drawn from under a fixed catalog of 28 question families (8 easy, 10 medium, 10 hard). After validation each sheet keeps 10 easy, 10 medium, and 10 hard items.
-
Stems. Deterministic English stems with slots for marks and tags (for example, "Are marks A and B directly connected by a process line?").
-
Wording. The released suite uses those stems as written (template wording; no paraphrase stage on the frozen set).
-
Freeze. Each kept item ships with a marked-sheet crop for visual reference.
-
Inference vs. scoring. , mark-to-node maps, and family labels are scoring-only. At answer time the harness sees the marked image, the English question, and recovered , and must resolve entities through tools.
A.11 TopoPID-VQA benchmark families
Tables 17–19 list every family with its answer type and question stem.
Easy (8 families, 100 items each). 600 booleans + 400 integers. Categories: spatial_connections (300), simple_counting (400), structural (300).
Table 17: Easy TopoPID-VQA question families.
| Family | Ans. | Example |
|---|---|---|
| connected_process | bool | Are marks A and B directly connected by a process line? |
| connection_exists_tag | bool | Is symbol MN-46505 directly connected to symbol RO-10 181? |
| tag_connected_to_mark | bool | Is symbol CS-25 directly connected to mark A? |
| share_neighbor | bool | Do marks A and B share a common directly connected neighbor? |
| has_same_class_neighbor | bool | Does mark A connect to a same-type neighbor? |
| is_branch | bool | Is mark A a branch point (≥ 3 direct connections)? |
| count_same_class_neighbors | int | How many neighbors of mark A share A's component type? |
| count_common_neighbors | int | How many symbols connect to both A and B? |
Medium (10 families). 699 booleans, 201 closed strings, 100 integers in [0, 4]. Categories: reachability, tag_reasoning, topology, type_search.
Table 18: Medium TopoPID-VQA question families.
| Family | Ans. | Example |
|---|---|---|
| reachable_within_k | bool | Is B reachable from A in ≤ 3 connections? |
| same_network | bool | Are A and B on the same connected network? |
| same_type_neighbors_at_least_n | bool | Does A have ≥ 1 same-type neighbor? |
| exists_type_within_k | bool | Within 2 hops of A, any symbol of B's type? |
| shared_junction_within_k | bool | A symbol within 2 hops of both A and B? |
| route_via_tag_family | bool | Route A→B in ≤ 4 hops through a tag family? |
| at_least_n_types | bool | ≥ 8 distinct component types on A's neighbors? |
| nearest_option_by_hops | tag | Closest to A among four named symbols? |
| busier_junction | A/B | Which mark has more direct connections? |
| count_options_same_type | 0–4 | How many of four named symbols match A's type? |
Hard (10 families). 699 booleans, 200 strings, 101 integers. Eight categories including constrained_routing, isolation, quantifier.
Table 19: Hard TopoPID-VQA question families.
| Family | Ans. | Example |
|---|---|---|
| more_options_near_a | bool | More named symbols within 3 hops of A than of B? |
| path_avoiding_type | bool | Can A reach B while bypassing C's component class? |
| counterfactual_reconnect | bool | If A were removed, would B still connect to C? |
| route_comparison | bool | Is A closer to C than B is (hop count)? |
| multi_constraint_option | tag | Tag near A and same type as B (4 options)? |
| all_prefix_in_network | bool | All AB-* tags on same network as A? |
| no_prefix_neighbor | bool | No ST-* symbol directly connected to A? |
| count_options_within_k | 0–4 | How many of four symbols within 4 hops of A? |
| distance_bucket | bucket | Shortest-route distance bucket between A and B? |
| region_neighbor_exists | bool | Any neighbor of A in the top-right region? |
A.12 TopoPID-VQA answer distributions and chance baselines
Table 20 gives the answer-type mix and Table 21 the majority-class and random-choice floors that every reported accuracy must clear. Majority: always predict the most common gold label of that type (e.g. always false for booleans, always 0 for integers), then micro-average across types. Random: pick uniformly from the observed label set of that type (expected accuracy 1/|ℱ|).
Table 20: TopoPID-VQA answer-type counts (exact-match scoring).
| Level | Boolean | Integer | String | Total |
|---|---|---|---|---|
| Easy | 600 | 400 | 0 | 1000 |
| Medium | 699 | 100 | 201 | 1000 |
| Hard | 699 | 101 | 200 | 1000 |
| Pooled | 1998 | 601 | 401 | 3000 |
Table 21: Chance baselines (% exact match). Majority always predicts the most frequent gold label within each answer type, then micro-averages. Random draws uniformly from the observed label set of that answer type (expected accuracy 1/|ℱ_type|).
| Split | Majority (by answer type) | Random (by answer type) |
|---|---|---|
| Easy | 64.8 | 35.0 |
| Medium | 42.4 | 37.2 |
| Hard | 39.7 | 37.2 |
| Pooled | 48.1 | 35.6 |
Pooled label modes: boolean majority 50.3% (false), random 50.0% (n=1998); integer majority 64.7% (mode 0), random 11.1% over nine values (n=601); string majority 12.7% (mode A), random 0.5% over 202 values (n=401). Easy majority is pulled up by sparse integer counts (many zeros). Medium and hard sit closer to balanced booleans plus harder string options. Image-only pooled accuracy in Table 1 (36.7–41.3%) sits below the majority floor (48.1%) and near the random floor (35.6%): the ungrounded VLMs do not even exploit label frequency, which matches the claim that pixel-only answers invent or miss process connections. The gold-query ceiling on still reaches about 88.9% pooled (Section 5.3), above the grounded harness (74.3–76.0%), so the suite is not solved; the remaining gap tracks substrate error and multi-step tool use.
A.13 TopoPID-VQA template diversity and duplicates
The suite has 28 question families (8 easy, 10 medium, 10 hard). Across 3000 items there are 792 unique question strings after whitespace and case normalization. Many sheets reuse the same stem and the same mark letters (A/B); variation sits in the underlying entities and graphs rather than in lexical paraphrase. Masking mark letters and tag-like tokens leaves about 511 distinct surface forms—a rough upper bound on stem variants. Eighty-four normalized strings appear more than once, while every question identifier is unique (3000/3000). Repeated stems across sheets are expected under a fixed template catalog; they are not duplicate gold instances. The frozen evaluation set uses template stems only.
A.14 TopoPID-VQA prompt and leakage checklist
-
At answer time the harness and the image-only baseline never receive , gold mark-to-node maps, gold graph queries, or a question-family label.
-
System prompts and tool schemas were fixed before the final TopoPID-VQA runs. No TopoPID-VQA questions, stems, or family labels were used to tune those prompts for the accuracies in Table 1.
-
Gold answers are never shown in the planner or vision loop; scoring is offline exact match.
-
The lab-only gold-query ceiling (≈88.9% pooled) receives gold entity maps and family/query structure and answers them on (Section 5.3). It is an upper bound for comparison, not a deployable method.
A.15 TopoPID-VQA accuracy by answer type
Category tables (Appendix A.17) do not show whether gains are boolean-only. Tables 22 and 23 report exact-match accuracy (%) by answer type on the same dumps as Table 1.
Table 22: Pooled TopoPID-VQA exact-match accuracy (%) by answer type. Image-only vs. Graph-Grounded Harness (Ours); gold-query ceiling uses gold entities and query structure on .
| Model | System | Bool | Int | Str |
|---|---|---|---|---|
| Qwen3-VL-4B | Image-only | 50.3 | 9.7 | 34.9 |
| Graph-Grounded Harness (Ours) | 75.3 | 84.7 | 66.8 | |
| Gold-query ceiling | 89.9 | 92.0 | 79.1 | |
| Qwen3-VL-8B | Image-only | 51.2 | 12.6 | 35.2 |
| Graph-Grounded Harness (Ours) | 75.7 | 82.2 | 61.1 | |
| Gold-query ceiling | 89.9 | 92.0 | 79.1 | |
| Gemma-4-E4B | Image-only | 51.9 | 11.0 | 0.0 |
| Graph-Grounded Harness (Ours) | 77.8 | 74.4 | 57.1 | |
| Gold-query ceiling | 89.9 | 92.0 | 79.1 |
Table 23: Per-level exact-match (%) by answer type for Qwen3-VL-4B-Instruct. Easy has no string items.
| Level | System | Bool | Int | Str |
|---|---|---|---|---|
| Easy | Image-only | 52.0 | 4.2 | — |
| Graph-Grounded Harness (Ours) | 87.0 | 83.8 | — | |
| Gold-query ceiling | 90.7 | 89.2 | — | |
| Medium | Image-only | 48.8 | 25.0 | 39.3 |
| Graph-Grounded Harness (Ours) | 77.1 | 91.0 | 77.1 | |
| Gold-query ceiling | 92.0 | 100.0 | 82.1 | |
| Hard | Image-only | 50.4 | 15.8 | 30.5 |
| Graph-Grounded Harness (Ours) | 63.4 | 82.2 | 56.5 | |
| Gold-query ceiling | 87.1 | 95.0 | 76.0 |
Harness gains are not boolean-only: integer accuracy moves from single-digit or low-twenties (image-only) into the 70–90 range, and string accuracy roughly doubles for Qwen3-VL-4B. Hard booleans remain the weakest harness slice (63.4% for 4B), in line with negation, counterfactual, and constrained-routing families. Gold-query ceiling strings (~79% pooled) still miss some items under noise even with perfect queries.
A.16 TopoPID-VQA boolean metrics
Table 24 reports boolean , , and (positive class true) for the same image-only vs. harness runs as Table 1. Harness pooled is 73.3% for Qwen3-VL-4B (image-only 44.7%), 74.9% for Qwen3-VL-8B (52.6%), and 78.2% for Gemma-4-E4B (53.0%). Easy harness is highest for every model; hard image-only recall for Qwen3-VL-4B collapses (4.0%), while the harness recovers to 59.2%.
Table 24: TopoPID-VQA boolean subset for Qwen3-VL-4B-Instruct, Qwen3-VL-8B-Instruct, and Gemma-4-E4B-it: (%), positive class true). Boolean counts: easy 600; medium 699; hard 699; pooled 1998.
| Level | Qwen3-VL-4B | Qwen3-VL-8B | Gemma-4-E4B | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Image-only | |||||||||
| Easy | 52.0 | 53.0 | 52.5 | 57.7 | 28.7 | 38.3 | 53.9 | 39.0 | 45.3 |
| Medium | 48.7 | 66.2 | 56.1 | 50.0 | 69.1 | 58.0 | 50.9 | 69.9 | 59.0 |
| Hard | 51.9 | 4.0 | 7.5 | 49.4 | 62.1 | 55.0 | 50.8 | 52.9 | 51.8 |
| Pooled | 50.1 | 40.4 | 44.7 | 50.8 | 54.4 | 52.6 | 51.5 | 54.6 | 53.0 |
| Graph-Grounded Harness (Ours) | |||||||||
| Easy | 89.4 | 84.0 | 86.6 | 90.1 | 87.7 | 88.9 | 89.5 | 77.0 | 82.8 |
| Medium | 87.8 | 62.4 | 73.0 | 80.8 | 65.6 | 72.4 | 83.6 | 70.8 | 76.7 |
| Hard | 65.0 | 59.2 | 62.0 | 66.9 | 63.2 | 65.0 | 71.6 | 81.3 | 76.2 |
| Pooled | 79.8 | 67.8 | 73.3 | 78.7 | 71.4 | 74.9 | 80.2 | 76.4 | 78.2 |
A.17 TopoPID-VQA per-category accuracy
Tables 25–27 break exact-match accuracy by category. Qwen3-VL-4B matches or slightly exceeds the 8B harness on the pooled set and on easy (85.7 vs. 83.1 in Table 1); Qwen3-VL-8B is strongest on medium; Gemma-4-E4B leads on hard. Family-level gaps can be large even when pooled scores look similar: under the hard hop-distance bucket family, Qwen3-VL-8B harness accuracy is only 15.3% while Qwen3-VL-4B and Gemma-4-E4B reach 71.4% (Tables 26 and 25).
Categories where image-only scores higher. Three of the 42 category cells favor the image-only baseline, all in the hard tier: isolation for Qwen3-VL-4B (50.0 vs. 48.0), constrained routing for Qwen3-VL-8B (50.0 vs. 48.0), and hop-distance buckets for Qwen3-VL-8B (24.5 vs. 15.3). The first two are boolean families where the image-only value is the chance floor itself (boolean majority 50.3%, random 50.0%; Appendix A.12), reached by answering hard booleans with one label—the behavior behind the low hard-tier fabricated-true rate reported for Qwen3-VL-4B in Appendix A.6. The harness instead commits to a tool-derived verdict, and these two families are the ones most exposed to wiring error: each turns on whether one specific path or cut exists, which exact edge 0.742 does not secure even while connectivity-consistency stays at 0.958. The 2 pp shortfall against the coin-flip floor matches the faithful-but-wrong case in Section 6. The bucket cell is the checkpoint-specific tool-use gap noted above (15.3% for Qwen3-VL-8B against 71.4% for the other two checkpoints); both conditions score far below the string floor.
Table 25: TopoPID-VQA exact-match accuracy by category (%) for Qwen3-VL-4B-Instruct.
| Level | Category | Image-only | Graph-Grounded Harness (Ours) |
|---|---|---|---|
| Easy | |||
| simple_counting | 4.2 | 83.8 | |
| spatial_connections | 52.3 | 90.7 | |
| structural | 51.7 | 83.3 | |
| Medium | |||
| reachability | 50.5 | 91.1 | |
| tag_reasoning | 37.8 | 81.1 | |
| topology | 49.0 | 66.3 | |
| type_search | 42.5 | 77.0 | |
| Hard | |||
| comparative_counting | 50.0 | 67.6 | |
| composition | 26.6 | 62.1 | |
| constrained_routing | 50.0 | 68.6 | |
| counting_bucketed | 23.5 | 71.4 | |
| isolation | 50.0 | 48.0 | |
| negation | 50.5 | 70.3 | |
| quantifier | 50.6 | 62.9 | |
| spatial_topology | 51.5 | 57.4 | |
Table 26: TopoPID-VQA exact-match accuracy by category (%) for Qwen3-VL-8B-Instruct.
| Level | Category | Image-only | Graph-Grounded Harness (Ours) |
|---|---|---|---|
| Easy | |||
| simple_counting | 5.8 | 75.0 | |
| spatial_connections | 54.7 | 91.3 | |
| structural | 53.0 | 85.7 | |
| Medium | |||
| reachability | 44.1 | 81.7 | |
| tag_reasoning | 37.3 | 75.6 | |
| topology | 49.5 | 82.2 | |
| type_search | 49.1 | 83.3 | |
| Hard | |||
| comparative_counting | 46.1 | 95.1 | |
| composition | 32.0 | 67.5 | |
| constrained_routing | 50.0 | 48.0 | |
| counting_bucketed | 24.5 | 15.3 | |
| isolation | 50.0 | 65.7 | |
| negation | 50.5 | 83.2 | |
| quantifier | 49.4 | 62.9 | |
| spatial_topology | 50.5 | 54.5 | |
Table 27: TopoPID-VQA exact-match accuracy by category (%) for Gemma-4-E4B-it.
| Level | Category | Image-only | Graph-Grounded Harness (Ours) |
|---|---|---|---|
| Easy | |||
| simple_counting | 5.9 | 80.5 | |
| spatial_connections | 53.8 | 88.0 | |
| structural | 52.4 | 80.0 | |
| Medium | |||
| reachability | 49.5 | 95.0 | |
| tag_reasoning | 22.9 | 62.2 | |
| topology | 24.8 | 70.8 | |
| type_search | 47.1 | 72.4 | |
| Hard | |||
| comparative_counting | 49.0 | 85.3 | |
| composition | 9.9 | 34.5 | |
| constrained_routing | 52.5 | 67.2 | |
| counting_bucketed | 0.0 | 71.4 | |
| isolation | 51.0 | 69.6 | |
| negation | 48.5 | 61.4 | |
| quantifier | 53.9 | 96.6 | |
| spatial_topology | 50.5 | 74.3 | |
A.18 Qualitative overlays
Test sheets 2 and 5 (~7168×4561 native). Overlays use class-colored symbol boxes; process edges are schematic center-to-center process-connection links, not pipe routes. Figures 9–14 follow the pipeline order: raw raster, perception masks and boxes, vectorized geometry, the recovered process graph, the dual-layer graph with signal edges, and a dashed-ink zoom.


Figure 9: Raw Digitize-PID sheets (downscaled for display).


Figure 10: Perception stack: solid/dashed masks, vectorized segments, symbol boxes.


Figure 11: Vectorized line geometry (solid and dashed polylines).


Figure 12: Recovered process graph: process connections on .


Figure 13: Dual-layer graph: process connections (solid) and signal edges (dashed).


Figure 14: Dashed-ink zoom: masks and vectorized dashed segments.