Views
No views yet
Qwen2.5-Coder-7B-Instruct wired to a RISC-V CPU through Flamingo-style cross-attention. Emits one 32-bit RV32I instruction per cycle, conditioned on live machine state. The output head is a JEPA-style embedding predictor over a learned 691-row instruction codebook; nearest-neighbour decode gives free error-correction on individual predictions.Qwen/Qwen2.5-Coder-7B-Instruct at runtime. Total inference footprint: ~14 GB bf16 backbone + 4.4 GB adapters + activations."multiply 7 and 8", "compute 5 factorial", "say hi"), Reflex drives a Unicorn-backed RV32I emulator instruction by instruction. Each cycle:Qwen/Qwen2.5-Coder-7B-Instruct — frozen, bf16, untouched.(prompt, program) pairs across 56 RV32I program families (arithmetic, loops, comparisons, memory ops, display writes). Every program verified by running it end-to-end through Unicorn before training (zero rejects).(state, next_instruction) pairs, subsampled to ~173 k balanced across families.1e-4 → 1e-6 over 15 000 steps, batch 16.| section | pass |
|---|---|
| in-distribution (8) | 7 / 8 |
| out-of-distribution (10) | 9 / 10 |
| display strings (4) | 1 / 4 |
| novel zero-shot (9) | 7 / 9 |
| consistency: factorial 5 × 10 | 10 / 10 |
| total | 34 / 41 (83 %) |
popcount(255) = 8 in 199 consecutive correct RISC-V instructions — emergent bit-counting loop the model was never trained on.multiply 7×8, power 2^5, min(7,3,9), abs(-5), count up 1..5 all pass.BRANCH, R-type, LOAD, STORE, JAL, JALR predictions are 100 %. Every top-1 miss is same-opcode — never an opcode flip.1from reflex.demo import load, run_grounded
2
3model, tok, cfg = load("reflex.pt", device="cuda")
4cpu, emitted, halted, err = run_grounded(
5 model, tok, "multiply 7 and 8", device="cuda", max_cycles=200,
6)
7print(f"halted={halted} mem[0x5000]={cpu.mem_word(0x5000)}")
8# halted=True mem[0x5000]=56uv run demo --checkpoint reflex.pt1git clone https://github.com/ilbertt/reflex
2cd reflex
3uv sync
4huggingface-cli download ilbertt/reflex-coder7b-jepa-riscv reflex.pt --local-dir .Qwen2.5-Coder-7B-Instruct (~15 GB).show 42 writes '·0' instead of '42'; print hello writes 'hell·'. These are same-opcode ±1-immediate misses, not opcode flips.add 100+200 sometimes halts with 120; double 100 → 0 in some seeds. Failures concentrate on ADDI/LUI with rare immediate values."x5 is fever, display SICK" fail. The adapters only route the backbone's prior through for program-shaped prompts seen in training.reflex.pt — adapter weights, state encoder, cross-attn adapters, embedding head, 691-row instruction codebook, instruction-word buffer, and config dict (backbone_id, hidden, inject_every, adapter_mlp_ratio, max_instr_tokens, embed_dim, num_instrs, chat_template, context_prefix).