BabyAGI Inside: Compiling a Bounded Agent Loop into Qwen Weights
We demonstrate that a bounded agent loop can be compiled directly into the weights of a pretrained language model, without training. BabyAGI Inside adds a constructed controller, task-ledger protocol, in-model filesystem and halt condition to Qwen3.5-2B. The loop is a fixed-length task chain: Qwen writes the plan up front, a compiled pointer runs its tasks in order, and the controller halts after N cycles set at build time. The weights implement the loop; the ledger and files it writes live in the run's attention cache and DeltaNet state. After a single objective prefill, the host only samples tokens until a compiled HALT, with no scheduler, parser, tool executor or logits processor. Recent work compiles machines into Qwen that Qwen calls as tools. Here the compiled loop calls Qwen. In a frozen 32-item live evaluation of two to eight cycles, the compiled controller ran every phase in order and halted in all 32 runs (432/432 phases), with exact token accounting; in a teacher-forced circuit oracle every compiled token matched its reference (1,716 of 1,716 positions). With the loop inactive, the merged model agreed with stock Qwen on 4/4 test prefixes (top-1; maximum KL 0.0019). Every emitted token is attributed to the circuit or to Qwen: in a five-cycle run, Qwen wrote 1,416 of 3,376 tokens, 1,280 of them reasoning. Inside the loop, Qwen solved all eight sequential-arithmetic chains (36/36 transitions) and none of the 24 chains in other task families: 8/32 overall, against 5/32 for plain Qwen. Structured tasks failed in a revealing way: Qwen wrote a wrong plan and then executed every step of it correctly (8/8 against its own ledger, 0/8 against the reference). Two runs exposed a parser-isolation bug inherited from qwenFS, in which tool-call markup inside Qwen's reasoning put the filesystem into write mode. The prototype establishes that a fixed agent workflow can run inside a pretrained model's weights, and it gives a token-level account of what the compiled loop wrote and what the model wrote.
Authors
- Yohei Nakajima (ORCID: https://orcid.org/0009-0009-1293-6053)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-05
- DOI
- https://doi.org/10.5281/zenodo.23966216
- Primary Topic
- AI-based Problem Solving and Planning
- Type
- preprint