• bitcoinBitcoin(BTC)$60,550.00-0.43%
  • ethereumEthereum(ETH)$1,690.20-0.82%
  • tetherTether(USDT)$1.000.00%
  • binancecoinBNB(BNB)$554.28-0.50%
  • usd-coinUSDC(USDC)$1.000.01%
  • rippleXRP(XRP)$0.94-0.03%
  • solanaSolana(SOL)$71.10-0.08%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.070.87%
  • tronTRON(TRX)$0.3037140.08%
  • HyperliquidHyperliquid(HYPE)$62.610.35%
  • zcashZcash(ZEC)$690.20-11.01%
  • dogecoinDogecoin(DOGE)$0.056465-0.17%
  • moneroMonero(XMR)$460.14-10.75%
  • leo-tokenLEO Token(LEO)$9.090.86%
  • whitebitWhiteBIT Coin(WBT)$61.103.58%
  • chainlinkChainlink(LINK)$9.311.85%
  • USDSUSDS(USDS)$1.000.02%
  • cardanoCardano(ADA)$0.1487281.26%
  • Ethena USDeEthena USDe(USDE)$1.00-0.05%
  • stellarStellar(XLM)$0.126822-1.95%
  • daiDai(DAI)$1.00-0.01%
  • bitcoin-cashBitcoin Cash(BCH)$209.820.98%
  • nearNEAR Protocol(NEAR)$3.05-1.13%
  • litecoinLitecoin(LTC)$43.882.04%
  • CantonCanton(CC)$0.074930-4.05%
  • avalanche-2Avalanche(AVAX)$6.60-1.11%
  • tether-goldTether Gold(XAUT)$3,562.60-0.17%
  • USD1USD1(USD1)$1.00-0.03%
  • uniswapUniswap(UNI)$4.66-2.30%
  • Ripple USDRipple USD(RLUSD)$1.000.01%
  • suiSui(SUI)$0.67-0.83%
  • the-open-networkGram (prev. Toncoin)(GRAM)$0.95-1.18%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • hedera-hashgraphHedera(HBAR)$0.0541522.59%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.05%
  • paypal-usdPayPal USD(PYUSD)$1.000.02%
  • BittensorBittensor(TAO)$183.730.23%
  • quant-networkQuant(QNT)$147.791.61%
  • shiba-inuShiba Inu(SHIB)$0.0000040.30%
  • Spiko Amundi Overnight Swap Fund (EUR)Spiko Amundi Overnight Swap Fund (EUR)(EURSAFO)$1.12-0.05%
  • Circle USYCCircle USYC(USYC)$1.150.00%
  • crypto-com-chainCronos(CRO)$0.039975-0.57%
  • MemeCoreMemeCore(M)$0.82-2.77%
  • RainRain(RAIN)$0.002485-10.26%
  • okbOKB(OKB)$82.770.89%
  • Falcon USDFalcon USD(USDF)$1.000.02%
  • United StablesUnited Stables(U)$1.000.05%
  • pax-goldPAX Gold(PAXG)$3,559.42-0.28%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • BitwayBitway(BTW)$1.0011.88%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

Guide to Loop Engineering: How ‘autoresearch’ and ‘Bilevel Autoresearch’ Turn AI Agents Into Autonomous Machine Learning ML Research Loops

July 12, 2026
in AI & Technology
Reading Time: 15 mins read
A A
Guide to Loop Engineering: How ‘autoresearch’ and ‘Bilevel Autoresearch’ Turn AI Agents Into Autonomous Machine Learning ML Research Loops
ShareShareShareShareShare

Most people still use AI like a 2015 search box. You type, you read, you type again. A newer pattern replaces that manual back-and-forth with a loop. This guide explains loop engineering using two verified artifacts. The sources are Andrej Karpathy’s autoresearch repository and the Bilevel Autoresearch paper. The framing follows a write-up by @0xCodila.

What is Loop Engineering?

To start, compare two modes. A prompt is one instruction, after which you decide the next step. A loop, by contrast, is a goal the model pursues until it arrives. The model plans, acts, checks its own result, then repeats. You define the objective once, and the loop handles iteration. Crucially, a loop only earns its cost when the work is measurable.

