HoloVec Documentation¶
Brain-Inspired Computing with Hyperdimensional Vectors
A high-performance Python library for building cognitive AI systems using vector symbolic architectures. Encode any data type into high-dimensional space for fast, robust, and explainable machine learning.
Why HoloVec?¶
🧠 Brain-Inspired
Hyperdimensional computing mimics how the brain represents and processes information using high-dimensional distributed representations.
Bio-plausible operations that map naturally to neural circuits.
⚡ Fast & Efficient
Vectorized operations on 10,000-dimensional vectors are surprisingly efficient. No neural network training required.
Process data in real-time with minimal computational overhead.
🛡️ Robust to Noise
Gracefully handles noise, partial corruption, and approximate data. Ideal for edge devices and fault-tolerant systems.
Performance degrades gracefully under hardware errors.
🔍 Explainable
Operations are transparent and interpretable. You can visualize and understand what the model is doing.
No black box. Every operation has clear semantics.
🎓 One-Shot Learning
Learn from very few examples. No gradient descent required. Perfect for online learning and rapid adaptation.
Add new knowledge incrementally without retraining.
📦 Versatile
Works with any data type - text, images, sensors, symbolic structures. Perfect for multimodal fusion.
Unify different modalities in the same representational space.
What You Can Build¶
📝 Text & NLP
Sentiment analysis, document classification, chatbot intent recognition, semantic search
🖼️ Computer Vision
Real-time image recognition, gesture detection, visual similarity search, anomaly detection
🎯 Recommender Systems
Personalized recommendations, content filtering, collaborative filtering with explainable results
📊 Sensor & IoT
Time-series classification, sensor fusion, predictive maintenance, edge device inference
🔗 Multimodal AI
Text + image fusion, audio-visual processing, cross-modal retrieval and reasoning
🧪 Research & Prototyping
Fast experimentation, one-shot learning tasks, cognitive modeling, neurosymbolic AI
HoloVec Features¶
A comprehensive library for hyperdimensional computing with everything you need from research to production.
Multiple VSA Models
Choose different mathematical frameworks for representing and manipulating information in high-dimensional space.
Available Models:
MAP (Multiply-Add-Permute) — Binary vectors, XOR operations, fast and simple
FHRR (Fourier Holographic Reduced Representations) — Complex-valued, perfect for structured data
HRR (Holographic Reduced Representations) — Real-valued circular convolution, original VSA model
BSC (Binary Spatter Codes) — Sparse binary vectors for extreme efficiency
BSDC (Binary Sparse Distributed Codes) — Block-based sparse representations
GHRR (Generalized HRR) — Extended HRR with flexible algebras
VTB (Vector-derived Transformation Binding) — Learned binding transformations
Why it matters: Each model has different trade-offs in accuracy, speed, and memory. Choose based on your application needs.
Flexible Backends
Run the same code on different hardware with zero code changes.
Available Backends:
NumPy (CPU) — Default backend, no dependencies, perfect for prototyping and small-scale applications
PyTorch (GPU) — CUDA acceleration for large-scale processing, batch operations, gradient computation
JAX (JIT/TPU) — Just-in-time compilation for extreme performance, TPU support for massive scale
Why it matters: Start on your laptop, scale to GPU clusters without rewriting code. Switch backends with a single parameter.
Comprehensive Encoders
Convert raw data (numbers, text, images, graphs) into high-dimensional vectors that preserve semantic relationships.
Available Encoders:
- Scalar Encoders:
Fractional Power Encoding (FPE) — Smooth encoding of continuous values
Thermometer/Level Encoding — Threshold-based encoding
Position Binding — Positional information in sequences
- Sequence Encoders:
N-gram Encoding — Text and sequential patterns
Trajectory Encoding — Temporal sequences and paths
- Structured Encoders:
Image Encoding — Spatial patterns and visual data
Graph Encoding — Relational structures and networks
Vector Encoding — Pre-computed embeddings from other models
Why it matters: The right encoder preserves the structure of your data. Similar inputs produce similar vectors, enabling semantic operations.
Memory & Retrieval
Build associative memories that work like human memory—noisy, robust, content-addressable.
Available Systems:
Cleanup Memory — Remove noise and reconstruct clean representations
Item Memory — Store and retrieve individual hypervectors
Associative Storage — Create key-value associations, bind concepts together
Codebook — Maintain vocabularies of known symbols and patterns
Resonator Networks — Iteratively refine and factorize complex representations
Why it matters: Build systems that can store knowledge, answer queries, and reason with partial or noisy information—just like human cognition.
Production-Ready Architecture
Professional software engineering practices, not research code.
Features:
Type-Safe APIs — Full type hints, IDE autocomplete, catch errors before runtime
Comprehensive Testing — 95%+ code coverage, validated against theoretical properties
Complete Documentation — API reference, tutorials, 28+ examples, theory guides
Extensible Design — Add custom models, encoders, and backends
Performance Optimized — Vectorized operations, memory-efficient representations
Dependency Minimal — Core library requires only NumPy
Why it matters: Go from research prototype to production deployment with confidence. Code that works today will work tomorrow.
Validation & Benchmarks
Every model and encoder validated against both mathematical theory and real-world performance.
Validation:
Property-based testing (all VSA algebraic properties verified)
Capacity analysis (how many items can be stored reliably)
Noise robustness measurements (graceful degradation under errors)
Cross-backend consistency (same results on CPU/GPU/TPU)
Benchmarks:
Encoding speed across different data types
Memory usage and scalability
Retrieval accuracy vs. storage capacity
Performance comparisons between models
Why it matters: Know exactly what to expect. No surprises in production.
Quick Start¶
Installation
Install holovec using uv (recommended) or pip:
# Using uv (recommended)
uv pip install holovec
# Or using pip
pip install holovec
Optional Backends
For GPU acceleration or specialized hardware, install backend-specific dependencies:
# GPU support with PyTorch
uv pip install holovec[torch]
# JIT compilation and TPU support with JAX
uv pip install holovec[jax]
Example Usage¶
Explore how HoloVec handles different types of data and use cases. Each example demonstrates complete workflows from encoding to querying.
from holovec import VSA
# Create model
model = VSA.create('FHRR', dim=10000, seed=42)
# Encode symbols
alice = model.random(seed=1)
bob = model.random(seed=2)
loves = model.random(seed=3)
# Create "Alice loves Bob"
statement = model.bind(model.bind(alice, loves), bob)
# Query: Who does Alice love?
query = model.unbind(model.unbind(statement, alice), loves)
print(f"Similarity to Bob: {model.similarity(query, bob):.3f}")
# Output: 1.0
from holovec import VSA
from holovec.encoders import FractionalPowerEncoder
# Create model
model = VSA.create('FHRR', dim=10000, seed=42)
# Create encoder for temperatures (0-100°C)
temp_encoder = FractionalPowerEncoder(
model,
min_val=0,
max_val=100,
bandwidth=0.1
)
# Encode temperatures
temp_25 = temp_encoder.encode(25.0)
temp_26 = temp_encoder.encode(26.0)
temp_50 = temp_encoder.encode(50.0)
# Similar temperatures have high similarity
print(f"25°C vs 26°C: {model.similarity(temp_25, temp_26):.3f}")
# Output: 0.95
print(f"25°C vs 50°C: {model.similarity(temp_25, temp_50):.3f}")
# Output: 0.32
from holovec import VSA
from holovec.encoders import NGramEncoder
# Create model
model = VSA.create('FHRR', dim=10000, seed=42)
# Create text encoder
text_encoder = NGramEncoder(model, n=3)
# Encode training documents
doc_positive = text_encoder.encode("I love this product!")
doc_negative = text_encoder.encode("This is terrible")
# Encode new review
new_review = text_encoder.encode("I really love it")
# Classify by similarity
sim_pos = model.similarity(new_review, doc_positive)
sim_neg = model.similarity(new_review, doc_negative)
print(f"Positive: {sim_pos:.3f}, Negative: {sim_neg:.3f}")
# Output: Positive: 0.87, Negative: 0.12
Documentation Hub¶
Getting Started
New to HoloVec?
Start here with a 5-minute introduction to hyperdimensional computing and vector symbolic architectures.
Tutorials
Step-by-Step Guides
Build complete applications: text classification, recommender systems, and more.
User Guide
In-Depth Documentation
Learn how to choose models, encode data, configure backends, and optimize performance.
Examples
28+ Code Examples
Browse examples from quickstart to advanced applications, encoders, and model comparisons.
API Reference
Complete API Docs
Detailed documentation for all modules, classes, functions, and parameters.
Theory
Mathematical Foundations
Understand the theory behind VSA models, encoders, and hyperdimensional operations.
Community & Support¶
GitHub Discussions
Ask questions and share ideas with the community
Issue Tracker
Report bugs and request features
Contact
Email: support@twistient.com