threshold-xor4

4-input XOR gate. Cascade of three standard XOR circuits (OR + NAND + AND).

Architecture

a  b       c       d
β”‚  β”‚       β”‚       β”‚
└──┴──┐    β”‚       β”‚
      β–Ό    β”‚       β”‚
   β”Œβ”€β”€β”€β”€β”€β” β”‚       β”‚
   β”‚ XOR β”‚ β”‚       β”‚
   β””β”€β”€β”¬β”€β”€β”˜ β”‚       β”‚
      β””β”€β”€β”¬β”€β”˜       β”‚
         β–Ό         β”‚
      β”Œβ”€β”€β”€β”€β”€β”      β”‚
      β”‚ XOR β”‚      β”‚
      β””β”€β”€β”¬β”€β”€β”˜      β”‚
         β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
              β–Ό
           β”Œβ”€β”€β”€β”€β”€β”
           β”‚ XOR β”‚
           β””β”€β”€β”¬β”€β”€β”˜
              β–Ό
        XOR4(a,b,c,d)

Each XOR uses the standard OR + NAND + AND structure:

  • OR: w=[1,1], b=-1 (magnitude 3)
  • NAND: w=[-1,-1], b=1 (magnitude 3)
  • AND: w=[1,1], b=-2 (magnitude 4)

Parameters

Neurons 9
Layers 6
Parameters 27
Magnitude 30

Optimized Version

See threshold-xor4-mag21 for a 30% magnitude reduction using optimized XOR blocks.

Usage

from safetensors.torch import load_file

w = load_file('model.safetensors')
# See model.py for implementation

License

MIT

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

Collection including phanerozoic/threshold-xor4