Weight-Space Micromachines: Brain Implants for LLMs Anadim's open-source project, weight-space micromachines, lets AI agents write small modules directly into a frozen LLM's weights, lifting Qwen3-0.6B-Base from 41% to 55% on BIG-Bench Hard and from 13% to 35% on IFEval without reinforcement learning. Attaching the implants before RL also improved GSM8K to 80% versus 68% for plain RL, BIG-Bench Hard to 60% versus 54%, and IFEval to 48% versus 46%. The modules stay off until a task needs them, leaving the model bit-for-bit unchanged otherwise, and the code is published at github.com/anadim/weight-space-micromachines. TL;DR AI agents can write small modules "implants" straight into weight space and bolt them onto a frozen LLM: a calculator, "eyes" for images, a mistake detector, a little memory that lets the model retry a problem and vote inside one call. Implants stay OFF until needed, so the model is bit-for-bit unchanged until one fires. Attaching them alone climbs benchmarks like RL but without RL: on Qwen3-0.6B-Base, BIG-Bench Hard goes from 41% to 55%, IFEval from 13% to 35%. You can also RL with implants attached: on GSM8K, RL with implants reaches 80% vs 68% for plain RL, BIG-Bench Hard 60% vs 54% and IFEval 48% vs 46%. Code: github.com/anadim/weight-space-micromachines https://github.com/anadim/weight-space-micromachines . Today, teaching a language model a new skill means fine-tuning or RL on data that exercises it, and hoping nothing else breaks, or wrapping the model in tools, sandboxes and parsers. What if instead you could write the skill straight into the model's weights? Like having an exact co-processor that comes with the model, stays off until it's needed, one that can even be trained/RL'd along with it? This was an old wish of mine In 2023, in Looped Transformers as Programmable Computers https://arxiv.org/abs/2301.13196 \ 1\ https://arxiv.org/abs/2301.13196 , Angeliki and Shashank hand picked the weights of a transformer and put it in a loop so that the model could run programs a calculator, a computer, a full blown gradient descent run in context . The process was quite painful, but the results were cute and the "looped transformer" name stuck around : . At some point in the paper we wrote verbatim : we hope that our findings will contribute to the development of methods to enhance the capabilities of trained language models by utilizing smaller, reverse-engineered transformer networks for specific algorithmic tasks We really wanted to do this back then, but handwriting even small circuits was painful, especially ones working in token space that then had to be attached to a bigger model. So it never happened. H owe v er , agents can now read/ e di t weights directly , as our MIT friends showed with weight-space programming https://rikiyat.github.io/blog/weight-space-programming/ \ 2\ https://rikiyat.github.io/blog/weight-space-programming/ . So I had Claude Code try this on a few small open models. The recipe was a simple loop: 1 run the model, 2 read its failures, 3 pick the ones that follow a pattern a small machine could fix, 4 write that machine into weights, 5 bolt it on the model and keep if the scores go up. Then, repeat. Doing so on a couple of small models and evals, Claude wrote a calculator, state trackers, logic solvers, instruction-following rules as exact programs compiled into weights... plus a small machine with a small trained part: a pair of eyes Bolted onto the weights of a frozen model, each one of these little machines stays silent until it is needed for a task. When they work together, they can increase accuracy on small models by double digits on arithmetic, GSM8K, BIG-Bench Hard and IFEval type of tasks. I call these little machines, weight-space micromachines WSMs , or... brain implants for LLMs : Here is a summary of results: Here is a summary of the headline results on Qwen3-0.6B top and Qwen3-1.7B bottom . On GSM8K, BIG-Bench Hard and IFEval it compares: the model alone, implants with no RL, plain RL, implants attached then RL, and RL then implants attached. To be fair, most of the pieces here aren't new: people have compiled programs into transformers https://arxiv.org/abs/2301.05062 , put exact calculators inside networks https://arxiv.org/abs/2501.00684 , and trained models to use tools with RL https://arxiv.org/abs/2504.11536 more on that in Related work . What I am doing here is perhaps putting it all under one umbrella: small, sometimes exact add-ons, written by an agent, that come bolted on the model and are RL'able along with it. And no, these are not LoRAs. A LoRA is a low-rank change applied across the model's own weights, learned from data. An implant is a separate module on the side: attaching it doesn't change the model's weights, it computes one specific thing you can read and test the calculator was exact on every arithmetic test we ran , it stays OFF until it's needed, and you can add, remove or compose as many as you like. And yes, you can think of most of these as tools. But unlike a tool, they live in weight space, inside the forward pass, you can train the model together with them and RL teaches the model when to use them and the model distribution and weights reshapes around them. Let me tell you a little bit more about it. The idea is simple. Say your model would do better if it could compute f x , but teaching it f is hard, expensive or perhaps bad for its other skills, and using a tool, or an inference-time intervention eg, best-of-N , means having a sandbox and orchestration around the model. Instead one could have an agent write a small machine in weight space a micromachine that computes f x exactly, and attach it to the model. Akin to a... brain implant A bit reminiscent of Neo in The Matrix: they "upload" the program in his brain, and seconds later: Notice how there's no sandbox around Neo, and no Python code wrapped around him: it's all in his brain. That's what I'm talking about So you or Claude create an implant, attach it to the model, and it does exactly one thing, and only when it's supposed to; the rest of the time it stays OFF, and the outputs are bit-for-bit identical to the original . Remove an implant and you get the original model back. Well once you RL the model with an implant attached, the model leans on it, more on that in §5 5-rl-with-all-the-implants . When I say "all in the weights" I mean t his literally: every implant is extra weights plus in some cases a few registers, which act as a small memory implant that run inside the forward pass and the decode only samples tokens. There is nothing programmatic allowed around the model. The implant, in weight space, sits "parallel" to the model and reads the same tokens as the model or, as we'll see later, some of its hidden layers . Though it doesn't have to sit on the side: it could be wired in as a few more attention heads, an extra layer, or written into dead neurons the model doesn't use, like Lazarus https://x.com/DimitrisPapail/status/2120245027804705121?a=QModSGHsBrrZImFtglU&s=20 . But a separate, parallel block is just easier, and if you fine-tune the model later, you don't mess with the implant or the other way around . A concrete example of how it works: when the model has just written 2595 + 3075 = , a calculator implant recognizes that the model is about to compute an addition, and it steps in : it adds a vector to the model's last hidden state, right before the output layer, big enough so that the next tokens are sampled to be exactly 5670 . Unlike a brain implant, the model doesn't know the implant is there : But it sees the right number show up in its own context and keeps on going. OK cool Let's see a few examples of t hese micromachines. The first thing that came to mind was a calculator, as arithmetic is a classic failure mode of small and larger https://x.com/maksym andr/status/2100275583758327954?a=5CZU0SmBxtZ1EqCJBbM&s=20 models. I asked Claude Code to build one in weights and attach it to a small Qwen model. It works like a tiny ALU the part of a CPU that does arithmetic and does so in three steps: Only the Read and Write ends are "fitted" to the model. The arithmetic in the middle is a program Claude wrote that is compiled into ReLU layers. The whole implant is about 2.4M weights, and yes, we know https://github.com/anadim/AdderBoard , it could be much smaller. But it's still tiny compared to the 600M parameters of the model. Claude tested it on every pair of numbers up to 59, every signed pair from −40 to 39 and 12k random pairs, for all four operations, and.... 0 mistakes hooray. On a frozen Qwen3-0.6B, the calculator increases 4 digit multiplication accuracy from near zero to 100% . Booyah Does that p art icular i mplant help on actual but still silly math problems? On GSM8K https://arxiv.org/abs/2110.14168 \ 6\ https://arxiv.org/abs/2110.14168 the calculator barely helps Qwen3-0.6B https://arxiv.org/abs/2505.09388 \ 5\ https://arxiv.org/abs/2505.09388 : eg it goes from 52% to 53%. But on GSM-Hard https://arxiv.org/abs/2211.10435 \ 4\ https://arxiv.org/abs/2211.10435 , the same GSM8K test questions with bigger numbers it goes from 27% to 35% 26% to 33% on problems we never tuned the calculator on . RL widens that gap §3.1 3-1-setup-and-the-calculator-on-gsm8k-after-rl . So the implant works, and works only when the model actually uses it. To use it in the above calculator case we just showed it a few in context examples in the prompt. But can we teach it to use the calculator instead? You can teach the model to use an implant by fine-tuning it on format so it learns to call the implant, the way you'd teach a model a tool-calling format, eg., a call looks like