← Back to all posts

Nanbeige4.2-3B: A 3B Agentic Model, Trained From Scratch on a Looped Transformer

Nanbeige4.2-3B is a 3B-parameter agentic model pretrained from scratch on 28T tokens with a Looped Transformer that reuses its layer stack, reportedly beating 9B-12B open models at code, office and tool-use agent work — and it is close enough to run on a laptop. Key insights up front, four sibling papers as context, and an Ollama example.

nanbeigelooped-transformerrecurrent-depthsmall-modelsagentic-airlrlvrrlmslocal-aiopen-modelschinese-modelsoffice-agentstool-useopenclaw3b-models

The architecture at the center of the frontier's safety conversation just shipped as a 3B model you can run on a laptop. Nanbeige4.2-3B (Nanbeige Lab, July 2026) is a compact agentic model — 3B non-embedding parameters, pretrained from scratch on 28T tokens with a Looped Transformer that reuses the layer stack to increase capacity without adding parameters — and it reportedly outperforms Qwen3.5-9B and Gemma4-12B across code-agent, office-agent and complex tool-use benchmarks. The same architecture family, by another name, sits at the center of the OpenAI Astra safety debate.

Key insights

  1. For agentic work, parameters are not the binding constraint. A 3B model on a reused layer stack beats 9B–12B open models while staying competitive on reasoning and alignment.
  2. "Capacity without parameters" is a depth claim, not a file-size trick. A constant number of layers placed in a loop is provably enough for universal computation (Giannou et al., 2023): loop iterations buy the depth extra layers would otherwise buy. Nanbeige4.2-3B is that theory learned from scratch rather than hand-constructed.
  3. The recipe is the RL stack, and each part names a prior result. Think/Non-Think RLHF is the RLVR thinking line (DeepSeek-R1); length-controlled reasoning RL is the efficiency line (Kimi k1.5); outcome-plus-process agentic RL is the long-horizon line (SWE-RL).
  4. Looping is not hidden reasoning. Think and Non-Think are trained modes; the model reasons visibly when the reward selects for it. Legibility is orthogonal to layer reuse — the distinction the Astra conversation keeps blurring.
  5. Capability is built in the training environment, and the economics are local-first. Scaffolds and trajectories are first-class training data; 3B plus 28T tokens is a data-rich, compute-constrained bet that ends as a durable daemon on user hardware.

The recipe in one breath

  • Architecture. 28T-token from-scratch pretraining through a reused layer stack: more effective depth per parameter at 3B total.
  • Data. SFT on diverse executable environments, task assets and agentic scaffolds from real-world deployment and large-scale synthesis.
  • RL. Mixed-mode RLHF over Think and Non-Think responses (quality, fewer failures); length-controlled reasoning RL (accuracy vs. efficiency); agentic RL with outcome and process rewards (stabilizes long-horizon training).
  • Results. Beats Qwen3.5-9B and Gemma4-12B on agentic benchmarks; runs locally as a personal assistant (OpenClaw).

Context: four papers and a technical note

Looped Transformers as Programmable Computers (Giannou et al., 2023) proved a constant number of encoder layers in a loop can emulate an instruction-set computer — the input acts as a punchcard of instructions and memory. Its weights were hand-constructed to show what looping permits; Nanbeige is the bet that the same expressiveness can be learned at scale. The "input as program" framing is also why trajectories matter: in a looped transformer, the environment-supplied trajectory is the program being run.

Sebastian Raschka's technical note (OpenAI Astra and Looped Transformers, September 2026) fills in the engineering the abstract omits: in Nanbeige 4.2 the same 22-layer stack is run twice — roughly 44 effective layers with no duplicated weights — which is how capacity doubles without parameters, at roughly double the inference compute. Two passes won the trade-off (about 75% of standard token efficiency retained; more passes barely helped), which is why Raschka calls the looped transformer "a tiny architectural tweak," not the source of the model's capability. He traces the technique's lineage to the NeurIPS Mixture-of-Recursions paper (a learned router deciding one, two, or more passes per token) and pushes back on the Astra framing: layer reuse adds hidden-state computation before each emitted token, like ordinary layers do, and does not by itself suppress visible chain of thought — independent support for key insight 4.

Composite diagram by Sebastian Raschka (Ahead of AI, September 2026) — the three recurrent-depth claims side by side: OpenAI Astra's reported latent recurrent depth; Nanbeige 4.2's single 22-layer stack run twice (roughly 44 effective layers, no duplicated weights, ~2x inference compute, ~75% of standard token efficiency retained); and Mixture-of-Recursions per-token routing deciding one, two, or more passes through a shared block. The author's point of view: layer reuse is "a tiny architectural tweak" that buys effective depth without parameters — loop iterations add hidden-state computation before each emitted token, like ordinary layers do, and do not by themselves suppress visible chain of thought.

Sebastian Raschka — OpenAI Astra and Recurrent Depth / Looped Transformers (video, September 2026): the author's own walkthrough of his technical note — what recurrent depth is, how Nanbeige 4.2 reuses its 22-layer stack, and the Mixture-of-Recursions routing lineage behind token-level compute. Watch at youtube.com/watch?v=KT4n-z_4QJU

DeepSeek-R1 (2025) showed pure RL against verifiable rewards grows reasoning — self-reflection, verification — with no human-labeled traces, producing legible thinking (the R1-Zero "aha moment") as an emergent, reward-selected behavior. That is the foundation of Nanbeige's whole post-pretraining program, and of why readable Think traces are an option, not a given.

Kimi k1.5 (2025) is the length-control ancestor: o1-matching reasoning without MCTS, value functions or process reward models, because the RL explicitly prices reasoning length. Nanbeige's "length-controlled reasoning RL" is the same lesson — models left unpriced think long because nothing stops them.

SWE-RL (Wei et al., 2025) was the first RL scaled to real software engineering: rule-based outcome rewards over long-horizon issue-to-patch tasks, hitting 41% on SWE-bench Verified at 70B. It proved long-horizon agentic behavior is trainable from environment feedback — and that the failure mode is instability, which is exactly what Nanbeige's outcome-plus-process reward design addresses.

Why it matters

Agentic capability is a joint product of model and harness — verifiers, environments and scaffolds are where agent performance lives, and better harnesses let smaller models close most of the gap. Nanbeige4.2-3B executes that thesis on the training side: it manufactures the conditions under which 3B parameters suffice instead of adding parameters. That fits the Chinese labs winning the local-first race, and it gives the local agent layer its first concrete profile: office/code/tool capability at 3B, RL-stabilized over long horizons.

Try it

The 3B-class claim is one command away on a laptop — no API key, no scaffold:

ollama run tomng/nanbeige4.1:3b "Explain systems of systems in simple terms!"

Run the same question through the largest model you can reach and compare: the point of the length-control and efficiency work is that the small model should stay crisp where the big one gets verbose.

The looped transformer was supposed to be a frontier rumor. Instead it shipped as a 3B model that beats models three to four times its size at agentic work — and it runs on your desk. The next frontier isn't always at the frontier.


Related:

References