threshold-atmost5outof8

At-most-5-out-of-8 detector. Fires when 5 or fewer inputs are active. The sub-supermajority bound.

Circuit

  xβ‚€ x₁ xβ‚‚ x₃ xβ‚„ xβ‚… x₆ x₇
   β”‚  β”‚  β”‚  β”‚  β”‚  β”‚  β”‚  β”‚
   β””β”€β”€β”΄β”€β”€β”΄β”€β”€β”΄β”€β”€β”Όβ”€β”€β”΄β”€β”€β”΄β”€β”€β”΄β”€β”€β”˜
               β–Ό
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ w: -1Γ—8 β”‚
          β”‚ b:  +5  β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
           HW ≀ 5?

Below Supermajority

This circuit blocks supermajority (β‰₯6):

HW AtMost5 Interpretation
0-5 1 Below 75% threshold
6-8 0 Supermajority achieved

If you need 6/8 to pass something, AtMost5 detects when you don't have it.

Includes Bare Majority

HW Status AtMost5
4 Tie 1
5 Bare majority 1
6 Supermajority 0

Unlike AtMost4, this includes the minimal majority case. A 5-3 vote passes Majority but still fires AtMost5.

Coverage

HW C(8,k) AtMost5?
0-5 163 Yes
6 28 No
7 8 No
8 1 No

Total: 163 of 256 inputs (63.7%). Same count as AtMost4 by symmetry.

Dual of AtLeast3

Circuit Condition Count
AtLeast3 HW β‰₯ 3 219
AtMost5 HW ≀ 5 219

Under bit-flip, AtMost5 inputs map to AtLeast3 inputs.

Parameters

Component Value
Weights all -1
Bias +5
Total 9 parameters

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

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

# Bare majority: still below supermajority
print(atmost5([1,1,1,1,1,0,0,0]))  # 1

# Supermajority: fails
print(atmost5([1,1,1,1,1,1,0,0]))  # 0

Files

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

License

MIT

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

Collection including phanerozoic/threshold-atmost5outof8