Skip to main content

Hyperdimensional Computing / Vector Symbolic Architectures library

Project description

HoloVec Logo

License Python Code style: black

Vector Symbolic Architectures for compositional, high-dimensional computing.

Documentation | Installation | Quick Start | Examples


What HoloVec Is

HoloVec is a Python library for hyperdimensional computing (HDC) and vector symbolic architectures (VSA). It gives you a consistent API for:

  • binding and unbinding structured representations
  • bundling sets, prototypes, and memories
  • permutation-based order encoding
  • scalar, sequence, spatial, and structured encoders
  • associative retrieval and cleanup memories

The library currently treats NumPy as the release-blocking backend. PyTorch and JAX are supported as optional backends when their environment-specific tests are enabled.


Installation

pip install holovec

Optional extras:

pip install "holovec[torch]"  # PyTorch backend
pip install "holovec[jax]"    # JAX backend
pip install "holovec[all]"    # torch + jax + dev + docs extras

For source work:

git clone https://github.com/Twistient/HoloVec.git
cd HoloVec
uv sync --extra dev

Use uv pip install -e .[dev] only when you explicitly want an editable install outside the normal uv sync workflow.


Quick Start

from holovec import VSA
from holovec.encoders import FractionalPowerEncoder
from holovec.retrieval import Codebook, ItemStore

model = VSA.create("FHRR", dim=4096, seed=7)

role_color = model.random(seed=1)
role_temp = model.random(seed=2)
red = model.random(seed=10)
apple = model.random(seed=11)

temp_encoder = FractionalPowerEncoder(
    model,
    min_val=0.0,
    max_val=100.0,
    bandwidth=1.5,
    seed=3,
)

record = model.bundle(
    [
        model.bind(role_color, red),
        model.bind(role_temp, temp_encoder.encode(24.0)),
    ]
)

recovered_color = model.unbind(record, role_color)
store = ItemStore(model).fit(
    Codebook({"red": red, "apple": apple}, backend=model.backend)
)

print(store.query(recovered_color, k=1))

If you want a runnable version of that workflow, start with examples/00_quickstart.py.


Choosing a Model

Model Space Inverse Style Order Sensitivity Typical Use
FHRR Complex Exact No General-purpose default, continuous encoders
GHRR Matrix Exact Yes Order-sensitive and nested structures
MAP Bipolar Self-inverse No Fast algebra, hardware-friendly workflows
HRR Real/Bipolar Approximate No Classic baseline and literature reproduction
VTB Matrix/Real Approximate Yes Directional bindings and asymmetric relations
BSC Binary Self-inverse No Binary and FPGA-style workflows
BSDC Sparse Approximate No Sparse memory-efficient representations
BSDC-SEG Sparse segment Self-inverse No Segment-sparse retrieval and fast pattern search

Start with FHRR unless you have a clear reason to prefer order-sensitive matrix models, self-inverse discrete models, or sparse segment-based storage.

The factory now validates model-specific kwargs instead of ignoring them. Supported examples:

VSA.create("BSDC", dim=20000, sparsity=0.01, binding_mode="cdt")
VSA.create("BSDC-SEG", dim=400, segments=20)
VSA.create("GHRR", dim=96, matrix_size=3, diagonality=0.4)
VSA.create("VTB", dim=512, n_bases=4, temperature=50.0)
VSA.create("FHRR", dim=4096, backend="torch", device="cuda")

See the full comparison in docs/models/index.md.


Release-Facing Examples

These examples are the audited path through the library and are smoke-tested in pytest:

Additional examples remain in the repository, but the list above is the maintained v1 learning path.


Documentation Highlights


Testing

uv run --extra dev pytest --no-cov
uv run --extra dev ruff check holovec tests
uv run --extra dev mypy holovec
uv sync --extra docs && uv run --extra docs mkdocs build --strict

The release gate also includes smoke execution of the canonical example scripts.


References

HoloVec draws on the core HDC/VSA literature, including Kanerva (1988), Plate (2003), Gayler (2003), Frady et al. (2021), Schlegel et al. (2022), Kleyko et al. (2023), and Kymn et al. (2024).


Citation

@software{HoloVec2025,
  author       = {Brodie Schroeder},
  title        = {HoloVec: Vector Symbolic Architectures for Python},
  year         = {2025},
  version      = {0.3.2},
  url          = {https://github.com/Twistient/HoloVec},
  license      = {Apache-2.0}
}

Contributing

See CONTRIBUTING.md. Key areas: new models, encoders, documentation, and performance.

License

Apache 2.0. See LICENSE.

Contact

GitHub IssuesDiscussionsbrodie@twistient.com

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

holovec-1.0.0.tar.gz (164.0 kB view details)

Uploaded Source

Built Distribution

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

holovec-1.0.0-py3-none-any.whl (129.4 kB view details)

Uploaded Python 3

File details

Details for the file holovec-1.0.0.tar.gz.

File metadata

  • Download URL: holovec-1.0.0.tar.gz
  • Upload date:
  • Size: 164.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for holovec-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ec41a1c2d7a8c851f224d6682bba189d39dbe2f834e3d234abf5aad2c7998a0
MD5 e939847748899dd760f4bd2c90638ad2
BLAKE2b-256 397cc904453052f9d70930598a7b259335ac585655bc3eb7ca74b8d1078f4f06

See more details on using hashes here.

File details

Details for the file holovec-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: holovec-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 129.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for holovec-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0c4b77f3793f1c918cf8b6bfb427727c8daeb7565fdd8e96de50418ad44534f
MD5 7b73c5788a5ef4d93737979d560c5b0b
BLAKE2b-256 83a55c26101346eeb136165716312f3949eb76edcd14369407b193509f7ff21e

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