Fermi-LLM

Documentation

← Back to app

How Fermi-LLM works

You describe a Fermi-LAT analysis in plain English. Fermi-LLM writes the FermiPy configuration and Python script, checks them, runs them on LAT data, and shows you the results. You can then continue from that analysis with follow-up tasks, without starting over.

Who does each step: Model the language model you picked Code the app's own rules and FermiPy

You write a request

For example: “SED of Mrk 421 over the last two years, 100 MeV to 500 GeV.” Guided can write it for you from a few choices, and Examples fill in a ready one.

Or plan it first in Discuss

A model talks the analysis over with you and checks the plan against the catalogs and the data on disk. Press Draft and it sends the request to the Master Agent, then checks the files that come back against the plan. With files already drafted, Discuss sends only the changes you agreed on.

Master Agent

runs on every message you send
  1. 1Read the request CodeModel Finds the source and notes the products, energies and times you asked for.

    The app looks up the source you name in the 4FGL-DR4 catalog, by its common name (Mrk 421, 3C 279), its association or its 4FGL designation. It never substitutes a different source: if the name is not found, the analysis does not run. A source outside 4FGL needs its RA and Dec in your message.

    With the models that support it, the language model also returns a structured reading of the request. That reading then takes precedence over the app's rule-based one.

  2. 2Draft the files Model Writes the FermiPy YAML configuration and analysis.py.

    The model you picked in the Models menu writes both files. It is given FermiPy's configuration schema, worked examples, today's date and the time span of the data on disk.

    In a follow-up it also gets your current files and the outcome of the last run, so it edits them instead of starting over.

  3. 3Apply the app's rules Code Corrects the draft where it departs from your words or from standard practice.

    Fixed rules check the draft against what you wrote. Among them:

    • the target stays the source you named;
    • dates, UTC times, MJD and MET are converted to mission time by the app, not by the model;
    • the FSSC event-selection recommendations: the IRFs and isotropic template follow the event class, and the zenith cut follows the minimum energy unless you set one;
    • the products you asked for are added and the ones you removed are dropped;
    • sources you asked to keep fixed stay fixed, and priors are written as you stated them.

    Whenever the result departs from your words (an energy raised to what the diffuse models allow, a time range cut to the data), a note under the reply says so.

  4. 4Continue or start over Code A follow-up continues from the model the previous task saved.

    After a run, a follow-up keeps only the new steps and loads the saved model instead of setting up and fitting again, unless you ask for a refit.

    A follow-up that changes the data selection, binning or model setup cannot continue a saved model. The app asks whether to start a new chain in this session, move it to a new session, or discard it.

The files appear in the YAML and Python panels. If they would replace files you already have, you see the change as a diff and choose Apply changes or Discard.

Validation Agent

runs when you press Validate
  1. 1Repair the YAML Code Fixes what is safe to fix; refuses YAML that does not parse.

    A section indented by mistake is moved back. YAML that still does not parse is refused, with its line and column.

    Fixed repairs then match the IRFs and the isotropic template to the event class, correct source names, cut the time range to the data on disk and give a source with no position its catalog position.

  2. 2Check the script Code Safety, FermiPy usage and consistency. Errors here block the run.

    analysis.py runs as written, so it is checked first:

    • only allowed imports and calls;
    • FermiPy methods and options that exist in the installed FermiPy;
    • setup before fit, and fit before products;
    • agreement with the YAML and with the event-selection rules.

    Each error is listed, and Run Pipeline stays unavailable until the files pass.

  3. 3Review against your request Model Does the script do what every message of this task asked?

    The session's model reads the script against every message of the current task and reports what is missing or wrong, with a revised script when needed. Its findings never block a run: they come as a proposed change, shown as a diff, that you accept or decline.

    If the model cannot be reached, keyword checks are used instead. The decision is remembered for those exact files, so validating them again does not ask the model again.

The button becomes Run Pipeline and runs exactly the files that were reviewed. Before starting, the app estimates the run time: it asks you to confirm a long run, refuses one over the limit, and offers the queue when every run slot is busy.

Run

the reviewed files, in a sandboxCode

Pre-flight

The YAML parses and FermiPy builds the analysis (GTAnalysis).

Setup

gta.setup() on the LAT data, or gta.load_roi() when the task continues a saved model.

Fit

gta.optimize() and gta.fit(), then checks the target's TS and its flux against 4FGL-DR4.

Products

SED, light curve, maps and the rest, each checked: bins as asked, usable fluxes and upper limits.

Green: done.

Yellow: a product was flagged; the run still succeeded.

Red: an error stopped the run here.

The script runs without network access and sees only the analysis software, the LAT data and its own session's files.

Read the results, then continue

The Outputs panel lists every task with its plots and fit numbers, and each finished task has a one-page report and a Methods text. Your next message, or a question in Discuss, starts the next step, and the Master Agent sees the outcome of this run. A failed run is not retried automatically.

Good to know

The data

The weekly all-sky LAT photon and spacecraft files from the FSSC, kept on the server and updated every night.

Unless you ask for another range, an analysis uses the last 365 days. The Examples run on one bundled week from January 2017.

Where to start

  • Examples: ready requests on the bundled week of data
  • Guided: step-by-step choices that write the request
  • Browse catalogs: find a source, then build an ROI around it

Questions and feedback

A problem, a result that looks wrong, or an analysis you would like? Send feedback in the ☰ menu (on the phone, the account sheet) reaches the team.

Replies appear under My tickets in the account menu.

Acknowledgment

Fermi-LLM runs at Clemson University, and its development is funded by NASA grant 80NSSC25K7897.