The Three Parts That Make A Loop Work

So what separates a real loop from a chatbot on repeat? Every reliable loop has three components.

  1. A verifier grades each attempt. That check can be a passing test, a moving metric, or a build. Without a verifier, the agent simply agrees with itself on repeat.
  2. State records what was tried, what failed, and what remains. A small side file lets the next run resume instead of restarting.
  3. A stop condition prevents runaway cost. The loop halts when the goal is met, or after N attempts.

The Karpathy Loop: Inside ‘autoresearch’

These three parts are not theoretical. On March 7, 2026, Karpathy released autoresearch, an open-source repository under the MIT license. It ships three core files and about 630 lines of code. The project went viral within days and now sits near 90,000 GitHub stars. It was latter presented as the pattern “the Karpathy Loop.”

The design is deliberately small, yet strict. The agent edits only train.py, which holds the GPT model, optimizer (Muon and AdamW), and training loop. It cannot touch the evaluation utilities in prepare.py. That separation stops the agent from making the test easier instead of the model better. Meanwhile, a human writes program.md, the instructions the agent must respect.

Each cycle runs one experiment. The agent reads the code, proposes a change, trains five minutes, then keeps or rolls back. The scoring metric is val_bpb, validation bits per byte, where lower is better. That budget yields roughly 12 experiments per hour, so about 100 run overnight.

The reported outcomes are concrete. Karpathy pointed it at his already-optimized nanochat GPT-2 training code. It ran for two days and completed about 700 experiments, keeping 20 genuine improvements. Stacked together, those fixes cut GPT-2-quality training time by 11%, from 2.02 to 1.80 hours. One finding was a QK-Norm implementation missing a scalar multiplier, which had left attention too diffuse across heads.

Notably, humans tire after roughly a dozen experiments, whereas the loop does not. Separately, Shopify CEO Tobi Lütke ran autoresearch overnight on an internal model. He reported a 19% improvement after 37 experiments. Karpathy’s takeaway: if you have an objective metric, you are the bottleneck.

Prompt vs Loop vs Bilevel Loop

The differences become clearer side by side.

Aspect One-shot prompt Karpathy loop (autoresearch) Bilevel Autoresearch
You define Each step The goal, once The goal, once
Who iterates You Inner agent Inner + outer agent
Verifier You, manually prepare.py (val_bpb) Same metric, two levels
State Chat only Experiment log Log plus injected code
Human role Engine Author of program.md Author of program.md
Reported result Varies 700 runs → 20 fixes, 11% speedup 5x larger val_bpb drop

The Five Building Blocks

Consequently, AI engineering teams now assemble working loops from five reusable pieces:

  • Automation fires the loop on a schedule, event, or trigger.
  • A skill stores project knowledge in a markdown file, read on every run.
  • Sub-agents split the writer from the reviewer, since one model grades itself too generously.
  • Connectors let the loop act inside real tools, like an issue tracker or Slack.
  • Finally, a verifier remains the gate that rejects bad work. Claude Code and Codex now ship all five.

Bilevel Autoresearch: A Loop On Top Of The Loop

Next, researchers asked a sharper question. If autoresearch is research, can you autoresearch autoresearch? The research paper Bilevel Autoresearch: Meta-Autoresearching Itself answers yes.

The inner loop matches Karpathy’s original: propose, train, evaluate, keep or discard. The outer loop watches the inner loop and reads its code and traces. It identifies where the search itself keeps stalling. Then it writes new Python mechanisms, injects them at runtime, and reruns the inner loop.

The result held on Karpathy’s GPT pretraining benchmark. The outer loop cut val_bpb 5x more than the single loop (-0.045 vs -0.009). Notably, both loops used the same LLM, so the gain came from architecture, not a smarter model. In practice the design splits into three levels. Level 1 runs the base loop. Level 1.5 tunes search parameters every five iterations. Level 2 generates mechanisms through a four-round session. The reported experiments used an RTX 5090 32GB and a 300-second budget.

The reason is worth noting. The inner loop kept returning to the same priors, even after they stopped working. The outer loop broke those patterns by forcing unfamiliar exploration.

Use Cases With Examples

