Vectors
A vector (or embedding) is a list of numbers generated by an embedding model to capture the semantic essence of unstructured data — text, an image, audio. The key idea: semantically similar items produce similar vectors, so you can compare meaning instead of matching exact keywords.
Similar meaning, similar vector
Two paraphrases of the same sentence, or two photos of the same object, land close together in vector space; unrelated things land far apart. That closeness is exactly what Ahnlich searches on.
"a fast red car" → [0.91, 0.12, 0.44, 0.03]
"a speedy crimson automobile" → [0.89, 0.15, 0.41, 0.05] ← close ⇒ similar
"a bowl of soup" → [0.02, 0.77, 0.10, 0.63] ← far ⇒ unrelated
How vectors flow through Ahnlich
Working with vectors is a three-step loop:
- Store — turn your data into vectors and insert them into a store. Compute the vectors yourself, or send raw text/images to an AI store and let Ahnlich embed them.
- Search — turn your query into a vector with the same model, then run a similarity search.
- Retrieve — Ahnlich ranks stored vectors by the chosen similarity metric and returns the nearest, optionally narrowed by metadata predicates.
At scale, an index keeps step 3 fast so you don't compare against every vector.
Dimension
The dimension is the length of the vector. It's fixed when you create a store, and every key you insert must have exactly that many values — a 4-dimensional store only accepts 4-number keys. The dimension is set by whatever produced the vector (your embedding model, feature extractor, etc.).
Dense vectors
Ahnlich works with dense vectors: fixed-length lists of real numbers where (nearly) every dimension carries meaning — for example, a 384-dimensional embedding from a language model. Dense vectors are semantically rich but not human-readable; a single number rarely means anything on its own.
Some systems also use sparse vectors — very high-dimensional, mostly-zero vectors where each non-zero slot is a keyword weight (interpretable, but blind to synonyms). Ahnlich focuses on dense vectors.
Match the metric to the model
Embedding models are trained for a particular notion of distance, so your similarity metric should match how the model was trained — cosine similarity for most text/vision embeddings, Euclidean or dot product where magnitude matters. Using the wrong metric quietly degrades result quality.
Example: image search
Convert each product photo into a vector that captures its visual features — shape, colour, object type. Similar images get nearby vectors, so a new photo surfaces visually similar products, and the same item is recognised across different lighting or angles — all without a single matching filename or tag.