AutoSAM: an Agentic Framework for Automating Input File Generation for the SAM Code with Multi-Modal Retrieval-Augmented Generation¶
🕒 Published (v1): 2026-03-25 18:59 UTC · Source: Arxiv · link
Ask a follow-up
Open an assistant pre-loaded with this paper's context.
💬 Ask ChatGPT✦ Ask Claude
TL;DR¶
AutoSAM is a ReAct-based LLM agent framework that automates the generation of input files for the SAM nuclear thermal-hydraulics code by combining system instructions, multi-modal RAG over solver documentation, and seven specialized tools for parsing PDFs, images, and spreadsheets. The agent extracts simulation parameters from heterogeneous engineering documents into a human-auditable intermediate YAML representation, then synthesizes validated, solver-compatible input decks. Evaluated on four case studies of increasing complexity, it produces runnable SAM models with 100% structured-input utilization and ~88% PDF text extraction.
Problem¶
Constructing valid input files for system-level thermal-hydraulics codes like SAM is a labor-intensive, error-prone bottleneck requiring analysts to manually extract parameters from heterogeneous engineering artifacts (PDFs, P&IDs, spreadsheets, legacy reports) and transcribe them into solver-specific syntax—a process that can consume days to weeks per model. SAM is closed-source and absent from LLM training corpora, making direct LLM application unreliable. Prior automation approaches (OCR, rule-based extraction, GUIs) fail when critical information is fragmented across multi-modal sources or encoded visually in schematics.
Method¶
AutoSAM uses a three-pillar specialization strategy inside a LangChain-orchestrated ReAct agent:
- System instructions: Expert-engineered persistent context encoding SAM's input block structure, modeling conventions, and few-shot examples.
- RAG: SAM's user guide and theory manual embedded into a vector store (static directory); task-specific user documents embedded into a dynamic directory. Both are queried via semantic similarity search at inference time.
- Seven specialized tools divided into:
- Content parsing: Excel reader (tabular design data), text file reader.
- Retrieval: PDF analysis tool (Nougat OCR → vision-LLM figure captioning → chunk embedding → similarity retrieval); image analysis tool (VLM description → embedding → retrieval).
- Instruction passing: Input file creator tool (converts intermediate YAML → SAM input deck via structured LLM prompt); input file validator tool (deterministic syntax + physics checks: block completeness, units, geometry connectivity, boundary conditions).
- Python code execution: general computation.
The document processing workflow is: ingest unstructured docs → extract via tools → produce intermediate YAML (human-in-the-loop checkpoint) → merge with structured inputs → generate SAM input deck → validate.
Key Contributions¶
- End-to-end agentic harness for SAM input generation from raw engineering documentation, including multi-modal sources.
- Multi-modal RAG pipeline integrating Nougat-based scientific text extraction, VLM figure interpretation, semantic embedding, and hybrid static/dynamic retrieval directories.
- Intermediate YAML representation as a deliberate human-in-the-loop checkpoint between document extraction and final solver syntax, aligned with nuclear QA expectations.
- Deterministic input validator combining syntax checks and physics verification (units, geometry connectivity, boundary/initial conditions).
- Four progressive case studies covering single-pipe, multi-physics coupled, parallel-channel core (ABTR), and full primary-loop reconstruction (MSRE).
Results¶
- 100% utilization of structured (Excel/spreadsheet) inputs across all cases.
- ~88% parameter extraction rate from PDF text sources.
- 100% completeness in vision-based geometric extraction from figures/schematics.
- All four case studies produced runnable SAM models whose outputs are consistent with expected thermal-hydraulic behavior.
- Agent explicitly flags missing data and labels assumed values, preserving traceability.
- Cases: (i) single-pipe steady-state, (ii) solid-fuel channel with temperature-reactivity feedback, (iii) ABTR reactor core (multi-modal, parallel-channel), (iv) MSRE primary loop (full-loop topology reconstruction from heterogeneous sources).
Limitations¶
- Nougat model cannot extract information embedded inside PDF figures; a separate VLM pass is required, adding pipeline complexity and potential description quality variance.
- System instructions are constrained by the LLM context window; only the most essential SAM conventions are included, and performance degrades for constructs not covered.
- The agent may hallucinate or apply incorrect engineering judgment when data is absent; assumed values are labeled but not independently verified.
- Evaluation is limited to four SAM-specific cases; generalizability to other system codes (RELAP, TRACE, CATHARE) is not demonstrated.
- No quantitative error analysis on the physics fidelity of generated files beyond "consistent with expected behavior"—no reference simulation comparisons with numerical metrics are reported in the provided text.
- Framework depends on a closed-source, licensed code (SAM), limiting reproducibility.
Relevance to Harnesses / Meta-Harnesses¶
AutoSAM is a domain-specific simulation harness: it wraps a ReAct LLM agent with a structured tool registry, a dual-mode RAG knowledge layer, and a deterministic validation stage to automate a complex, multi-step engineering workflow end-to-end. The intermediate YAML checkpoint is a canonical harness pattern—separating extraction from generation, enabling human intervention, and enforcing a typed intermediate representation before downstream code synthesis. The static/dynamic RAG directory split mirrors how meta-harnesses manage reusable vs. task-specific knowledge. AutoSAM directly extends the AutoFLUKA precedent (Monte Carlo input generation) and illustrates a replicable harness template: (system instructions + RAG + tool suite + intermediate IR + validator) applicable to any solver-specific automation task.