Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -9,7 +9,7 @@ tags:
|
|
| 9 |
|
| 10 |
# threshold-exactly7outof8
|
| 11 |
|
| 12 |
-
Exactly-7-out-of-8 detector. Fires when
|
| 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 |
-
β
|
| 25 |
-
β
|
| 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 |
-
|
| 37 |
```
|
| 38 |
|
| 39 |
-
##
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|----|--------|
|
| 47 |
-
| 0-6 | 0 |
|
| 48 |
-
| 7 | **1** |
|
| 49 |
-
| 8 | 0 |
|
| 50 |
|
| 51 |
-
##
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|