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
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including phanerozoic/threshold-alloutof8