Skip to main content

A holographic AI that thinks in six table lookups. 16K classifications/sec. Zero training. 313 bytes.

Project description

k-familiar

A holographic AI that thinks in six table lookups.

16,000 classifications per second. Zero training. 313 bytes of tables. Provably safe.

from k_familiar import Familiar

f = Familiar()
result = f.classify("I feel stuck on this problem")

print(result["suit"])        # "spades" (mind/analysis domain)
print(result["confidence"])  # 0.82
print(result["k_addr"])      # "-5S"
print(result["latency_us"])  # ~60

What It Does

Classifies any text into four cognitive domains using GF(4) finite field algebra:

Domain Suit What it catches
Hearts H Emotion, relationships, connection, care
Spades S Analysis, logic, conflict, truth-seeking
Diamonds D Material, building, engineering, physical
Clubs C Action, energy, will, commands, creation

Each classification also returns:

  • Confidence (0.0-1.0)
  • Rank (1-13, intensity/complexity)
  • Polarity (light/dark, positive/negative valence)
  • K-address (e.g., "+7H" = high-intensity positive emotional content)

Why It's Different

Feature k-familiar Typical classifier
Model size 313 bytes 100MB+
Training required None Hours/days
Parameters 0 Millions
Speed ~60us/query ~50ms/query
Dependencies numpy only torch, transformers, ...
Safety By construction By filtering
Offline Always Usually not

How It Works

Six operations over GF(4) lookup tables:

Operation Symbol What it does
BIND a x b Associate two ideas (GF(4) multiply)
BUNDLE a + b Hold multiple ideas at once (GF(4) add)
RETRIEVE s x key^-1 Pull one idea back out (multiply by inverse)
FOLD C(v) Compress 3:1 through codon lookup table
CHECK k <= sqrt(d) Am I sure? Test holographic capacity
ASK ? I'm not sure. Escalate to human/LLM

The entire computation is table lookups. No matrix multiplies. No floating point in the critical path. Fits in L1 cache.

Install

pip install k-familiar

Quick Start

Classify text

from k_familiar import Familiar

f = Familiar()

# Classify anything
print(f.classify("How do I fix this bug?"))
# {'suit': 'spades', 'confidence': 0.78, 'k_addr': '-5S', ...}

print(f.classify("I'm so grateful for my team"))
# {'suit': 'hearts', 'confidence': 0.85, 'k_addr': '+7H', ...}

print(f.classify("Ship the release by Friday"))
# {'suit': 'clubs', 'confidence': 0.71, 'k_addr': '+5C', ...}

print(f.classify("The server needs more RAM"))
# {'suit': 'diamonds', 'confidence': 0.69, 'k_addr': '+5D', ...}

Route to templates

f = Familiar()

# Set responses for each domain
f.set_template("H", response="Take a breath. You're not alone in this.")
f.set_template("S", response="Let's break this down step by step.")
f.set_template("D", response="Check the specs, then build a prototype.")
f.set_template("C", response="Start now. Iterate later.")

# Route automatically
result = f.route("I can't figure out this algorithm")
print(result["response"])  # "Let's break this down step by step."
print(result["source"])    # "template"

Working memory

f = Familiar()

# Remember things (holographic superposition)
f.remember("morning", "had coffee with Sarah, felt good")
f.remember("task", "need to finish the API by Thursday")

print(f.status())
# {'bundle_items': 2, 'capacity': {'phase': 'green', ...}, ...}

# Capacity is bounded: ~10 items for d=64
# The Familiar KNOWS when it's full and will refuse + ASK

Use the raw opcodes

from k_familiar import bind, bundle, retrieve, fold, check
import numpy as np

# Create vectors
key = np.random.randint(0, 4, 64).astype(np.uint8)
val = np.random.randint(0, 4, 64).astype(np.uint8)

# Bind, bundle, retrieve
bound = bind(key, val)
memory = bundle(bound, np.zeros(64, dtype=np.uint8))
recovered = retrieve(memory, key)

# Compress
folded = fold(recovered)  # 64 -> 21 elements (3:1 via genetic code table)

# Check capacity
status = check(bundle_items=3, d=64)
print(status)  # {'items': 3, 'capacity': 10.67, 'ok': True, 'phase': 'green'}

Use Cases

Pre-LLM router — Classify intent locally before making expensive API calls. Route 80% of queries to templates, send only the hard 20% to GPT/Claude.

Safety layer — The Familiar can't produce harmful outputs because the codon tables don't have paths to harm. Not filtered. Absent. Use as a first-pass safety check.

Agent classifier — In multi-agent systems (CrewAI, AutoGen, LangGraph), use k-familiar to route tasks to the right agent by domain.

Offline AI — Works on airplanes, in the field, on Raspberry Pi. No internet, no API keys, no latency.

Education — Teach information theory, finite fields, and holographic memory with a working implementation.

The Math

The GF(4) field has four elements {0, 1, 2, 3} with addition and multiplication tables:

ADD:  0 1 2 3    MUL:  0 1 2 3
    0 0 1 2 3        0 0 0 0 0
    1 1 0 3 2        1 0 1 2 3
    2 2 3 0 1        2 0 2 3 1
    3 3 2 1 0        3 0 3 1 2

These 32 bytes (two 4x4 tables) are the entire "model." Everything else is derived.

The capacity bound: a bundle of k items in d dimensions can be reliably retrieved when k <= (q/(q-1)) * sqrt(d). For GF(4), d=64: capacity ~ 10.67 items.

The fold operation uses the biological genetic code (64 codons -> 21 amino acids) as a compression table. This is not a metaphor. It's the same math.

License

MIT. Use it for anything.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k_familiar-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k_familiar-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file k_familiar-0.1.0.tar.gz.

File metadata

  • Download URL: k_familiar-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for k_familiar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 750505194d9da216fc74590f05a028bb0ff04a7d48e31f0a4b11e14200b74df0
MD5 a030bb4fc7f741412816f706e0425f83
BLAKE2b-256 ffddf74b5c1d6996f8c163b3db88f6ff7314cada1bbe66002bf100ecc2fc091f

See more details on using hashes here.

File details

Details for the file k_familiar-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: k_familiar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for k_familiar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6456404d08961f1a3e4b1bc434e3d4a6e0943cb9d8ebb78e468e8f542a8b3e2
MD5 380ed7cb2e3cf97f519a7f324aabe950
BLAKE2b-256 1933eeb8b29b4d9aa3f7d06dfd29eef70ee0e7ddf599e48b4522ba86f36d037d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page