shem RV32IM

An RV32IM CPU compiled into network weights: one instruction per forward pass, exact. It is the neural vCPU of shem, which runs containers and VMs inside a model's weights, and these are its weights for shem 0.4.0.

Nothing here is learned. The weight compiler turns the instruction set, 48 instructions described as data, into the lookup and routing tables of the network's linear layers: decoding is a layer that counts mismatching bits, operands are attention reads of a register file, and results are routed by the decoded instruction. Memory and registers live in delta-rule state, as Gated DeltaNet layers hold memory. The network uses only linear maps, gating, clamps and one-hot attention, in float64, so every value it computes is exact.

Verified

  • All 60 official riscv-tests (rv32ui, rv32um, rv32ua) end in the same state as on shem's reference interpreter.
  • Random programs, snapshots resumed from the reference interpreter, forking containers, and a no-MMU Linux kernel running a shell command, about 180,000 instructions, end in identical states, all 64 MiB of RAM included.
  • On GPUs, every mode (eager, compiled, CUDA graphs) is bit-exact against the CPU.

Use

uvx --from shem-neural shem-neural-server &
shem run --vcpu neural program

The server compiles these same weights itself; this repository is the published copy, for inspection and for images that carry their CPU as a layer.

Files

File What it is
model.safetensors The weights, 18 tensors, 77,744 values, float64
config.json The machine: its instruction set and the names of the units the routing tables select
Downloads last month
108
Safetensors
Model size
77.7k params
Tensor type
F64
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Article mentioning jgalego/shem-rv32im