AutoSAM: an Agentic Framework for Automating Input File Generation for the SAM Code with Multi-Modal Retrieval-Augmented Generation

AutoSAM is an agentic framework that automates the generation of System Analysis Module (SAM) input files for advanced reactor design by integrating multi-modal retrieval-augmented generation to extract and synthesize simulation parameters from heterogeneous engineering documents, achieving high accuracy across diverse thermal-hydraulic case studies.

Zaid Abulawi (Department of Nuclear Engineering, Texas A&M University, Nuclear Science and Engineering Division, Argonne National Laboratory), Zavier Ndum Ndum (Department of Nuclear Engineering, Texas A&M University, Nuclear Science and Engineering Division, Argonne National Laboratory), Eric Cervi (Nuclear Science and Engineering Division, Argonne National Laboratory), Rui Hu (Nuclear Science and Engineering Division, Argonne National Laboratory), Yang Liu (Department of Nuclear Engineering, Texas A&M University)

Published 2026-03-27
📖 5 min read🧠 Deep dive

Imagine you are a master chef trying to recreate a complex, famous dish from a recipe book. But here's the catch: the recipe isn't written in a single, clear cookbook. Instead, the ingredients are scattered across:

  • A blurry photo of the finished dish on a napkin.
  • A handwritten note on a sticky pad.
  • A spreadsheet with numbers that don't quite match the photo.
  • A technical manual written in a language you only half-understand.

To cook the dish, you have to manually read all these different sources, figure out what the chef actually meant, write down a perfect, step-by-step list of instructions, and then translate that into the specific language your oven understands. If you make a tiny mistake in the translation, the oven might explode, or the food might be inedible.

This is exactly the problem nuclear engineers face.

They need to build computer simulations of nuclear reactors to ensure they are safe. But to do this, they have to manually dig through piles of messy engineering documents (PDFs, diagrams, spreadsheets) and type out thousands of lines of code for a specific computer program called SAM. It's slow, boring, and prone to human error.

Enter AutoSAM: The "Super Sous-Chef"

The paper introduces AutoSAM, an AI agent (a smart computer assistant) designed to be the ultimate "sous-chef" for these engineers. Instead of the engineer doing all the digging and typing, AutoSAM does the heavy lifting.

Here is how it works, using simple metaphors:

1. The "Multilingual Librarian" (Multi-Modal Retrieval)

Usually, AI is like a student who only reads text. If you show it a picture of a pipe, it might be confused. AutoSAM is different. It has eyes and a brain.

  • It can read a PDF report (text).
  • It can look at a diagram (image) and understand that a circle represents a pump and a line represents a pipe.
  • It can open an Excel sheet and see the numbers.
  • It acts like a librarian who can instantly find the right page in a book, look at a picture on that page, and tell you exactly what the numbers mean, all at the same time.

2. The "Rulebook Expert" (Retrieval-Augmented Generation)

AI often "hallucinates" (makes things up) because it doesn't know the specific rules of nuclear physics. AutoSAM doesn't guess.

  • It has a digital copy of the SAM User Manual right next to it.
  • Before it writes a single line of code, it asks the manual: "How do I tell the computer to set the temperature?"
  • It uses Retrieval-Augmented Generation (RAG), which is like having a cheat sheet that it constantly checks to ensure it's following the exact rules of the game.

3. The "Safety Inspector" (The Human-in-the-Loop)

This is the most important part. AutoSAM is smart, but it's not allowed to just hit "Run" on a nuclear simulation by itself.

  • Step 1: AutoSAM reads the messy documents and creates a clean, organized "shopping list" (an intermediate file).
  • Step 2: A human engineer looks at this list. They say, "Yes, that pipe looks right, but you missed the pressure valve. Let me fix that."
  • Step 3: Once the human approves the list, AutoSAM translates it into the final, complex code the computer needs.

This ensures that a human is always the final boss, checking the work before anything dangerous happens.

The "Test Drive" Results

The authors tested AutoSAM on four different "recipes," getting harder each time:

  1. The Simple Pipe: Just a straight pipe. AutoSAM got it right 100% of the time using a spreadsheet.
  2. The Hot Fuel Rod: A pipe with a fuel rod inside that gets hot. AutoSAM handled the complex physics correctly.
  3. The Reactor Core (ABTR): A complex system with five parallel pipes. AutoSAM had to read a diagram and a PDF to figure out how they connected. It did this perfectly, even inferring missing details.
  4. The Full Loop (MSRE): A giant, circulating loop with pumps and heat exchangers. AutoSAM reconstructed the entire system from a messy drawing and a report, creating a working simulation.

Why This Matters

Before AutoSAM, building a reactor simulation was like building a house by hand, brick by brick, while reading a blueprint written in a foreign language. It took weeks.

With AutoSAM, it's like having a robot that can read the blueprint, understand the foreign language, gather the bricks, and lay them out for you. You just have to walk through and say, "That wall looks good, but move the door here."

The Bottom Line:
AutoSAM doesn't replace the nuclear engineer. Instead, it frees them from the boring, error-prone task of typing data. It lets them focus on the thinking and the safety, while the AI handles the typing and the searching. It turns "modeling" into "prompting"—you tell the AI what you want, and it builds the foundation for you.