These ideas transfer well beyond pretraining. For model work, a loop searches hyperparameters until val_bpb drops. For software, it refactors until tests, types, and the build pass. For content, it rewrites until every rubric score clears a threshold. For data, it tunes a pipeline until schema checks hold. Each case shares one trait: an automatic gate that can fail the work.

Try It Yourself: A Loop In One Prompt

Theory aside, you can feel the mechanic without Claude Code or Codex. Paste this into any capable model and watch it self-correct.

You will work in a loop until the task meets the bar.

TASK:
[describe exactly what you want produced]

SUCCESS CRITERIA (be strict):
- [criterion 1]
- [criterion 2]
- [criterion 3]

LOOP PROTOCOL, repeat every turn:
1. PLAN   - state the single next step.
2. DO     - produce or improve the work.
3. VERIFY - score the result 1-10 on each criterion. Be honest.
4. DECIDE - if every criterion is 8+, print FINAL and stop.
            Otherwise print ITERATING and fix the weakest point first.

RULES:
- Never call it done until every criterion is 8 or higher.
- Each pass must fix the weakest score from the last VERIFY.
- Do not ask questions. Make a sensible assumption and continue.
Begin.

Underneath, the control flow is small. The skeleton below shows those three parts in Python: a verifier, a decision, and two stop conditions.

current = baseline
best = evaluate(current)                 # verifier: lower val_bpb is better
for step in range(MAX_STEPS):            # stop condition 1: experiment budget
    candidate = propose_change(current)  # agent edits train.py
    score = train_and_eval(candidate)    # train 5 min, then verify
    if score < best:                     # keep only real improvements
        current, best = candidate, score # commit
    # else: discard candidate, restore baseline
    if best <= TARGET:                   # stop condition 2: goal met
        break

Both versions are limited. You are still the trigger, and closing the tab erases the state. Adding automation, a state file, and a real gate turns this into an autonomous loop.

See It Run

The interactive demo below animates one full loop: propose, train, verify, then keep or roll back. Adjust the target and step limit, and watch val_bpb fall until the stop condition fires.

Key Takeaways

  • A loop needs three parts: a verifier, persistent state, and a stop condition.
  • autoresearch lets an agent edit only train.py and never the evaluator.
  • Karpathy’s overnight runs kept 20 fixes from 700 experiments, for an 11% speedup.
  • Bilevel Autoresearch adds an outer loop for a 5x val_bpb gain.
  • Loops shift the work to design and review; they do not remove thinking.


YOU MAY ALSO LIKE

Backloggd Urges Users To Change Their Passwords After A Breach

1Password Says It Was Hacked But Users’ Vaults Are Safe

Credit: Source link

ShareTweetSendSharePin

Related Posts

Backloggd Urges Users To Change Their Passwords After A Breach
AI & Technology

Backloggd Urges Users To Change Their Passwords After A Breach

November 26, 2026
1Password Says It Was Hacked But Users’ Vaults Are Safe
AI & Technology

1Password Says It Was Hacked But Users’ Vaults Are Safe

November 26, 2026
Canada Invests 0 Million More to Expand AI Compute Access Fund – Unite.AI
AI & Technology

Canada Invests $700 Million More to Expand AI Compute Access Fund – Unite.AI

November 26, 2026
Workers At GTA 6 Studio Rockstar Games Vote Overwhelmingly Against Union Recognition
AI & Technology

Workers At GTA 6 Studio Rockstar Games Vote Overwhelmingly Against Union Recognition

November 26, 2026
Next Post
Stay Tuned NOW Streaming Behind The Scenes! – May 27

Stay Tuned NOW Streaming Behind The Scenes! - May 27

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
Best Micro-Investing Apps – Skip the Monthly Fee Until Your Balance Grows

Best Micro-Investing Apps – Skip the Monthly Fee Until Your Balance Grows

November 26, 2026
He’s About To Lose His House

He’s About To Lose His House

November 22, 2026
Nasdaq surges 6.5% in second-largest one-day gain ever as Nvidia leads tech, AI stocks higher

Nasdaq surges 6.5% in second-largest one-day gain ever as Nvidia leads tech, AI stocks higher

November 23, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!