CharlesCNorton commited on
Commit ·
f6bd63a
1
Parent(s): 7e7dca3
neural_reflect: condense its README section to the family's house style; remove the version tag from the module and the model manifest
Browse files- README.md +22 -43
- src/reflect.py +14 -11
- variants/neural_reflect.safetensors +2 -2
README.md
CHANGED
|
@@ -526,49 +526,28 @@ out = H( w0·sig[eff(a0,i0)] + w1·sig[eff(a1,i1)] + bias ) ; sig[eff(oa,oidx)
|
|
| 526 |
`G` recurrences sweep the netlist once; `G` sweeps settle any acyclic netlist
|
| 527 |
regardless of gate order, so U reproduces the family's combinational evaluation.
|
| 528 |
|
| 529 |
-
- **
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
the
|
| 533 |
-
|
| 534 |
-
the
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
streams the netlist's own bytes to the output device, emitting its own
|
| 552 |
-
description. A single program computes `a & b` and then edits its own gate so
|
| 553 |
-
the next sweep computes `a & ~b`, and a program-set `BANK` flag switches the
|
| 554 |
-
interpreter to a different resident machine without an external load step.
|
| 555 |
-
- **State.** A stored netlist with feedback holds state across sweeps: a 2-bit
|
| 556 |
-
counter advances `0, 1, 2, 3, 0` as U is iterated.
|
| 557 |
-
- **Physical reading.** One recurrence is one matrix-vector product followed by
|
| 558 |
-
a threshold; each write is one bit of the state. On a memristive crossbar
|
| 559 |
-
that bit is a conductance, so a program editing the netlist region is the
|
| 560 |
-
computation editing the array's own weights.
|
| 561 |
-
|
| 562 |
-
Verified against a reference interpreter: exhaustive single-gate semantics
|
| 563 |
-
(every ternary weight pair, bias, and input assignment), single-step agreement
|
| 564 |
-
on random full states with halted states as fixed points, bit-exact
|
| 565 |
-
interpretation of the ripple-carry adder and the SUBLEQ datapath (all 65,536
|
| 566 |
-
pairs) under sorted and shuffled gate order, one hosted SUBLEQ instruction over
|
| 567 |
-
4,096 random memory states and a stored program run to a halt, the
|
| 568 |
-
self-reproduction, self-rewrite, and bank-switch programs, the counter holding
|
| 569 |
-
state through feedback, and equality of the compiled matrix form with the gate
|
| 570 |
-
graph, the 0.5 comparator margin measured under read noise and conductance
|
| 571 |
-
mismatch.
|
| 572 |
|
| 573 |
```bash
|
| 574 |
python src/reflect.py verify # universality, a hosted SUBLEQ machine, quine, metamorphosis
|
|
|
|
| 526 |
`G` recurrences sweep the netlist once; `G` sweeps settle any acyclic netlist
|
| 527 |
regardless of gate order, so U reproduces the family's combinational evaluation.
|
| 528 |
|
| 529 |
+
- **Universal over the family, at scale.** `compile_to_reflect` maps any
|
| 530 |
+
≤2-input family `Net` to a stored netlist; a ripple-carry adder and the
|
| 531 |
+
family's own SUBLEQ datapath run through U bit-exact, the datapath checked
|
| 532 |
+
against the reference over all 65,536 operand pairs and independent of the
|
| 533 |
+
order the gates are stored in. Because the netlist is read by gate index
|
| 534 |
+
rather than by address, the addressed signal span stays small as the gate
|
| 535 |
+
count grows.
|
| 536 |
+
- **A complete stored machine runs inside it.** The whole SUBLEQ machine, its
|
| 537 |
+
32-byte memory held in signals, executes as a 266-gate microprogram: fetch
|
| 538 |
+
three operand bytes, read two data bytes, subtract, write the result back,
|
| 539 |
+
branch, one instruction per sweep, with the interpreter's own indexed
|
| 540 |
+
addressing serving as the memory-access hardware and the memory and program
|
| 541 |
+
counter carrying across sweeps. A stored countdown program runs its loop to a
|
| 542 |
+
halt with final memory matching the reference emulator, and one instruction
|
| 543 |
+
is exact over 4,096 random memory states.
|
| 544 |
+
- **The program is its own weights.** When the netlist is address-reachable a
|
| 545 |
+
gate writes into it: one program streams the netlist's own bytes out the
|
| 546 |
+
output device, another computes `a & b` and then rewrites its own gate so the
|
| 547 |
+
next sweep computes `a & ~b`, and a `BANK` flag runs a different resident
|
| 548 |
+
machine in place. A netlist with feedback holds state across sweeps (a 2-bit
|
| 549 |
+
counter), and the compiled matrix form equals the gate graph within the same
|
| 550 |
+
0.5 comparator margin, measured under read noise and conductance mismatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
```bash
|
| 553 |
python src/reflect.py verify # universality, a hosted SUBLEQ machine, quine, metamorphosis
|
src/reflect.py
CHANGED
|
@@ -29,14 +29,17 @@ G recurrences sweep the netlist once; G sweeps settle any acyclic netlist
|
|
| 29 |
regardless of gate order, so U reproduces the family's combinational evaluation.
|
| 30 |
|
| 31 |
Capabilities:
|
| 32 |
-
- compile_to_reflect() maps any <=2-input family Net to a stored netlist;
|
| 33 |
-
family's
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
- The accumulator width follows from F and the bias width. U compiles to a
|
| 41 |
recurrent ternary matrix stack equal to the gate graph, with a measured
|
| 42 |
noise and conductance-mismatch margin.
|
|
@@ -551,7 +554,7 @@ def build(cfg, save=True):
|
|
| 551 |
tensors = {f"matrix.layer{i:03d}.weight": Wt for i, (Wt, _) in enumerate(layers)}
|
| 552 |
tensors.update({f"matrix.layer{i:03d}.bias": B for i, (_, B) in enumerate(layers)})
|
| 553 |
for k, v in (("signals", cfg.S), ("gates", cfg.G), ("banks", cfg.banks),
|
| 554 |
-
("state_bits", cfg.STATE_BITS), ("layers", info["layers"])
|
| 555 |
tensors[f"manifest.{k}"] = torch.tensor([float(v)])
|
| 556 |
meta = {"machine": "reflect", "weight_quantization": "ternary",
|
| 557 |
"config": json.dumps({"A": cfg.A, "S": cfg.S, "G": cfg.G, "F": cfg.F,
|
|
@@ -717,7 +720,7 @@ def verify(cfg, device):
|
|
| 717 |
f"(a stored machine holding state through feedback): {seq}")
|
| 718 |
ok &= kgood
|
| 719 |
|
| 720 |
-
print("\
|
| 721 |
"PASS" if ok else "FAIL")
|
| 722 |
return ok
|
| 723 |
|
|
@@ -1090,7 +1093,7 @@ def analog(cfg, device):
|
|
| 1090 |
|
| 1091 |
|
| 1092 |
def main():
|
| 1093 |
-
ap = argparse.ArgumentParser(description="neural_reflect
|
| 1094 |
ap.add_argument("cmd", choices=["build", "verify", "analog", "all"])
|
| 1095 |
ap.add_argument("--device", default="cuda" if torch.cuda.is_available() else "cpu")
|
| 1096 |
args = ap.parse_args()
|
|
|
|
| 29 |
regardless of gate order, so U reproduces the family's combinational evaluation.
|
| 30 |
|
| 31 |
Capabilities:
|
| 32 |
+
- compile_to_reflect() maps any <=2-input family Net to a stored netlist; a
|
| 33 |
+
ripple-carry adder and the family's SUBLEQ datapath run through the
|
| 34 |
+
interpreter bit-exact, independent of the order the gates are stored in.
|
| 35 |
+
- Read by gate index, the netlist can far exceed the addressed signal span: a
|
| 36 |
+
whole SUBLEQ machine, its memory held in signals, runs one instruction per
|
| 37 |
+
sweep with the interpreter's indexed addressing as its memory-access
|
| 38 |
+
hardware.
|
| 39 |
+
- A program streams the netlist's own bytes to the output device; another
|
| 40 |
+
rewrites its own gate so the next sweep computes a different function; a
|
| 41 |
+
BANK flag runs a different resident machine. A netlist with feedback holds
|
| 42 |
+
state across sweeps.
|
| 43 |
- The accumulator width follows from F and the bias width. U compiles to a
|
| 44 |
recurrent ternary matrix stack equal to the gate graph, with a measured
|
| 45 |
noise and conductance-mismatch margin.
|
|
|
|
| 554 |
tensors = {f"matrix.layer{i:03d}.weight": Wt for i, (Wt, _) in enumerate(layers)}
|
| 555 |
tensors.update({f"matrix.layer{i:03d}.bias": B for i, (_, B) in enumerate(layers)})
|
| 556 |
for k, v in (("signals", cfg.S), ("gates", cfg.G), ("banks", cfg.banks),
|
| 557 |
+
("state_bits", cfg.STATE_BITS), ("layers", info["layers"])):
|
| 558 |
tensors[f"manifest.{k}"] = torch.tensor([float(v)])
|
| 559 |
meta = {"machine": "reflect", "weight_quantization": "ternary",
|
| 560 |
"config": json.dumps({"A": cfg.A, "S": cfg.S, "G": cfg.G, "F": cfg.F,
|
|
|
|
| 720 |
f"(a stored machine holding state through feedback): {seq}")
|
| 721 |
ok &= kgood
|
| 722 |
|
| 723 |
+
print("\nneural_reflect (universality, order, quine, metamorphosis, sequential state):",
|
| 724 |
"PASS" if ok else "FAIL")
|
| 725 |
return ok
|
| 726 |
|
|
|
|
| 1093 |
|
| 1094 |
|
| 1095 |
def main():
|
| 1096 |
+
ap = argparse.ArgumentParser(description="neural_reflect")
|
| 1097 |
ap.add_argument("cmd", choices=["build", "verify", "analog", "all"])
|
| 1098 |
ap.add_argument("--device", default="cuda" if torch.cuda.is_available() else "cpu")
|
| 1099 |
args = ap.parse_args()
|
variants/neural_reflect.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e2264c9149218afcd5dc534ad422170b1dad3a06ccb767c6f973e9a3a6618835
|
| 3 |
+
size 157772150
|