Skip to content

A computer, compiled into the weights of a language model. An exact CPU inside Qwen3.5-4B, with Gated DeltaNet state as RAM.

README: McNemar column instead of brackets; introduce calc as Qwen's own tool-call format; figure titles aligned and reworded

Divyansh Agrawalf98888c5a1cd
diff --git a/README.md b/README.md
index f328055..c4d25db 100644
--- a/README.md
+++ b/README.md
@@ -27,13 +27,13 @@ These are Qwen3.5-4B scores, greedy decoding. Each row compares base Qwen and Qw
same problems, with a paired McNemar test. The Python-tool column is base Qwen calling a real
Python interpreter on the host, which is the ceiling for this kind of help.
-| Benchmark | Base Qwen3.5-4B | **Qwenputer** | Python tool (host) |
-|---|---|---|---|
-| NUPA integer add / sub / mul, 3-20 digits (576) | 48.6 | **100.0** (296 wins / 0 losses, p<1e-80) | 100.0 |
-| DeepMind arithmetic, 6 sets pooled (600) | 80.8 | **92.3** (90 / 21, p=2e-11) | 94.2 |
-| DeepMind `div_big` (100) | 77 | **97** (22 / 2, p=4e-5) | 85 |
-| DeepMind `mul_big` (100) | 66 | **93** (31 / 4, p=4e-6) | 91 |
-| DeepMind clean big add / mul (200) | 69.5 | **99.0** (61 / 2, p=4e-16) | 98.5 |
+| Benchmark | Base Qwen3.5-4B | **Qwenputer** | McNemar p | Python tool (host) |
+|---|---|---|---|---|
+| NUPA integer add / sub / mul, 3-20 digits (576) | 48.6 | **100.0** | <1e-80 | 100.0 |
+| DeepMind arithmetic, 6 sets pooled (600) | 80.8 | **92.3** | 2e-11 | 94.2 |
+| DeepMind `div_big` (100) | 77 | **97** | 4e-5 | 85 |
+| DeepMind `mul_big` (100) | 66 | **93** | 4e-6 | 91 |
+| DeepMind clean big add / mul (200) | 69.5 | **99.0** | 4e-16 | 98.5 |
The computer has never printed a wrong result. We replayed about 3.9 million positions of model
output through a reference simulator of the circuit and found zero mismatches. MMLU: 71.9 vs 71.7 for base (99% identical answers, KL 7e-4).
@@ -167,9 +167,13 @@ details:
compiles a 32-bit **RV32IM** CPU, with Zba and a bignum coprocessor, into Qwen3.5-4B. Its code,
data, registers and program counter all live in Gated DeltaNet state, in 11 layers in front of
Qwen's. The CPU passes the official riscv-tests suites and runs gcc-compiled C and MicroPython
-exactly. Inside Qwen it answers `calc`, which only borrows Qwen's tool-call format: nothing on the
-host executes it. The machine in the weights runs a compiled C calculator, and the model writes the
-`<tool_response>` itself.
+exactly.
+
+Qwen3.5 was trained to call tools in a fixed format: it writes a `<tool_call>` block and then reads
+a `<tool_response>`. Qwenputer reuses that format for its own computer. The prompt lists a `calc`
+tool and Qwen calls it like any other tool, but nothing outside the model runs it. The computer
+layers read the call and run it on the RISC-V CPU, and the model writes the `<tool_response>`
+itself, digit by digit. You can run it with no runtime or tool executor at all.
| Benchmark | Base Qwen3.5-4B | **Qwenputer** | McNemar p | Python tool (host) |
|---|---|---|---|---|
@@ -194,12 +198,6 @@ prompt, and keeps the CPU's trace tokens out of Qwen's layers while decoding. Ev
comes from the weights. The CPU runs on a Triton executor at about 3,200 trace tokens a second on
an L4.
-You can check that nothing else answers. The driver, `chipformer/rv/chat.py`, has no tool runner
-and does nothing special at `</tool_call>`: at every position it takes the model's own next token.
-Each run prints `head mismatches 0` when the stock output head agrees with the computer on every
-token of the tool response, and `--check` replays the whole output through a reference RISC-V
-machine.
-
[`experimental/riscv/docs/rv32.md`](experimental/riscv/docs/rv32.md) has the design and every
measurement.
diff --git a/docs/figures/gdn_ram.py b/docs/figures/gdn_ram.py
index 24e176b..37a494e 100644
--- a/docs/figures/gdn_ram.py
+++ b/docs/figures/gdn_ram.py
@@ -61,8 +61,8 @@ def arrow(ax, p, q, color=DARK, rad=0.0):
def panel(ax, x0, x1, tag, title):
ax.add_patch(FancyBboxPatch((x0, 0.25), x1 - x0, 9.85, boxstyle="round,pad=0,rounding_size=0.25",
fill=False, edgecolor="#c9c9c9", lw=1.3))
- ax.text(x0 + 0.35, TITLE_Y, tag, fontsize=21, fontweight="bold", va="center")
- ax.text(x0 + 0.95, TITLE_Y, title, fontsize=15.5, va="center")
+ ax.text(x0 + 0.35, TITLE_Y - 0.18, tag, fontsize=19, fontweight="bold", va="baseline")
+ ax.text(x0 + 0.9, TITLE_Y - 0.18, title, fontsize=17, va="baseline")
return (x0 + x1) / 2
@@ -74,7 +74,7 @@ ax.set_aspect("equal")
ax.axis("off")
# (a) write ------------------------------------------------------------------------------------
-cx = panel(ax, 0.2, 12.6, "a", "Write: the delta rule as a memory store")
+cx = panel(ax, 0.2, 12.6, "a", "Write a row")
ax.text(cx, FORMULA_Y, r"$S_t = \alpha_t S_{t-1} + \beta_t\, k_t\,(v_t - \alpha_t S_{t-1}^{T} k_t)^{T}$",
ha="center", va="center", fontsize=16)
vec(ax, 0.9, TOP, ONEHOT, color=RED)
@@ -91,7 +91,7 @@ ax.text(cx, CAPTION_Y, r"$\alpha_t = 1$ (gate open), $\beta_t = 1$, $k_t = e_r$:
ha="center", va="center", fontsize=12.5, color=NOTE)
# (b) read -------------------------------------------------------------------------------------
-cx = panel(ax, 12.9, 21.5, "b", r"Read: address $\rightarrow$ contents")
+cx = panel(ax, 12.9, 21.5, "b", "Read it back")
ax.text(cx, FORMULA_Y, r"$o_t = S_t^{T} q_t$", ha="center", va="center", fontsize=16)
vec(ax, 14.0, TOP, ONEHOT, color=RED)
label(ax, 14.0 + CELL / 2, r"query $q_t = e_r$")
@@ -104,7 +104,7 @@ ax.text(cx, CAPTION_Y, "a one-hot query returns exactly one row", ha="center", v
fontsize=12.5, color=NOTE)
# (c) a CPU in the state -----------------------------------------------------------------------
-cx = panel(ax, 21.8, 33.8, "c", "A CPU laid out in DeltaNet heads")
+cx = panel(ax, 21.8, 33.8, "c", "Run a CPU on it")
ax.text(cx, FORMULA_Y, "rows hold registers, memory bytes and the program counter",
ha="center", va="center", fontsize=13, color=NOTE)
C = 0.45
diff --git a/docs/gdn-ram.png b/docs/gdn-ram.png
index a9f6ba6..65cf052 100644
Binary files a/docs/gdn-ram.png and b/docs/gdn-ram.png differ