Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Composites

Composites combine multiple hypervectors into higher-level conceptual structures. Each composite type uses a different combination strategy, preserving different semantics between its members.

Sparkle ✨: the primitive

Before any composite, there is the Sparkle ✨: the atomic, seeded hypervector everything below is built upon.

A raw SparseSegmented 🍑 is just a bit pattern. A Sparkle ✨ is a deterministic hypervector built from a seed of two parts:

  • the Domain β€” a semantic namespace, such as β€œanimals”, β€œrole”, or β€œcountry”;
  • the Pod β€” the individual within it: a word, a numeric seed, or a constant pre-defined by the package.

That pair seeds an underlying RNG (random number generator), which deterministically produces the vector’s offsets. The same model, domain and pod therefore yield the same Sparkle ✨ in every run and every engine, with Go, Rust, and Python bit-identical. Carrying that seed instead of the raw per-segment offsets is also a significant saving, both on the wire and in storage.

Two properties that carry the most weight:

  • The tuple of (Domain, Pod) can be treated as the unique identity for the Sparkle ✨;
  • Distinct Sparkles ✨ are always nearly orthogonal, without any central orchestration. They can be safely used as bricks for high-level construction;

This one primitive is also what the composite algebra is built from: the markers and keys in the formulas below β€” , , β€” are themselves Sparkles ✨, so every structure on this page bootstraps from the same type.

Use when: you need a stable, deterministic identity for an atomic concept, like a word, a role, an entity, or as a leaf for the composites below.

Check out code snippets from the API reference.

Set 🫧

An unordered collection of concepts.

where is a special marker (predefined Sparkle ✨) that causes the different encoding between individual element and the set .

Use when: you need to represent β€œthese things together” without order.

Check out code snippets from the API reference.

Sequence πŸ“Ώ

An ordered collection.

where is a special marker (predefined Sparkle ✨) for positional encoding.

is a special marker such that an element and the sequence are encoded differently.

Use when: order matters (e.g., words in a sentence, events in time).

Check out code snippets from the API reference.

Octopus πŸ™

A key-value structure. Each key (a string) is converted to a Sparkle ✨ and bound with its corresponding value before bundling.

Use when: you need to represent structured records with named attributes.

Check out code snippets from the API reference.

Knot πŸͺ’

The result of binding (multiplicative composition) of hypervectors.

Unlike direct bind operator, Knot πŸͺ’ keeps tracking of its members for serialization and introspection.

Use when: you need a reversible association between concepts.

Check out code snippets from the API reference.

Parcel 🎁

The result of bundling (additive composition) of hypervectors.

Unlike direct bundle operator, Parcel 🎁 keeps tracking of its members for serialization and introspection.

Use when: you need a superposition of concepts, with optional weights.

Check out code snippets from the API reference.

Dart 🎯

A one-directional reference between two hypervectors.

A Dart 🎯 is β€œthrown” from a tail T to a head H β€” the direction is semantic (T β†’ H), while algebraically the link is recoverable from either end. Dart 🎯 is the structured wrapper for the release.

Given the Dart 🎯 of :

Use when: you need a directed link β€” edges, mappings, β€œfromβ†’to” relations β€” where either endpoint can still be recovered given the other.

Check out code snippets from the API reference.

Summary

All composites follow the same contract (interface in Go and traits in Rust) and can be hierarchically nested: for example, a Set can contain Sparkles, Knots, or even other Sets.

Here are some of the important subtypes of hypervectors supported in this package:

TypeCompositionOrder?Use Case
SparseSegmentedNone β€” raw per-segment offsetsβ€”The materialized form every other type reduces to
SparklePrimitive β€” seed expansion, no membersβ€”Named atomic identities
Setset of primitivesNoUnordered groups
Sequencesequence of primitivesYesOrdered lists
OctopusKey-bind + bundleNoKey-value records
KnotBind (multiply)NoAssociations
ParcelBundle (add)NoSuperpositions, weighted or unweighted
DartReleaseDirectionalOne-directional references
LearnerOnline bundlingNoLearning distributions: frequencies, co-occurrence
PointFractional Power Encodingβ€”Positions in a continuous frame
Last change: , commit: 688700c