Reproducible work with agents

Session 3 · Mon Oct 5 · Book sections 1.8 + 6.1

🤖

Learning objectives

Evaluate an AI-assisted workflow as a scientific process: identify which decisions belong to the model, which operations belong to tools, which access constraints come from the sandbox, and which evidence supports the reported result.

Write an agent instruction file whose rules can be checked against the agent’s output.

Literature example: GPT-4 and IPCC confidence labels

🗂️ Catalog & compiled product 🌤️ Atmosphere 🌡️ Atmospheric & climate science

Given 300 statements from the IPCC Sixth Assessment Report, GPT-4 assigned the authors’ confidence level correctly 47% of the time and rated low-confidence statements as medium on average.

Lacombe, Wu & Dilworth (2023). ClimateX. NeurIPS Workshop on Tackling Climate Change with Machine Learning, arXiv:2311.17107.

report page statement (one data sample, ClimateX test split) IPCC confidence
WGI 203 Over the period 1982–2016, marine heatwaves have very likely doubled in frequency and are increasing in intensity very high
WGI 154 Future projections indicate continuing decline in seasonal snow duration, glacial mass, and permafrost area by mid-century high
WGI 101 Global land precipitation has likely increased since 1950, with a faster increase since the 1980s medium
WGI 122 For global warming up to 2°C above 1850–1900 levels, paleoclimate records do not indicate abrupt changes in the carbon cycle low

With four labeled examples in the prompt, GPT-4 labeled 5 of the 50 low-confidence statements as low, and it answered all 300 prompts.

Tests of AI assistants against independent records

84 posts

Gemini 1.5 Pro rated shaking intensity from social-media posts about 7 earthquakes; most estimates fell inside the range of USGS Did You Feel It? reports, with the largest mismatch for the 2024 M 7.4 Hualien, Taiwan event.

Mousavi, S. M., et al. (2025). Gemini and physical world: Large language models can estimate the intensity of earthquake shaking from multimodal social media posts. Geophysical Journal International, 240, 1281–1294.

55% → 18%

Share of fabricated works among the citations in short papers written by GPT-3.5 (222 citations) and GPT-4 (414), on 42 topics.

Walters, W. H., & Wilder, E. I. (2023). Fabrication and errors in the bibliographic citations generated by ChatGPT. Scientific Reports, 13, 14045.

56.1%

With 20 or 30 documents in the prompt and the answer in the middle one, GPT-3.5-Turbo scored below its 56.1% with no documents at all.

Liu, N. F., Lin, K., Hewitt, J., et al. (2024). Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12, 157–173.

98%

Asked “Are you sure?” after a correct answer, Claude 1.3 wrongly admitted a mistake on 98% of questions.

Sharma, M., Tong, M., Korbak, T., et al. (2023). Towards understanding sycophancy in language models. arXiv:2310.13548 (ICLR 2024).

Each study scored model output against a record the model did not write: felt reports, bibliographic databases, the document that holds the answer, or the model’s own first answer.

Rubric checkpoint

Score the paper from your sprint using Friday’s six dimensions:

scientific claim · data · code/workflow · environment/compute · evaluation · publication/credit

For each dimension, assign:

  • 0 missing
  • 1 present but incomplete
  • 2 another team can verify it

A score whose interpretation is uncertain indicates where the rubric needs a clearer criterion or additional evidence.

Agent, tools, environment, sandbox

An agent is a language model, a set of tools, and a loop over observations (book section 6.1).

ModuleNotFoundError is an environment failure, Permission denied a sandbox failure, and CUDA out of memory a hardware failure; in all three the model’s code can be correct.

The agent loop

Each iteration contains three distinct sources of scientific responsibility:

Stage Example Question for the reviewer
Specification “Estimate the velocity of station P395” Were the target, units, interval, and success criterion defined?
Execution the agent reads data and runs regression code Which tools, data, environment, and permissions shaped the operation?
Interpretation the agent explains the estimated trend Does the conclusion follow from the computed output and domain assumptions?

For P395 the specification decides the number: NGL MIDAS gives an east rate of −6.4 mm/yr in the IGS20 frame and +6.9 mm/yr relative to stable North America.

Where errors enter

Failure mode What can happen Evidence or countermeasure
Attention important context receives little weight name required files; test cited details
Agreement the model follows a user’s wrong framing request alternatives; test opposing hypotheses
Judgment it chooses the wrong data, method, or interpretation specify success criteria; compare with ground truth
Hallucination fluent claims or citations have no source resolve citations; recompute quantitative claims

Each countermeasure leaves evidence in the transcript: a cited file and line, an alternative hypothesis, a comparison with a known value, or a resolved DOI.

The calibration dataset: GNSS station P395

📍 In-situ sensor 🪨 Solid Earth 📐 Geodesy

P395 moves 12.7 mm/yr northeast relative to stable North America (NGL MIDAS).

Numerical calibration protocol

Before asking the assistant, define the reference calculation:

  • station component, date interval, and reference frame
  • treatment of missing data, offsets, and seasonality
  • regression model, units, and reported precision
  • tolerance for agreement and an independently executed implementation

