Qwomputer 9B (experimental)

Qwomputer 9B (experimental)

Qwen3.5-9B with a RISC-V computer compiled into the weights.

When Qwen uses its calc tool, it's not Python or a sandbox that's giving you the answer. It's a 32-bit RV32IM CPU running in the model's own forward passes, precisely.

This is the Qwenputer machine from divagr1925 ported to 9B.

No weights for the computer were trained. They're all calculated by a compiler.

Qwen's weights are untouched.

I built this out of curiosity, to see if a bigger model still gets much out of the built-in computer, or if it's already good enough at arithmetic not to need it.

This is an experiment. The computer only runs inside Qwenputer's own decoding loop (RvChat, see Usage). Plain generate() loads the model but won't give you the machine's answers.

Benchmarks

Qwomputer 9B benchmarks

  • The in-weights computer gives 35 more points to 9B (162->197/200). 49 more points to 4B (143->192). The largest gain is for big multiplications. 30->40 for 9B. 19->39 for 4B. Long mul_div chains are already good on the base models (34,38), so not much gain.
  • All computer responses were exact (0 lockstep errors, 0 head mismatches vs reference RISC-V machine). 1,020 tool calls, 4.9M tokens of machine.
  • The larger model is more effective at using the tool. The 4B model tends to double-check its own answer a lot, repeatedly calling calc (164 calls for 40 synthetic problems). The 9B model tends to call once and give an answer (41 calls). It's 1.8-3.9x faster per problem for 4 of the 5 sets.
  • 9B's misses are Qwen's (not the machine's) - 2 long re-call loops on div_big, 1 long mul_div expression Qwen broke up and set up incorrectly (but the machine got all the pieces right)
  • The 9B base tends to return rounded decimal (instead of the exact fraction) for div_big so that's why it is worse than 4B base in there.

What's different from the 4B

How the machine works is documented in the Qwenputer repo. This build uses the same compiler and the same calc firmware. Only the parts that depend on the base model change:

  • 11 chip layers in front of Qwen3.5-9B's 32 layers.
  • The hidden size goes from 4096 to 5632 to make room for the circuit.
  • The 9B has its own output head (the 4B ties it to the embeddings). It keeps Qwen's weights and gets the circuit's readout columns.
Qwen3.5-9B Qwomputer 9B
Layers 32 11 chip + 32
Hidden size 4096 5632
Vocabulary 248,320 478,656
Stored parameters 9.0B 18.2B (mostly zero padding)
Checkpoint (bf16) 19 GB 36.4 GB

This is a new build with Qwenputer's compiler, streamed to fit in 13GB of RAM. The published 4B Qwenputer built the same way is 572/580 tensors bit identical. The remaining 8 are GPU-fitted and off by one bf16 step.

Usage

The computer runs inside Qwenputer's decoding loop, RvChat. It loads the calc firmware into the machine, then decodes the machine's tokens and the text in lockstep. Clone the code, install it, and run the example below from qwenputer/experimental/riscv:

git clone https://github.com/divagr18/qwenputer
cd qwenputer/experimental/riscv && uv sync --extra hf

lowmem.py and w8.py in this repo load the model into ~10 GiB of GPU memory:

  • Dense chip layers are not used, instead, the decoding loop uses the exact fp32 Triton executor for the circuit.
  • The zero padding is dropped.
  • Qwen's linear layers are int8 weight-only.
import sys
from huggingface_hub import snapshot_download

path = snapshot_download("Loke-60000/qwomputer-9b-exp")
sys.path.insert(0, path)  # lowmem.py and w8.py ship with the model

from chipformer.rv import bridge as BR, elf, ref
from lowmem import LowRvChat

chat = LowRvChat(path)
machine = ref.Machine.from_program(elf.program("tests/data/rv/calc-bridge.elf"))
BR.park(machine)

ids = chat.prompt_ids([{"role": "user", "content": "Use calc: what is 123456789 * 987654321?"}])
out = chat.generate(ids, machine, max_new=600)
print(chat.text_of(out["tokens"]))
# ... <tool_response>121932631112635269</tool_response> ...
# The product of 123456789 and 987654321 is **121,932,631,112,635,269**.

Greedy decode. Disable thinking. The system prompt for Qwen to use the tool every time is in chipformer/rv/evalarith.py (NUDGE).

Limitations

  • It makes arithmetic exact, not reasoning better. Word problems are still up to Qwen.
  • Qwen sometimes calls calc again on an answer it already has, and can loop until it runs out of tokens.
  • Each call adds hundreds to thousands of machine tokens to the cache (about 2,300 for a big product).
  • The benchmarks are small: 40 problems per set, run with int8 Qwen layers.

License

Apache-2.0 (same for base model Qwen/Qwen3.5-9B and Qwenputer weights). MIT for Qwenputer compiler and decoding code (from divagr18). This is a derivative of both Qwen weights and Qwenputer-compiled circuit. See LICENSE.

Downloads last month
433
Safetensors
Model size
18B params
Tensor type
BF16
ยท
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Loke-60000/qwomputer-9b-exp

Collection including Loke-60000/qwomputer-9b-exp