We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

AI-Embeddings-Based Recommendation Modes for Improved Content Matching

Vectors for textual data

Let’s imagine two points in 2D space, where X and Y axes span between -1 and +1:

  • Point A: (-0.6, 0.2)

  • Point B: (0.8, -0.4)

We can draw a vector from the origin (0,0) to each and get two vectors showing different magnitudes and directions.

  • Vector A: [-0.6, 0.2]

  • Vector B: [0.8, -0.4]

Using algebraic rules (we are especially interested in cosine similarity), we can calculate the distance between vectors, add them together or subtract from each other. Similar equations work for vectors in a 3D or, say, 5000D space (even though it is harder to visualize).

When using this principle with unstructured textual data, a piece of text (word, sentence, or article) can also be represented as a point in space. However, instead of spatial dimensions (X and Y), we measure our point against semantical criteria showing the degree (positive or negative) of a certain property. Thus, on the scale of “fruit”, the word “apple” will be rated +0.9.

Our space is multidimensional. So, our “apple” can also be +0.8 in “round”, +0.2 in “laptops”, –0.8 in “weather”... Thousands of coordinates. The set of coordinates for a vector is called “embedding.” Vectors with similar embeddings are close to each other in space (like points in 2D) or in meaning (like words, sentences, or articles).

Our data science team continually creates embeddings for each content profile using an in-house tuned embedding model. So, handling a certain query vector, we can use KNN-search that will compute the distance between this and other vectors and then return the k nearest neighbours —items most semantically similar to the query.

Scalar quantization

Scalar quantization is a data compression technique that reduces the memory footprint of high-dimensional vector embeddings by converting floating-point values into integers, typically from <span data-contrast="auto">float32</span> to int8. This transformation significantly decreases memory usage, while maintaining a balance between performance and precision. Although some precision is lost, the process ensures minimal impact on search quality, especially in large datasets. This method not only improves memory efficiency but can also enhance performance, as demonstrated through benchmarks that show faster search times with minimal reduction in precision.

Currently, there are four matching modes powered by AI where recommendations consider article vectors :

  • Behavioral.

  • Contextual.

  • Contextual/behavioral.

  • Trending/behavioral.

The advantages of the new approach include:

  • Simpler procedure, less storage required.

  • Search within the Cubes, combining keyword filtering with search using positive/negative examples.

  • Different search strategies all within the Cubes.

  • Own powerful AI-backed solution to be integrated with Piano’s other products and features.


Last updated: