CharlesCNorton commited on
Commit
782741e
Β·
1 Parent(s): 55a7cc7

Give neural_attractor and neural_reversible a machine metadata field and eval_all skip entries, so python src/eval_all.py variants/ skips them cleanly instead of erroring (it scores fitness variants and skips standalone machines by that field). README sync: list both new machines in the variant table, intro, and repository layout; correct the standalone-machine count (5->7), the eval_all skip count (four->seven), and the universal-constructor family round-trip (23->26 files, 551->971 MB, both new files codec-verified byte-identical).

Browse files
README.md CHANGED
@@ -38,10 +38,12 @@ variants/neural_rv32.safetensors RV32IM + F-subs
38
  variants/neural_matrix8.safetensors the CPU as one recurrent ternary matrix stack
39
  variants/neural_subleq8io.safetensors SUBLEQ host for the universal constructor
40
  variants/neural_reflect.safetensors interpreter whose state holds its own weights
 
 
41
  ```
42
 
43
- Five further machines are detailed in their own sections below, and together
44
- they carry the family from the smallest possible processor to three results
45
  about what a threshold network can be. `neural_subleq8` is a Turing-complete
46
  one-instruction computer whose entire control flow is a single threshold
47
  neuron. `neural_rv32` is a RISC-V processor (RV32IM plus an F subset) that
@@ -56,7 +58,13 @@ machine's weight file byte for byte, self-reproduction being the case where
56
  the description is its own. And `neural_reflect` is a universal interpreter
57
  over ternary threshold netlists: its fixed transition circuit evaluates a
58
  netlist held in the writable state, so the machine it runs is stored data that
59
- a program reads, edits, and reproduces.
 
 
 
 
 
 
60
 
61
  ---
62
 
@@ -352,7 +360,7 @@ Every weight and bias tensor in the canonical model fits in `int8`. The eval pip
352
 
353
  The 8-bit arithmetic and ALU tests use strategic sampling rather than the full 65,536-case sweep because exhaustive coverage at 8-bit is feasible but not necessary given that the circuits are constructed gate-by-gate. The 16-bit and 32-bit arithmetic tests sample edge cases only; full exhaustive coverage at those widths is infeasible without specialized hardware.
354
 
355
- `src/eval_all.py` runs the unified suite. Exit code is the number of failing variants (0 means all pass). **Testing is evaluation, not rebuilding**: `python src/eval_all.py variants/` scores all 18 fitness variants against the shipped weights in about two minutes (~6 s each, the composed float netlists evaluated in `NetlistEvaluator`'s leveled mode) and cleanly skips the four standalone machines. Rebuilding the models (`tools/build_all.py`, ~50 min for all 18) is a separate step, needed only when the circuit constructions in `src/build.py` change; routine verification never rebuilds. The batched evaluator is population-safe: every chained intermediate (carry, borrow, mux select) is computed per population slot, so `tools/prune_weights.py`'s parallel fitness screens are exact rather than slot-0 approximations.
356
 
357
  ---
358
 
@@ -516,8 +524,8 @@ then the byte-for-byte safetensors file of the host itself.
516
 
517
  The equality is machine-checked rather than observed on one run:
518
 
519
- - the recipe codec round-trips every file in the family (all 23 shipped
520
- `.safetensors`, 551 MB, byte-identical and sha-verified);
521
  - the constructor program is executed on three independently-verified
522
  backends β€” a pure-integer reference, the gate-graph `SubleqThresholdCPU`
523
  walking the shipped netlist, and the host itself compiled to recurrent
@@ -821,9 +829,10 @@ Loss components: BCE on output bits, BCE on extracted A and B bits (2Γ— weight),
821
 
822
  ```
823
  neural_computer.safetensors canonical model (32-bit, 64 KB, ~8.61M params)
824
- variants/ 18 fitness variants + 5 standalone machines
825
  (neural_subleq8, neural_rv32, neural_matrix8,
826
- neural_subleq8io, neural_reflect)
 
827
  src/ the library (run scripts as `python src/<name>.py`)
828
  β”œβ”€β”€ build.py generator (one safetensors per invocation; also `subleq`, `rv32`)
829
  β”œβ”€β”€ quantize.py min integer dtypes + ternary verification/repair
@@ -835,12 +844,20 @@ src/ the library (run scripts as `python src/<nam
835
  β”‚ exhaustive equality suite and the analog crossbar simulation
836
  β”œβ”€β”€ constructor8.py the neural_subleq8io host, the recipe codec, and the universal
837
  β”‚ constructor / self-reproduction suite
838
- └── reflect.py neural_reflect: a universal threshold interpreter whose state
839
- holds its own gate table; universality / quine / matrix suites
 
 
 
 
 
 
840
  tools/ build_all.py (build + quantize + verify every profile),
841
  cpu_programs.py (assembler + CPU program suite), test_cpu.py
842
  (program suite vs a variant), play.py (interactive demo),
843
- prune_weights.py (GPU-batched weight reduction)
 
 
844
  llm_integration/ SmolLM2 extractor + circuit wrapper + training code
845
  β”œβ”€β”€ circuits.py FrozenThresholdCircuits (loads safetensors, exposes
846
  β”‚ add_8bit / sub_8bit / mul_8bit / compare_*)
 
38
  variants/neural_matrix8.safetensors the CPU as one recurrent ternary matrix stack
39
  variants/neural_subleq8io.safetensors SUBLEQ host for the universal constructor
40
  variants/neural_reflect.safetensors interpreter whose state holds its own weights
41
+ variants/neural_attractor.safetensors energy-based solver; a multiplier run backward factors
42
+ variants/neural_reversible.safetensors reversible arithmetic core, a bijection with no erasure
43
  ```
44
 
45
+ Seven further machines are detailed in their own sections below, and together
46
+ they carry the family from the smallest possible processor to several results
47
  about what a threshold network can be. `neural_subleq8` is a Turing-complete
48
  one-instruction computer whose entire control flow is a single threshold
49
  neuron. `neural_rv32` is a RISC-V processor (RV32IM plus an F subset) that
 
58
  the description is its own. And `neural_reflect` is a universal interpreter
59
  over ternary threshold netlists: its fixed transition circuit evaluates a
60
  netlist held in the writable state, so the machine it runs is stored data that
61
+ a program reads, edits, and reproduces. `neural_attractor` drops sequential
62
+ control entirely: a circuit compiles to an energy function whose minimum is its
63
+ consistent assignment, so clamping different wires runs the same network forward
64
+ to evaluate, backward to invert (a multiplier run backward returns factors), or
65
+ as a SAT solver. And `neural_reversible` makes the entire state transition a
66
+ bijection, so no step erases information and the machine runs backward to
67
+ reconstruct its input, a processor with no Landauer erasure floor.
68
 
69
  ---
70
 
 
360
 
361
  The 8-bit arithmetic and ALU tests use strategic sampling rather than the full 65,536-case sweep because exhaustive coverage at 8-bit is feasible but not necessary given that the circuits are constructed gate-by-gate. The 16-bit and 32-bit arithmetic tests sample edge cases only; full exhaustive coverage at those widths is infeasible without specialized hardware.
362
 
363
+ `src/eval_all.py` runs the unified suite. Exit code is the number of failing variants (0 means all pass). **Testing is evaluation, not rebuilding**: `python src/eval_all.py variants/` scores all 18 fitness variants against the shipped weights in about two minutes (~6 s each, the composed float netlists evaluated in `NetlistEvaluator`'s leveled mode) and cleanly skips the seven standalone machines. Rebuilding the models (`tools/build_all.py`, ~50 min for all 18) is a separate step, needed only when the circuit constructions in `src/build.py` change; routine verification never rebuilds. The batched evaluator is population-safe: every chained intermediate (carry, borrow, mux select) is computed per population slot, so `tools/prune_weights.py`'s parallel fitness screens are exact rather than slot-0 approximations.
364
 
365
  ---
366
 
 
524
 
525
  The equality is machine-checked rather than observed on one run:
526
 
527
+ - the recipe codec round-trips every file in the family (all 26 shipped
528
+ `.safetensors`, 971 MB, byte-identical and sha-verified);
529
  - the constructor program is executed on three independently-verified
530
  backends β€” a pure-integer reference, the gate-graph `SubleqThresholdCPU`
531
  walking the shipped netlist, and the host itself compiled to recurrent
 
829
 
830
  ```
831
  neural_computer.safetensors canonical model (32-bit, 64 KB, ~8.61M params)
832
+ variants/ 18 fitness variants + 7 standalone machines
833
  (neural_subleq8, neural_rv32, neural_matrix8,
834
+ neural_subleq8io, neural_reflect,
835
+ neural_attractor, neural_reversible)
836
  src/ the library (run scripts as `python src/<name>.py`)
837
  β”œβ”€β”€ build.py generator (one safetensors per invocation; also `subleq`, `rv32`)
838
  β”œβ”€β”€ quantize.py min integer dtypes + ternary verification/repair
 
844
  β”‚ exhaustive equality suite and the analog crossbar simulation
845
  β”œβ”€β”€ constructor8.py the neural_subleq8io host, the recipe codec, and the universal
846
  β”‚ constructor / self-reproduction suite
847
+ β”œβ”€β”€ reflect.py neural_reflect: a universal threshold interpreter whose state
848
+ β”‚ holds its own gate table; universality / quine / matrix suites
849
+ β”œβ”€β”€ attractor.py neural_attractor: energy-based solver (forward eval, inversion,
850
+ β”‚ SAT) built from a QUBO gate-gadget compiler
851
+ β”œβ”€β”€ reversible.py neural_reversible: reversible threshold gates, Cuccaro ALU,
852
+ β”‚ Bennett construction
853
+ β”œβ”€β”€ reversible_cpu.py reversible register machine: bijective step, backward execution
854
+ └── reversible_prog.py structured reversible programs (multiply, Fibonacci, Janus IF)
855
  tools/ build_all.py (build + quantize + verify every profile),
856
  cpu_programs.py (assembler + CPU program suite), test_cpu.py
857
  (program suite vs a variant), play.py (interactive demo),
858
+ prune_weights.py (GPU-batched weight reduction),
859
+ build_attractor.py / test_attractor.py (neural_attractor),
860
+ build_reversible.py (neural_reversible artifact)
861
  llm_integration/ SmolLM2 extractor + circuit wrapper + training code
862
  β”œβ”€β”€ circuits.py FrozenThresholdCircuits (loads safetensors, exposes
863
  β”‚ add_8bit / sub_8bit / mul_8bit / compare_*)
src/attractor.py CHANGED
@@ -223,7 +223,7 @@ def to_tensors(circ: Circuit, io: dict):
223
  t = {"Q_idx": q_idx, "Q_val": q_val, "L_idx": l_idx, "L_val": l_val,
224
  "gate_op": g_op, "gate_out": g_out, "gate_in": g_in}
225
  import json
226
- meta = {"n": str(circ.n), "const": str(circ.const),
227
  "io": json.dumps({k: v for k, v in io.items()})}
228
  return t, meta
229
 
 
223
  t = {"Q_idx": q_idx, "Q_val": q_val, "L_idx": l_idx, "L_val": l_val,
224
  "gate_op": g_op, "gate_out": g_out, "gate_in": g_in}
225
  import json
226
+ meta = {"machine": "attractor", "n": str(circ.n), "const": str(circ.const),
227
  "io": json.dumps({k: v for k, v in io.items()})}
228
  return t, meta
229
 
src/eval_all.py CHANGED
@@ -670,6 +670,8 @@ MACHINE_VERIFIER = {
670
  "matrix8": "matrix8.py",
671
  "subleq8io": "constructor8.py",
672
  "reflect": "reflect.py",
 
 
673
  }
674
 
675
 
 
670
  "matrix8": "matrix8.py",
671
  "subleq8io": "constructor8.py",
672
  "reflect": "reflect.py",
673
+ "attractor": "tools/test_attractor.py",
674
+ "reversible": "src/reversible.py",
675
  }
676
 
677
 
tools/build_reversible.py CHANGED
@@ -52,7 +52,7 @@ def main() -> int:
52
 
53
  tensors = {"gate_code": codes, "gate_args": args, **_SUBSTRATE}
54
  import json
55
- meta = {"width": str(WIDTH), "n_wires": str(n),
56
  "a_bits": json.dumps(a_bits), "b_bits": json.dumps(b_bits),
57
  "carry": str(carry), "circuit": "in-place reversible adder b<-a+b"}
58
  save_file(tensors, OUT, metadata=meta)
 
52
 
53
  tensors = {"gate_code": codes, "gate_args": args, **_SUBSTRATE}
54
  import json
55
+ meta = {"machine": "reversible", "width": str(WIDTH), "n_wires": str(n),
56
  "a_bits": json.dumps(a_bits), "b_bits": json.dumps(b_bits),
57
  "carry": str(carry), "circuit": "in-place reversible adder b<-a+b"}
58
  save_file(tensors, OUT, metadata=meta)
variants/neural_attractor.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ad9bb1b7bb6110bc76fc2f946f822c7bc80dbba9673b2547a780b56690938150
3
- size 95968
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:447c649f73bf3e1ad310a541954e942f70778c591c8fb61018c24973203c13d8
3
+ size 95984
variants/neural_reversible.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9ee9363e618d246cc2009082e61ccc48fc237917d75231bb417e9175238073f1
3
- size 2304
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b77a985dea3104679d73cfaf20b9c3efc72646cd177412dbec41475a7a37d5c0
3
+ size 2320