threshold-symmetric-s134

Symmetric function S_{1,3}^4: outputs 1 if exactly 1 or exactly 3 of 4 inputs are 1. Equivalent to 4-bit odd parity.

Function

S_{1,3}^4(x3, x2, x1, x0) = 1 iff sum ∈ {1, 3}

This is the "odd count" function on 4 bits.

Truth Table

x3 x2 x1 x0 sum y
0 0 0 0 0 0
0 0 0 1 1 1
0 0 1 1 2 0
0 1 1 1 3 1
1 1 1 1 4 0

Output is 1 for odd sums (1, 3), 0 for even sums (0, 2, 4).

Architecture

    x3   x2   x1   x0
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
    β”‚         β”‚
β”Œβ”€β”€β”€β”΄β”€β”€β”€β” β”Œβ”€β”€β”€β”΄β”€β”€β”€β”
β”‚ >=1   β”‚ β”‚ <=1   β”‚ β”‚ >=3   β”‚ β”‚ <=3   β”‚   Layer 1
β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜
    β”‚         β”‚         β”‚         β”‚
    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
         β”‚                   β”‚
     β”Œβ”€β”€β”€β”΄β”€β”€β”€β”           β”Œβ”€β”€β”€β”΄β”€β”€β”€β”
     β”‚ AND   β”‚           β”‚ AND   β”‚         Layer 2
     β”‚exact=1β”‚           β”‚exact=3β”‚
     β””β”€β”€β”€β”¬β”€β”€β”€β”˜           β””β”€β”€β”€β”¬β”€β”€β”€β”˜
         β”‚                   β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
               β”Œβ”€β”€β”€β”΄β”€β”€β”€β”
               β”‚  OR   β”‚               Layer 3
               β””β”€β”€β”€β”¬β”€β”€β”€β”˜
                   β”‚
                   y

Parameters

Inputs 4
Outputs 1
Neurons 7
Layers 3
Parameters 33
Magnitude 35

Relation to Parity

S_{1,3}^4 is equivalent to 4-bit parity (XOR of all bits). However, this implementation uses threshold counting rather than XOR decomposition, demonstrating an alternative approach.

Usage

from safetensors.torch import load_file
import torch

w = load_file('model.safetensors')

# Full implementation in model.py
# s134(0, 1, 1, 1) = 1  # sum=3, odd
# s134(1, 1, 0, 0) = 0  # sum=2, even

License

MIT

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

Collection including phanerozoic/threshold-symmetric-s134