autoresearch v1.0: the design of a research loop that converges instead of wandering
You probably run this loop already, by hand. There is a script with a number at the end, a tuning job, a heuristic, a threshold. You ask a chatbot for an idea, paste it in, rerun, look at the number and decide by eye whether it got better. Two attempts later you no longer remember what you tried, and nothing records why the third idea was rejected. Every step is reasonable, and the whole is a loop with no memory and no rule for “better”.
autoresearch v1.0 writes that loop down so it can run without you. It was deposited on Zenodo in April 2026 under DOI 10.5281/zenodo.19772195 and generalizes the pattern of the karpathy/autoresearch repository (KARPATHY), which tied the loop to a single LLM-pretraining codebase, into a small Python package for any problem that meets four conditions. What turned out to matter was not the model at the wheel but the contract around it. The v1.1 post covers what came next, a coding agent that closes the loop on every iteration. This post is about the design that v1.1 takes for granted.
This post expands a LinkedIn Article of 29 April 2026: autoresearch v1.0, an autonomous research loop with a local LLM critic.
An agent is a loop, not a chat
Much of the confusion around agents comes from treating them as smarter chatbots. The definition the package is built on is mechanical: an agent is a critique, propose, execute and decide loop with persistent state, not a one-shot prompt and response. Each word carries a requirement. Critique needs the result of the previous attempt and a notion of better and worse, so without measurement there is no critique. Propose needs a structured output that can be applied to the system under change. Execute needs the proposal to land somewhere with a measurable consequence, under bounded resources. Decide needs a classification rule and a next state. Persistent state is the memory of attempts that lets the loop converge rather than wander.
Nothing in that definition depends on model size or vendor. A small local model running the loop is an agent in this strict sense, and a large hosted model answering one question at a time is not. The definition is also testable, because each of its parts can be checked in the code.
Four conditions on the problem
The loop applies wherever four conditions hold, and each one closes a specific door through which a run could drift.
- A single scalar metric that the runner prints on stdout. The project file
problem.yamldeclares ametric_regexto extract it and alower_is_betterflag for its direction. Several objectives must be collapsed into one scalar before they enter the loop. - A fixed time budget per iteration. The runner is killed after
hard_timeout_sseconds. The timeout is part of the contract, not a fallback, because it makes runs comparable across proposals and across machines. - A single mutable file,
solution.py, which is the only file the proposal may touch. Data preparation, evaluation and constants live in read-only files. The read-onlyevaluate.pyis what stops the loop from improving the metric by rewriting the metric. - A dedicated git branch. State lives in commits, and convergence comes from advancing good commits and reverting bad ones.
The repository README of that period counts the read-only files as a separate fifth item, and the Article folds them into the third condition. Either way the point is the same. Routing and scheduling under time windows, threshold calibration for classifiers, configuration tuned against a bounded simulation, and model tuning where each candidate takes minutes fit the contract. A metric that needs human judgment does not, nor does a change with side effects outside the mutable file, nor an iteration with no time bound. If a person has to look at the output to say whether it improved, the loop has nothing to classify.
The proposal is a contract too
The critic is an LLM served locally through Ollama, a small Gemma model by default, reached through an OpenAI-compatible client so that any endpoint speaking that protocol can replace it. Its answer is not free text. The request carries a JSON Schema in strict mode, abridged here from autoresearch/critic.py with the field descriptions removed.
NEXT_IDEA_SCHEMA = {
"type": "object",
"properties": {
"thought_process": {"type": "string"},
"alternatives_considered": {"type": "array", "items": {"type": "string"}},
"hypothesis": {"type": "string"},
"expected_delta": {"type": "number"},
"justification": {"type": "string"},
"code_pseudocode": {"type": "string"},
"risk_level": {"type": "string", "enum": ["low", "med", "high"]},
},
"required": ["thought_process", "alternatives_considered", "hypothesis",
"expected_delta", "justification", "code_pseudocode", "risk_level"],
}The schema is not decoration. A free-text suggestion such as “try a better initialization” cannot be checked afterwards. A proposal with a one-line hypothesis and a signed expected_delta commits to a specific change and to a predicted effect, and both can be compared with what the run measured. The fields thought_process and alternatives_considered are explicit slots for reasoning, so the trace is kept even when the backend exposes no native thinking. The critic does not see the whole history either. By default it receives the last ten rows of the results table, set by context_last_n, so its memory is the same audit trail a person would read.
Keep, discard or crash
The decision is the smallest piece of the package and the one that makes everything else trustworthy. This is the classifier in autoresearch/helpers.py.
def classify(value_str: str, best: float | None, lower_is_better: bool) -> str:
if not value_str or value_str.lower() == "nan":
return "crash"
try:
v = float(value_str)
except ValueError:
return "crash"
if best is None:
return "keep"
if lower_is_better:
return "keep" if v < best else "discard"
return "keep" if v > best else "discard"Three details are worth reading slowly. The comparison is strict, so a proposal that ties the running best is discarded, since an equal number is no evidence of improvement. A missing or unparsable metric is a crash, and so is a run stopped by the timeout, which the runner detects from the exit code. Constraints get no special branch, because they enter through the scalar that evaluate.py computes. The Article simplifies this step and the one that applies the proposal, and this post follows the v1.0 code. A keep advances the branch. A discard or a crash runs git reset --hard HEAD~1. Every iteration appends a row to results.tsv, every critic call is stored as a JSONL record with the prompt and the raw answer, and autoresearch audit consolidates the whole run into AUDIT_LOG.md.
A worked case: the smaller, faster, worse model
The third example shipped with v1.0 shows why the scalar has to carry the constraints. A gradient boosting regressor is trained on California Housing, and evaluate.py turns three raw metrics, RMSE, inference latency and model size, into one score. Each metric is divided by a reference budget and the three are combined with weights 0.6, 0.3 and 0.1, lower being better. The run recorded in the Article went like this.
Iter Score Status Move
---- ------ ------- --------------------------------------------------
0 0.6532 keep baseline (max_depth=3)
1 0.7061 discard max_depth=2 (smaller, faster, but worse predictive)
2 0.6159 keep max_depth=4
Iteration 1 produced a shallower model, smaller and faster, and worse at prediction. The weighted score went up, the classifier read that as a loss and the branch was reset. Iteration 2 went the other way and lowered the score to 0.6159, a 5.7% improvement on the baseline. A loop watching size or latency alone would have accepted the first move without complaint. The package ships four scalarizers for this, convex sum, weighted Tchebycheff, lexicographic and a soft constraint with a linear penalty past a cap. Because evaluate.py is read-only, choosing one is a decision made once per session, before the loop starts, and the critic only ever sees the final scalar.
A human gate before the first iteration
autoresearch loop refuses to start until a wizard validates nine preconditions. Among them, the runner must execute once with the metric regex matching inside the timeout, the critic must return valid JSON for the schema, and the last step is an explicit confirmation file written by a person. The loop runs unattended only after someone has watched the baseline work.
Why the critic runs locally
The default critic is local for four reasons given in the Article. A loop of hundreds of iterations on a hosted endpoint accumulates cost, while a local model costs nothing per call once downloaded. Code, evaluation logic and proposals never leave the machine, which matters to anyone under contractual or regulatory limits on data egress. Anyone with Ollama, Python and git can rerun the shipped examples and inspect the same audit logs, because the full sample runs are in the Zenodo deposit. And there is no quota or API jitter, only local hardware. The cost is a lower capability ceiling on hard problems, and the answer is configuration rather than code: keep the local critic for the loop and point the same client at a stronger model when it stalls.
What v1.0 left open
In v1.0 the step between a proposal and the next measurement belonged to whoever read next_idea.json and edited solution.py, a person or a coding agent such as Claude Code, Codex or OpenCode. autoresearch loop automated the run and the critic call, then waited in a noop state until the file changed. Closing that gap is the subject of autoresearch v1.1, which does it without changing any of the contract described here.
So, the number at the end of your script. Who decides today whether it got better, by which rule, and where is the record of what was tried and rejected?
References.
BROM, P. C. autoresearch v1.0. Zenodo, 2026. DOI: 10.5281/zenodo.19772195.
KARPATHY, A. autoresearch. GitHub repository. Available at: https://github.com/karpathy/autoresearch.
The source is open on GitHub under the MIT license, github.com/pcbrom/autoresearch, and archived on Zenodo under DOI 10.5281/zenodo.19772195. I write about this kind of work, scientific method, statistics, and AI applied with rigor, on LinkedIn: linkedin.com/in/pcbrom.