What Loop Engineering Changes

Loop engineering replaces manual model work with targeted loops in which the model itself plans, executes and evaluates experiments. The difference between a single prompt and a loop is that the loop has a defined goal and repeats steps until it reaches a measurable improvement. This shift moves the bottleneck from human attention span to compute budget.

The Autoresearch Implementation

The first practical demonstration appeared on 7 March 2026 when Andrej Karpathy released the open-source autoresearch repository under the MIT licence. The project consists of three main files and roughly 630 lines of code and gathered nearly 90 000 GitHub stars within days. The agent inside the loop may modify only the file train.py, which contains the model, the optimisers Muon and AdamW, and the training loop itself. Evaluation files remain unchanged. Users provide instructions in program.md. Each iteration comprises reading the code, proposing a change, a five-minute training run and a decision whether to keep or revert the change.

Measured Results on GPT-2

Success is measured with the metric val_bpb (validation bits per byte), where a lower value indicates a better result. With this configuration the loop completes approximately 12 experiments per hour, allowing up to 100 runs overnight. Karpathy tested autoresearch on already optimised GPT-2 training code and ran roughly 700 experiments over two days, of which 20 yielded genuine improvements. Overall training time fell by 11 percent, from 2.02 hours to 1.80 hours. One discovered issue was a missing scalar multiplier in the QK-Norm implementation that dispersed attention across heads. Shopify chief executive Tobi Lütke applied autoresearch to an internal model and reported a 19 percent performance improvement after 37 experiments. These results show that the human limit, fatigue after roughly twelve experiments, can be overcome by an automated loop that iterates continuously without loss of focus.

Bilevel Autoresearch: Outer Loop Monitoring

An extension of the concept, Bilevel Autoresearch, adds an outer loop that monitors the inner loop. The outer loop analyses the code and the inner loop’s monitoring, identifies points where the search stagnates and dynamically inserts new Python mechanisms that it then executes. On the GPT-2 pre-training benchmark this produced a fivefold improvement in val_bpb, from −0.009 to −0.045, while keeping the same language model. The gain therefore comes from the loop architecture, not from a more powerful model.

Implications for Security and Compliance

Autonomous loops enable organisations to run continuous optimisation of models and hyperparameters without constant human intervention. This reduces research costs, shortens development cycles and increases the reliability of results. From an audit and AI implementation perspective they introduce a new level of control: it becomes necessary to verify not only model outputs but also the integrity and security of automatically generated code. Organisations should therefore include review and monitoring of these loops in their security and regulatory processes to ensure that automatic modifications do not jeopardise data integrity or compliance with internal standards.