AI Scientist or AI Engineer? How Coding Agents Improve Scientific ML Models

    This article examines what happens when coding agents are placed in real scientific machine learning benchmarks and left to work unattended. Drawing on a study across 20 benchmarks, it breaks down the agent workflow into five stages, from environment setup and paper-to-code alignment to baseline reproduction, controlled experiments, and result attribution. It also proposes a four-layer evaluation framework, outlines common failure modes such as baseline drift and evaluation leakage, and offers a layered design for building automated experiment platforms. The key takeaway: today's coding agents behave more like tireless engineers than scientists, and teams get the most value by pairing human creativity with machine throughput.

    1. The Setup: Putting Agents in a “Real Lab”

    Picture this scenario: a server with eight high-end accelerators, a top-tier conference paper, an official reference implementation, and 12 hours of unattended runtime. A coding agent is expected to autonomously complete the entire loop: read the paper, reproduce the baseline, propose an improvement, run experiments, and submit results. The target might be a classification model for astronomical observations, a protein structure prediction model, or a power grid simulation model.

    This is not a thought experiment. One research team placed several mainstream coding agents into 20 real-world scientific ML benchmarks, with no human intervention allowed, to see how far they could get. The findings were both encouraging and sobering: every agent achieved a positive improvement, and on every benchmark, at least one agent surpassed the best result reported in the paper. There were no complete failures.

    The value of this result is not the slogan “AI can do research now.” It lies in the engineering details it exposes: how agents read code, manage experiments, recover from failure, and judge whether an “improvement” is real.

    2. The Agent’s Full Working Loop

    An agent capable of independently completing a research improvement task needs at least five coordinated stages.

    1. Environment awareness and dependency setup. The agent must first determine the repository structure, dependency versions, data paths, and hardware topology, then establish runnability inside a container or virtual environment. This step has the highest failure rate and puts engineering capability to the strongest test.

    2. Paper-to-code alignment. Hyperparameters, data splits, and evaluation metrics in the paper often disagree with the code. The agent needs to build a three-way comparison across “paper claims, code implementation, and actual logs” to avoid optimizing against a wrong baseline.

    3. Baseline reproduction and credibility checks. Without a trustworthy baseline, every subsequent “improvement” is meaningless. A mature practice is to fix random seeds, lock the dataset version, run multiple times, and record the mean and variance.

    4. Hypothesis generation and controlled experiments. The agent proposes a change (for example, adjusting the learning rate schedule, swapping the regularization method, or modifying feature normalization), changes only one variable at a time, and keeps a complete configuration snapshot.

    5. Result attribution and reporting. The final submission should not be just a number, but an auditable record containing configuration, logs, resource consumption, and failed attempts.

    A sample experiment configuration structure can be written as:

    1. experiment:
    2. baseline_commit: "a1b2c3d"
    3. seed: [0, 1, 2]
    4. dataset_version: "v1.4"
    5. single_variable_change: "optimizer.warmup_ratio: 0.05 -> 0.10"
    6. metrics: ["val_loss", "F1", "throughput"]
    7. budget_hours: 12
    8. artifacts: ["config", "logs", "checkpoints_meta"]

    3. Evaluation: Don’t Just Look at “Higher Scores”

    To evaluate this kind of system, look at at least four layers of metrics.

    • Effectiveness: the improvement over the baseline, and whether it exceeds the value reported in the paper.
    • Robustness: variance across multiple random seeds, to avoid a single lucky run.
    • Efficiency: the compute and time required to reach the same result, including memory usage and throughput.
    • Reproducibility: whether others can rerun the configuration and logs and reach the same conclusion.

    Looking only at effectiveness tends to reward overfitting to the test set. Adding robustness and reproducibility is what separates genuine scientific improvement from random fluctuation.

    4. Common Failure Modes and Safeguards

    The first is baseline drift. Dependency upgrades or dataset version changes make the baseline incomparable. The safeguard is environment pinning and data versioning.

    The second is evaluation leakage. The agent may unintentionally use test set information for tuning. The safeguard is strict isolation of validation and test sets, plus limits on how often the test set can be accessed.

    The third is pseudo-improvement. The metric gain comes from longer training rather than a better method. The safeguard is recording an “equal-compute control experiment.”

    The fourth is resource runaway. Multiple agents running in parallel compete for GPU memory, causing a task avalanche. The safeguard is introducing queues and quotas, combined with resource isolation from the container platform, full retention of logs from the logging service, and threshold-linked alerting from monitoring.

    5. Engineering Recommendations

    To build a similar automated experiment platform inside an enterprise or team, consider this layered design:

    1. Resource layer: containerized runtime plus a job queue and quota management, ensuring multiple tasks do not interfere with each other.
    2. Data layer: object storage for datasets and checkpoint metadata, with data versions bound to experiment configurations.
    3. Execution layer: agents are allowed to submit jobs only through controlled interfaces and are forbidden from directly modifying evaluation scripts.
    4. Observability layer: unified log and metric collection, forming a traceable experiment archive.
    5. Governance layer: manual spot checks and red-team review of agent output, especially in security-sensitive scenarios.

    On the cloud, you can use a container platform to host the runtime, object storage to hold artifacts, a message queue for task distribution, and logging and monitoring services for observability. These are common capability categories that make cross-platform migration easier and avoid lock-in to a single vendor.

    6. Scientist or Engineer

    Back to the original question. At the current stage, coding agents are more like “tireless engineers.” They excel at controlled trial and error, batch tuning, and engineering optimization within an established framework, and can produce verifiable positive improvements within 12 hours. But they do not yet have the ability to propose entirely new scientific questions or build new paradigms. What they optimize is “how to do a known method better,” not “whether we should understand the world in a different way.”

    The implication for enterprises is direct: rather than expecting agents to replace researchers, treat them as execution units on an experiment pipeline. With rigorous baseline management, reproducible records, and layered governance, you can combine human creativity with machine throughput. That is the engineering reality most worth investing in behind the “AI scientist” narrative.