From Self-Supervision to Autonomous Discovery
ML for Science and Engineering · Lecture 27
Joseph Bakarji
Everything you've built this semester
You've learned to build models from data.
What if the model could build itself?
Self-supervision, scaling, and emergent capabilities
No labels. The data is the supervision.
Next-token prediction: each token predicts the next
S. Raschka, "Build an LLM from Scratch"
| Model | Parameters | Training Data |
|---|---|---|
| GPT-2 (2019) | 1.5B | 40 GB text |
| GPT-3 (2020) | 175B | 570 GB |
| Chinchilla (2022) | 70B | 1.4T tokens |
| GPT-4 (2023) | ~1.8T* | ~13T tokens* |
| Claude 3.5 (2024) | – | – |
* estimated, not officially disclosed
Hoffmann et al. (2022) arxiv:2203.15556 · Brown et al. (2020) arxiv:2005.14165
Self-attention: every token attends to every other token.
Vaswani et al. (2017) "Attention Is All You Need"
Vaswani et al. (2017) arxiv:1706.03762 · 3Blue1Brown: "Attention in transformers, visually explained"
Each input embedding $\mathbf{x}_i \in \mathbb{R}^d$ is projected through three learned matrices:
3Blue1Brown: "Attention in transformers, visually explained" · "How might LLMs store facts"
Performance follows power laws in compute, data, and parameters:
Loss decreases predictably over 7 orders of magnitude of compute.
Kaplan et al. (2020) --smooth power laws across 7 orders of magnitude
Kaplan et al. (2020) arxiv:2001.08361 · Hoffmann et al. (2022) arxiv:2203.15556
Brown et al. (2020) arxiv:2005.14165 · Taylor et al. (2022) arxiv:2211.09085
Abilities that appear discontinuously as models cross parameter thresholds:
Wei et al. (2022) arxiv:2206.07682 · Schaeffer et al. (2023) arxiv:2304.15004
A) It uses reinforcement learning instead of gradient descent
B) Labels come from the data itself (predict next token), not human annotation
C) It requires less compute than supervised learning
D) It can only work with text data, not images or proteins
Proteins, weather, mathematics, and cautionary tales
Predicting 3D protein structure from amino acid sequence --a 50-year grand challenge.
AlphaFold 2 architecture (Wikimedia, CC BY-SA)
A protein language model: trained on 2.78 billion protein sequences to jointly reason over sequence, structure, and function.
Hayes et al. (2025) Science · 98B params, Meta FAIR
| Model | Architecture | Key Result |
|---|---|---|
| GraphCast | GNN on mesh | Beats ECMWF at all lead times |
| GenCast | Diffusion | Beats ENS on 97.2% of targets |
| Pangu | 3D Transformer | First to beat HRES (2023) |
GenCast vs ECMWF ENS scorecard (Price et al. 2024)
LLM paired with an automated evaluator in an evolutionary loop. Searches for programs, not solutions.
Romera-Paredes et al. (2024) Nature · DeepMind
Meta's scientific LLM: 120B params trained on 106B tokens of papers, textbooks, encyclopedias, molecular data.
Taylor et al. (2022) arxiv:2211.09085 · Meta AI
Si et al. (2024) ICLR 2025 · Asai et al. (2024) OpenScholar, Nature · Wang et al. (2023) SciBench, ICLR 2024
From chatbots to autonomous systems
Yang et al. (2025) "From Automation to Autonomy," EMNLP 2025
Weng, L. (2023) "LLM Powered Autonomous Agents"
Interleave reasoning and acting:
Yao et al. (2023): Standard vs CoT vs Act vs ReAct
Yao et al. (2023) ICLR 2023
An agent's tools are just function descriptions the LLM can call:
tools = [
{
"name": "run_sindy",
"description": "Discover governing equations from time-series data",
"parameters": {
"data": "array of shape (n_timesteps, n_vars)",
"library": "polynomial | fourier | custom",
"threshold": "sparsity cutoff (float)"
}
},
{
"name": "solve_pinn",
"description": "Solve a PDE using a physics-informed neural network",
"parameters": {
"pde": "equation string, e.g. 'u_t + u*u_x = nu*u_xx'",
"domain": {"x": [0, 1], "t": [0, 1]},
"boundary_conditions": "dict of BC specifications"
}
}
]
An agent is just a while loop with an LLM deciding what to do next:
import anthropic
client = anthropic.Anthropic()
memory = []
while not done:
# 1. Think: LLM reasons about the current state
response = client.messages.create(
model="claude-sonnet-4-20250514",
tools=tools,
messages=memory
)
# 2. Act: execute the tool the LLM chose
tool_call = response.tool_use
result = execute(tool_call.name, tool_call.input)
# 3. Observe: feed result back into memory
memory.append({"role": "assistant", "content": response})
memory.append({"role": "user", "content": result})
The JSON tool definition maps to a real function the agent executes:
Tool definition (what the LLM sees)
{
"name": "run_sindy",
"description": "Discover governing
equations from time-series",
"parameters": {
"data": "(n_timesteps, n_vars)",
"library": "polynomial",
"threshold": 0.1
}
}
Actual function (what gets executed)
import pysindy as ps
def run_sindy(data, library, threshold):
lib = ps.PolynomialLibrary(degree=3)
optimizer = ps.STLSQ(threshold=threshold)
model = ps.SINDy(
feature_library=lib,
optimizer=optimizer
)
model.fit(data, t=dt)
model.print()
return model.coefficients()
The leaked system prompt reveals how modern coding agents actually work:
# Tools available to the agent:
- Read(file_path) # read any file
- Edit(file, old, new) # surgical edits
- Bash(command) # run shell commands
- Grep(pattern) # search codebase
- Write(file, content) # create files
- Agent(prompt) # spawn sub-agents
# Rules:
- Read before editing
- Don't add features beyond what was asked
- Break work into tasks
- Use the simplest approach first
- Verify your work
What the Claude Code leak teaches us about building agents:
The future of programming isn't writing code.
It's designing the system that writes the code.
Mapping coding agents to scientific discovery
| Coding Agent (Claude Code) | Science Agent |
|---|---|
Read(file) | ReadData(experiment_id) |
Edit(file, old, new) | UpdateModel(params) |
Bash(command) | RunSimulation(config) |
Grep(pattern) | SearchLiterature(query) |
Agent(subtask) | Agent("analyze this subset") |
| Git history = memory | Experiment log = memory |
From robot scientists to autonomous drug discovery
| Year | System | What It Did |
|---|---|---|
| 2009 | Robot Scientist Adam | Automated yeast genomics: hypothesis → experiment → discovery |
| 2023 | Coscientist | GPT-4 designed and ran catalytic chemistry experiments |
| 2024 | ChemCrow | 18 chemistry tools, synthesized insect repellent |
| 2024 | AI Scientist v1 | Fully automated ML papers for ~$15 each |
| 2025 | Robin | Multi-agent drug discovery, validated in wet lab |
| 2025 | GPT-5 + Red Queen | Novel enzymatic mechanism, 79x cloning efficiency |
King et al. (2009) Science · Boiko et al. (2023) Nature · Lu et al. (2024) Nature
ChemCrow architecture (Bran et al. 2024)
Bran et al. (2024) Nature Machine Intelligence
FutureHouse (2025): first multi-agent system to autonomously discover and validate a therapeutic candidate.
FutureHouse (2025) arxiv:2505.13400
OpenAI + Red Queen Bio (2025): GPT-5 in a tightly controlled molecular cloning system.
OpenAI (2025) "Early experiments in accelerating science with GPT-5"
Sakana AI (2024): fully automated research pipeline.
Lu et al. (2024) Nature · Porsdam Mann et al. (2025) ACM SIGIR Forum
A) An LLM that summarizes research papers on demand
B) A coding copilot that suggests experiment analysis code
C) A multi-agent system that generates hypotheses, designs experiments, and analyzes results in a loop
D) A foundation model that predicts protein structures from sequences
And your course is the prompt
| Scientific Method | Agent Loop (ReAct) | Agent Component |
|---|---|---|
| Observe phenomena | Observation | Perception / data input |
| Form hypothesis | Thought | Planning module |
| Design experiment | Thought → Action | Tool selection |
| Run experiment | Action | Tool execution |
| Analyze data | Thought | Reasoning + memory |
| Revise hypothesis | Thought (update) | Memory + planning |
| Repeat | Loop | Agent controller |
Wang et al. (2025) "Exploring the role of LLMs in the scientific method," npj AI
If you were designing a science agent's tool kit, you'd give it exactly what you learned:
run_svd()run_pca()run_dmd()run_sindy()symbolic_regression()solve_pinn()train_deeponet()train_fno()What agents can't do, and why it matters
Asai et al. (2024) Nature · Wang et al. (2023) SciBench, ICLR 2024
Trehan (2025): four end-to-end attempts at autonomous ML research. Six failure modes:
Trehan (2025) "Why LLMs Aren't Scientists Yet," Agents4Science
Anthropic (2026): discovered 171 emotion vectors inside Claude Sonnet: internal representations that causally influence behavior.
Anthropic (2026) "Emotion concepts and their function in a large language model" · Full paper
Case study: Anthropic supervised Claude through a QCD physics paper in 2 weeks (vs. ~1 year). Expert guidance was essential throughout. "Vibe physics," Anthropic (2025)
A) Increase the network size and retrain
B) Switch to a completely different method (FNO)
C) Diagnose the failure: check loss landscape, spectral bias, boundary condition enforcement, learning rate
D) Generate more training data
Domain knowledge is the bottleneck
What you bring that agents can't (yet):
In the agentic era, everything you learned this semester
becomes more important, not less.
Understanding SINDy, PINNs, neural operators, scaling laws,
failure modes, and inductive biases
is what makes you an effective scientific agent designer.
Foundation Models
Agentic Science
Critical / Safety