At-most-6-out-of-8 detector. Fires when 6 or fewer inputs are active. The near-unanimity blocker.
x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇
│ │ │ │ │ │ │ │
└──┴──┴──┴──┼──┴──┴──┴──┘
▼
┌─────────┐
│ w: -1×8 │
│ b: +6 │
└─────────┘
│
▼
HW ≤ 6?
It identifies states where meaningful opposition exists.
This is the threshold for "blocking minority" in many systems.
Both fire on almost everything. AtLeast2 misses empty/singleton; AtMost6 misses near-unanimous/unanimous.
1from safetensors.torch import load_file
2import torch
3
4w = load_file('model.safetensors')
5
6def atmost6(bits):
7 inp = torch.tensor([float(b) for b in bits])
8 return int((inp * w['weight']).sum() + w['bias'] >= 0)
9
10# Supermajority with 2 dissenters
11print(atmost6([1,1,1,1,1,1,0,0])) # 1
12
13# Single holdout
14print(atmost6([1,1,1,1,1,1,1,0])) # 0
threshold-atmost6outof8/
├── model.safetensors
├── model.py
├── config.json
└── README.md