Skip to main content

ZeroModel: Data-centric AI with visual policy maps

Project description

ZeroModel Intelligence (ZeroModel)

PyPI version License: MIT

ZeroModel Intelligence is a paradigm-shifting approach that embeds decision logic into the structure of data itself. Instead of making models smarter, ZeroModel makes data structures intelligent.

The intelligence isn't in the processing—it's in the data structure itself.

🧠 Core Concept

ZeroModel transforms high-dimensional policy evaluation data into spatially-optimized Visual Policy Maps (VPMs) where:

  • Position = Importance (top-left = most relevant)
  • Color = Value (darker = higher priority)
  • Structure = Task logic (spatial organization encodes decision workflow based on user-defined SQL)

This enables zero-model intelligence on devices with <25KB memory and unlocks Visual Symbolic Reasoning.

🚀 Quick Start

pip install zeromodel
from zeromodel.core import ZeroModel
import numpy as np

# 1. Prepare your data (documents × metrics)
# Example: 100 items scored on 5 criteria
score_matrix = np.random.rand(100, 5)
metric_names = ["uncertainty", "size", "quality", "novelty", "coherence"]

# 2. Initialize ZeroModel
zeromodel = ZeroModel(metric_names)

# 3. Define your task using SQL and process the data in one step
# The intelligence comes from how you sort the data for your task.
sql_task = "SELECT * FROM virtual_index ORDER BY quality DESC, uncertainty ASC"

# Process data for the task. This handles normalization and spatial organization.
# Use nonlinearity hints for complex tasks (e.g., XOR-like patterns).
zeromodel.prepare(score_matrix, sql_task, nonlinearity_hint='auto')

# 4. Get the Visual Policy Map (VPM) - a structured image
vpm = zeromodel.encode() # Returns a NumPy array (H x W x 3)

# 5. Make decisions by inspecting the structured VPM
doc_idx, relevance = zeromodel.get_decision()
print(f"Top document index: {doc_idx}, Relevance score: {relevance:.4f}")

# 6. For edge devices: get a small, critical tile
tile_bytes = zeromodel.get_critical_tile(tile_size=3) # Returns compact bytes

🧬 Hierarchical Reasoning

Handle large datasets and multi-resolution decisions with HierarchicalVPM:

from zeromodel.hierarchical import HierarchicalVPM

# Create a hierarchical structure (e.g., 3 levels)
hvpm = HierarchicalVPM(metric_names, num_levels=3, zoom_factor=3, precision=16)

# Process data with the same SQL task
hvpm.process(score_matrix, sql_task) # Internally uses ZeroModel.prepare

# Access different levels of detail
base_level_vpm = hvpm.get_level(2)["vpm"]  # Level 2: Most detailed
strategic_vpm = hvpm.get_level(0)["vpm"]   # Level 0: Most abstract

# Get a tile from a specific level for an edge device
edge_tile_bytes = hvpm.get_tile(level_index=0, width=3, height=3)

# Make a decision (defaults to most detailed level)
level, doc_idx, relevance = hvpm.get_decision()

🔮 Visual Symbolic Reasoning

Combine VPMs like logic gates to create new, complex decision criteria:

from zeromodel.vpm.logic import vpm_and, vpm_or, vpm_not, vpm_query_top_left

# Prepare VPMs for different sub-tasks
high_quality_model = ZeroModel(metric_names)
high_quality_model.prepare(score_matrix, "SELECT * FROM virtual_index ORDER BY quality DESC")
high_quality_vpm = high_quality_model.encode()

low_uncertainty_model = ZeroModel(metric_names)
low_uncertainty_model.prepare(score_matrix, "SELECT * FROM virtual_index ORDER BY uncertainty ASC")
low_uncertainty_vpm = low_uncertainty_model.encode()

# Compose VPMs: Find items that are High Quality AND Low Uncertainty
# The result is a new VPM representing this combined concept.
good_and_cert_vpm = vpm_and(high_quality_vpm, low_uncertainty_vpm)

# Query the composed VPM
composite_score = vpm_query_top_left(good_and_cert_vpm, context_size=3)
print(f"Score for 'High Quality AND Low Uncertainty' items: {composite_score:.4f}")

# This enables complex reasoning: (A AND NOT B) OR (C AND D) as VPM operations.

💡 Edge Device Example (Pseudocode)

Tiny devices can make intelligent decisions using minimal code by processing small VPM tiles.

# --- On a powerful server ---
hvpm = HierarchicalVPM(metric_names)
hvpm.process(large_score_matrix, "SELECT * ORDER BY my_metric DESC")
tile_bytes_level_0 = hvpm.get_tile(level_index=0, width=3, height=3)
send_to_edge_device(tile_bytes_level_0)

# --- On the tiny edge device (e.g., microcontroller) ---
def process_tile_simple(tile_bytes):
  # Parse 4-byte header: 16-bit little-endian width, height
  if len(tile_bytes) < 5:
    return 0
  width = tile_bytes[0] | (tile_bytes[1] << 8)
  height = tile_bytes[2] | (tile_bytes[3] << 8)
  # Simple decision: check the very first pixel's Red channel
  # (Assumes uint8 RGB layout [R, G, B, R, G, B, ...])
  first_pixel_red_value = tile_bytes[4]
  return 1 if first_pixel_red_value < 128 else 0

# result = process_tile_simple(received_tile_bytes)
# if result == 1: perform_action()

📚 Running Tests

Ensure you have pytest installed (pip install pytest).

# Run all tests
pytest tests/ -v

# Run a specific test file
pytest tests/test_core.py -v

# Run a specific test function
pytest tests/test_xor.py::test_xor_validation -v -s

🌐 Website

Check out our website at zeromi.org for tutorials, examples, and community resources.

📄 Citation

If you use ZeroModel in your research, please cite:

@article{zeromodel2025,
  title={Zero-Model Intelligence: Spatially-Optimized Decision Maps for Resource-Constrained AI},
  author={Ernan Hughes},
  journal={arXiv preprint arXiv:XXXX.XXXXX},
  year={2025}
}

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

zeromodel-1.0.6.tar.gz (298.5 kB view details)

Uploaded Source

Built Distribution

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

zeromodel-1.0.6-py3-none-any.whl (385.3 kB view details)

Uploaded Python 3

File details

Details for the file zeromodel-1.0.6.tar.gz.

File metadata

  • Download URL: zeromodel-1.0.6.tar.gz
  • Upload date:
  • Size: 298.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for zeromodel-1.0.6.tar.gz
Algorithm Hash digest
SHA256 07646e6c7331adc3dcb0f053cbe283170504f606c58d89bc4deaf9259184ac13
MD5 a7356c318ef24d33d66e4d594538325f
BLAKE2b-256 948ec65f5a7067c7f79ec3c7638b400a0788cbae0d5f4ab26a3e7f7bcbec4650

See more details on using hashes here.

File details

Details for the file zeromodel-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: zeromodel-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 385.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for zeromodel-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 67aab3eeccffa140dd792ec0c72937533a73cc0ec8fcd7146e3562d8915a9e42
MD5 2936f4b1e46071fbebd68d94437027a5
BLAKE2b-256 dcbdfac20f6579376a195d46bd8d73b2b268a9dd414c04a6b116e92501fece86

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