After Qwenputer, I wondered if a smaller model could do it too. So I built a Forth interpreter into Nemotron 3.5 Lightning's weights

Wait 5 sec.

I learned RPN on an HP calculator and later spent more time with Forth than was strictly useful. When I saw Qwenputer compile a machine into a language model's weights, I wanted to know two things. Would a stack language fit that idea well? And could a model with only 3B active parameters drive a machine like that? The setup: NVIDIA Nemotron 3.5 Lightning (30B, 3B active) is left unchanged. Next to it, in the same model, is a second network of 27 layers. A Python script calculated its weights; none of them are trained. It is a Forth interpreter. The model writes a Forth block as ordinary text. The interpreter runs each word while the model is still writing, one step per forward pass. When the block closes, it writes the output as the model's next tokens. No tool call occurs, and generation does not stop. RPN suits this well. A Forth word ends at a space, so the machine can run it as soon as the next word starts, without parsing the whole program. Operands come before the operator, so when the model writes +, both numbers are already on the stack. That is the order a left-to-right model writes in anyway. The stack itself lives in Mamba-2 state. One entry is one row, 20 digits wide, and popping a number means adding its exact negative. Getting the machine exact took some care. bf16 holds integers exactly only up to 256, so no value inside the machine goes above that. Every Mamba decay is set to exactly 1, so nothing fades. The machine's internal steps use 982 reserved tokens that the model never uses and that decode to empty strings. In testing, all 765,734 machine tokens matched a Python reference. The model was harder than the machine. An earlier version on a small Qwen model matched the machine exactly, and a model that could not use it. Stock Lightning did better, but it did not trust the results. In one transcript, it got the right answer from the machine, then started long division by hand until it ran out of tokens. It also scored lower on easy problems when the machine was available. LoRA fine-tuning fixed most of that: on a 600-problem held-out test, the score went from 79.1% to 92.1%. On Qwenputer's arithmetic sets, the results are mixed. On the DeepMind sets, it roughly ties stock Lightning, mostly because a 30B thinking model rarely needs the machine there. On long integers, it loses to Python, because my machine stops at 20 digits. This is a research project, not something for production. Every machine step costs a full forward pass, so a normal tool call is much faster. I'm sharing it for people who follow the Qwenputer work or want to try similar things on NVIDIA's stack. The repo has: - the kernel builder and its parity tests; - a vLLM plugin for the hybrid Mamba/MoE model; - the NeMo AutoModel LoRA recipes and the training data; - NVFP4, GGUF and MLX builds; - notes on what did not work, including RL. Everything is MIT. https://github.com/markab21/rpn-gpt Congrats again on the great work and inspiration from the qwenputer devs 🤗 , and thanks for sharing your work with the community - it was a great starting point to experiment with Forth. Next up for the project is to see how Nvidia's Nemotron 3.5 Super does and might even try to get it working on the Ultra weights. (I don't have the hardware to do the fine-tuning on a model that big)   submitted by   /u/Mr_Finious [link]   [comments]