threshold-3outof8

At-least-three detector. Fires when 3 or more of 8 inputs are set.

Circuit

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

Mechanism

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

Two active inputs aren't enough. Needs a third to cross threshold.

k-out-of-8 Family

Circuit Bias Fires when
1-out-of-8 -1 HW β‰₯ 1
2-out-of-8 -2 HW β‰₯ 2
3-out-of-8 -3 HW β‰₯ 3 (this)
4-out-of-8 -4 HW β‰₯ 4
... ... ...

Parameters

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

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

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

Files

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

License

MIT

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

Collection including phanerozoic/threshold-3outof8