threshold-5outof8

Strict majority detector. Fires when more than half (5+ of 8) inputs are set.

Circuit

  xβ‚€ x₁ xβ‚‚ x₃ xβ‚„ xβ‚… x₆ x₇
   β”‚  β”‚  β”‚  β”‚  β”‚  β”‚  β”‚  β”‚
   β””β”€β”€β”΄β”€β”€β”΄β”€β”€β”΄β”€β”€β”Όβ”€β”€β”΄β”€β”€β”΄β”€β”€β”΄β”€β”€β”˜
               β–Ό
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ w: all 1β”‚
          β”‚ b:  -5  β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
            HW β‰₯ 5

Mechanism

  • Sum = (number of 1s) - 5
  • Fires when Hamming weight β‰₯ 5

This is the majority threshold for 8 inputs. A tie (4-4) doesn't pass. You need more 1s than 0s.

Functionally equivalent to threshold-majority.

k-out-of-8 Family

Circuit Bias Fires when
... ... ...
4-out-of-8 -4 HW β‰₯ 4
5-out-of-8 -5 HW β‰₯ 5 (this = majority)
6-out-of-8 -6 HW β‰₯ 6
... ... ...

Parameters

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

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

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

Files

threshold-5outof8/
β”œβ”€β”€ model.safetensors
β”œβ”€β”€ model.py
β”œβ”€β”€ config.json
└── README.md

License

MIT

Downloads last month
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including phanerozoic/threshold-5outof8