threshold-alloutof8

Unanimity detector. Fires only when all 8 inputs are set. Equivalent to 8-input AND.

Circuit

  x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇
   │  │  │  │  │  │  │  │
   └──┴──┴──┴──┼──┴──┴──┴──┘
               ▼
          ┌─────────┐
          │ w: all 1│
          │ b:  -8  │
          └─────────┘
               │
               ▼
            HW = 8

Mechanism

  • Sum = (number of 1s) - 8
  • Fires only when Hamming weight = 8

The strictest threshold in the k-out-of-8 family. No tolerance for missing inputs.

k-out-of-8 Family

Circuit Bias Fires when
1-out-of-8 -1 HW ≥ 1 (= 8-input OR)
... ... ...
7-out-of-8 -7 HW ≥ 7
8-out-of-8 -8 HW = 8 (this = 8-input AND)

The family spans from OR (bias -1) to AND (bias -8). All use the same weights.

Parameters

Weights [1, 1, 1, 1, 1, 1, 1, 1]
Bias -8
Total 9 parameters

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

def all_8(bits):
    inputs = torch.tensor([float(b) for b in bits])
    return int((inputs * w['weight']).sum() + w['bias'] >= 0)

Files

threshold-alloutof8/
├── model.safetensors
├── model.py
├── config.json
└── README.md

License

MIT

Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including phanerozoic/threshold-alloutof8

Free AI Image Generator No sign-up. Instant results. Open Now