The provider’s value, as notebook 1.7 reads it (MIDAS files from NGL):

igs = read_midas(fetch_living(f"{NGL}/gps_timeseries/IGS20/midas/midas.IGS.txt", "midas.IGS.txt"))
na = read_midas(fetch_living(f"{NGL}/gps_timeseries/IGS20/midas/midas.NA.txt", "midas.NA.txt"))
igs.loc["P395", "ve"], na.loc["P395", "ve"]   # east, mm/yr: -6.4 (IGS20) and +6.9 (North America fixed)

Citation calibration protocol

For each suggested paper, verify four properties independently:

Property Verification source
Existence DOI resolver, publisher, or trusted bibliographic index
Bibliographic identity title, authors, year, and venue match
Relevance abstract or full text addresses the stated scientific question
Accessibility of evidence data, code, supplement, and licensing can be located

Walters & Wilder (2023): among the real works that GPT-3.5 cited, 43% carried substantive errors in authors, title, journal or publisher (GPT-4: 24%).

Calibration experiment

20 minutes in pairs

  1. Give an assistant book/Chapter1-GettingStarted/data/gps_P395_relative_position.csv and ask for the east velocity of P395 in mm/yr
  2. Record whether it runs code or answers from text
  3. Recompute the value independently, then compare both with NGL’s published MIDAS rate
  4. Ask for three ML papers in your subfield
  5. Resolve every DOI and count unsupported citations

The class reports counts with their denominators: attempts, valid tool executions, answers within tolerance of the MIDAS rate, and verified citations.

Course AI modes

🔒 By hand

The learning objective requires unaided execution or interpretation. These exercises establish the skills needed to inspect an assistant’s work.

🤝 Assistant allowed

The assistant may contribute to the workflow. The submission must disclose its contribution, preserve accepted artifacts, and document independent verification.

Students remain responsible for explaining the scientific and computational decisions represented in submitted work.

Sandbox boundaries and research data

Before giving an agent access to research material, classify both the data and the action.

Question Examples of relevant evidence
May the service receive these data? consent, data-use agreement, export controls, institutional policy
May the process contact the network? approved domains, API terms, firewall or sandbox configuration
May the process modify or delete files? write scope, version control, backups, confirmation policy
May outputs leave the environment? disclosure risk, licensing, embargo, human review

Credentials should enter through approved secret-management mechanisms rather than prompts, notebooks, or committed files.

AI-assisted rubric extension

Add these criteria to the class rubric:

Dimension Observable evidence
Tool disclosure tool and its contribution are named in the submission or commit
Human review the student can explain the accepted code and scientific choices
Independent verification numbers, citations, and API claims are checked outside the model output
Access boundaries sensitive data and credentials stay outside unapproved tools and sandboxes
Run record accepted code, environment, inputs, and outputs are preserved in the repository

0 missing · 1 present but incomplete · 2 another team can verify it

Same scale as v0.1. A claim without inspectable evidence, such as “verified the citations”, scores 1.

From rubric to AGENTS.md

An instruction file is a plain-text file at the root of a repository that a coding agent reads at the start of every session. AGENTS.md is an open format read by Codex, the GitHub Copilot coding agent, Cursor, Gemini CLI, and others; Claude Code reads it when the project has no CLAUDE.md, and otherwise imports it with @AGENTS.md.

# AGENTS.md for MLGEO2026_UWNETID
## Environment
- Run all code through `pixi run`; add packages only through pixi.toml.
- Run `pixi run smoke` before reporting any result.
## Data
- Fetch values that a provider publishes (station coordinates, velocities,
  catalogs) and cite the URL and retrieval date; do not recompute or retype them.
- Cite every dataset by DOI in the README.
## Reporting
- State the reference frame, units, and time window of every number.
- Mark AI-drafted commits: "AI-assisted: <tool>, <what it drafted>".

Each rule restates a rubric criterion as an instruction whose outcome can be checked in the agent’s output.

Updated Oct 9: HW1 Step 7 now asks for six headings mapped onto rubric v0.1: a short Project paragraph, then at least one rule under each of the other five (at least five rules in total); see 1.9.

Does the agent follow its instructions?

6 minutes in pairs

  1. Put the AGENTS.md above, or three of its rules, in your course repository or a scratch folder
  2. Ask your agent: “Report the east velocity of GNSS station P395 and where the value comes from.”
  3. Score three rules as yes or no from the transcript and the changed files
  4. Exchange transcripts with the next pair and score theirs without discussion
  5. Compare the two sets of scores, rule by rule

A disagreement between pairs means the rule is ambiguous or the evidence is missing; record which.

One run per pair gives one yes or no per rule; a compliance rate needs repeated trials, which stage 4 of the reading arc adds on Dec 10.

Rubric v0.2

As a class, choose:

  • one criterion the paper review exposed
  • one criterion the calibration experiment exposed
  • one rule the instruction-file check exposed
  • the evidence required for a score of 2

Ch 1 quiz opens Tue Oct 6 and closes Thu Oct 8 · HW1 now includes an AGENTS.md · Wednesday: peer rerun of your repositories, then from reproducible code to curated data