threshold-atmost3outof8

At-most-3-out-of-8 detector. Fires when three or fewer inputs are active. Identical to Minority.

Circuit

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

Equivalence to Minority

This circuit is functionally identical to threshold-minority:

Circuit Condition Implementation
Minority HW ≀ 3 w: all -1, b: +3
AtMost3 HW ≀ 3 w: all -1, b: +3

Both detect "strictly fewer than half." The naming differs by framing:

  • "Minority" emphasizes the voting interpretation
  • "AtMost3" emphasizes the counting bound

The Tie Boundary

HW AtMost3 Interpretation
0-3 1 Minority (< 50%)
4 0 Tie (= 50%)
5-8 0 Majority (> 50%)

AtMost3 excludes ties. Four active inputs is not "at most 3."

Dual of AtLeast5 (Majority)

Circuit Condition Meaning
AtLeast5 HW β‰₯ 5 Majority
AtMost3 HW ≀ 3 Minority

These are not complements - the tie zone (HW = 4) belongs to neither.

Coverage

HW C(8,k) AtMost3?
0 1 Yes
1 8 Yes
2 28 Yes
3 56 Yes
4-8 163 No

Fires on 1 + 8 + 28 + 56 = 93 of 256 inputs (36.3%).

Parameters

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

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

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

# Three active: minority
print(atmost3([1,1,1,0,0,0,0,0]))  # 1

# Four active: tie, not minority
print(atmost3([1,1,1,1,0,0,0,0]))  # 0

Files

threshold-atmost3outof8/
β”œβ”€β”€ 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-atmost3outof8