phanerozoic commited on
Commit
a4c20f4
Β·
verified Β·
1 Parent(s): af8c8ec

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +97 -15
README.md CHANGED
@@ -9,7 +9,7 @@ tags:
9
 
10
  # threshold-exactly7outof8
11
 
12
- Exactly-7-out-of-8 detector. Fires when exactly seven inputs are active.
13
 
14
  ## Circuit
15
 
@@ -21,9 +21,8 @@ Exactly-7-out-of-8 detector. Fires when exactly seven inputs are active.
21
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
22
  β–Ό β–Ό
23
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
24
- β”‚ AtLeast7β”‚ β”‚ AtMost7 β”‚
25
- β”‚ w: +1Γ—8 β”‚ β”‚ w: -1Γ—8 β”‚
26
- β”‚ b: -7 β”‚ β”‚ b: +7 β”‚
27
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
28
  β”‚ β”‚
29
  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
@@ -33,24 +32,107 @@ Exactly-7-out-of-8 detector. Fires when exactly seven inputs are active.
33
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
34
  β”‚
35
  β–Ό
36
- (HW = 7?)
37
  ```
38
 
39
- ## Significance
40
 
41
- Near-unanimity detector. Exactly one dissenter among eight. The single-error tolerance case.
42
 
43
- ## Truth Table
 
 
 
44
 
45
- | HW | Result |
46
- |----|--------|
47
- | 0-6 | 0 |
48
- | 7 | **1** |
49
- | 8 | 0 |
50
 
51
- ## Architecture
52
 
53
- **3 neurons, 21 parameters, 2 layers**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ## License
56
 
 
9
 
10
  # threshold-exactly7outof8
11
 
12
+ Exactly-7-out-of-8 detector. Fires when precisely seven inputs are active. The lone-dissenter detector.
13
 
14
  ## Circuit
15
 
 
21
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
22
  β–Ό β–Ό
23
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
24
+ β”‚ β‰₯ 7 β”‚ β”‚ ≀ 7 β”‚
25
+ β”‚ b = -7 β”‚ β”‚ b = +7 β”‚
 
26
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
27
  β”‚ β”‚
28
  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
 
32
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
33
  β”‚
34
  β–Ό
35
+ one dissenter?
36
  ```
37
 
38
+ ## The Singleton Complement
39
 
40
+ This circuit detects the complement of Exactly1: instead of one voice in the wilderness, it's one holdout against consensus.
41
 
42
+ | Circuit | Pattern | Interpretation |
43
+ |---------|---------|----------------|
44
+ | Exactly1 | 00000001 | Pioneer, outlier |
45
+ | **Exactly7** | 11111110 | Holdout, veto |
46
 
47
+ Both fire on exactly 8 input patterns (one for each position).
 
 
 
 
48
 
49
+ ## Near-Unanimity
50
 
51
+ 7/8 = 87.5% - overwhelming but not complete agreement:
52
+
53
+ - **Hung jury**: 11-1 in a 12-person jury (scaled to 8)
54
+ - **Single point of failure**: All systems go except one
55
+ - **Error correction**: A single bit flip from all-ones
56
+
57
+ The circuit identifies the liminal state between consensus and unanimity.
58
+
59
+ ## Dual of Exactly1
60
+
61
+ | Circuit | HW | Count | Interpretation |
62
+ |---------|-----|-------|----------------|
63
+ | Exactly1 | 1 | 8 | One active |
64
+ | **Exactly7** | 7 | 8 | One inactive |
65
+
66
+ They are perfect duals. Bitwise NOT maps each Exactly1 input to a unique Exactly7 input.
67
+
68
+ ## The Holdout Problem
69
+
70
+ In consensus systems:
71
+
72
+ | HW | Status | Exactly7 |
73
+ |----|--------|----------|
74
+ | 6 | Multiple dissenters | 0 |
75
+ | **7** | **Single holdout** | **1** |
76
+ | 8 | Complete consensus | 0 |
77
+
78
+ Exactly7 identifies the unique scenario: overwhelming support with precisely one objector. This is useful for:
79
+
80
+ - Identifying the blocking vote
81
+ - Detecting near-consensus states
82
+ - Finding the single bit error in a codeword
83
+
84
+ ## Parameters
85
+
86
+ | Component | Weights | Bias |
87
+ |-----------|---------|------|
88
+ | AtLeast7 | all +1 | -7 |
89
+ | AtMost7 | all -1 | +7 |
90
+ | AND | [+1, +1] | -2 |
91
+
92
+ **Total: 3 neurons, 21 parameters, 2 layers**
93
+
94
+ ## Usage
95
+
96
+ ```python
97
+ from safetensors.torch import load_file
98
+ import torch
99
+
100
+ w = load_file('model.safetensors')
101
+
102
+ def exactly7(bits):
103
+ inp = torch.tensor([float(b) for b in bits])
104
+ atleast = int((inp * w['atleast.weight']).sum() + w['atleast.bias'] >= 0)
105
+ atmost = int((inp * w['atmost.weight']).sum() + w['atmost.bias'] >= 0)
106
+ comb = torch.tensor([float(atleast), float(atmost)])
107
+ return int((comb * w['and.weight']).sum() + w['and.bias'] >= 0)
108
+
109
+ # One holdout at position 3
110
+ bits = [1, 1, 1, 0, 1, 1, 1, 1]
111
+ print(exactly7(bits)) # 1
112
+
113
+ # Complete unanimity - no holdout
114
+ bits = [1, 1, 1, 1, 1, 1, 1, 1]
115
+ print(exactly7(bits)) # 0
116
+ ```
117
+
118
+ ## Contrast with 7-out-of-8
119
+
120
+ | Circuit | Condition | Fires on |
121
+ |---------|-----------|----------|
122
+ | 7-out-of-8 | HW β‰₯ 7 | HW = 7, 8 (9 patterns) |
123
+ | **Exactly7** | HW = 7 | HW = 7 only (8 patterns) |
124
+
125
+ The difference: 7-out-of-8 includes unanimity. Exactly7 excludes it.
126
+
127
+ ## Files
128
+
129
+ ```
130
+ threshold-exactly7outof8/
131
+ β”œβ”€β”€ model.safetensors
132
+ β”œβ”€β”€ model.py
133
+ β”œβ”€β”€ config.json
134
+ └── README.md
135
+ ```
136
 
137
  ## License
138