Lexical seach | Tokenization & Embedding | Semantic & Vector Search | RAG | Agentic RAG | MCP & API | Machine/Active Learning

Tokenization & Embedding - where AI-powered information retrieval starts

 

Tokenization and embedding are processes that precede AI-powered information retrieval. They make data and information processable and comparable.

 

Scheme of Tokenizatin and Embedding for AI Retrieval Systems
Scheme for Tokenization & Embedding in AI driven Retrieval Systems

Tokenization

Within a dataset, word and number components are identified and counted. These units are called tokens.

Each unit is assigned a numerical token ID. In this example, the token "App" always has the ID 1281. Additionally, each token is assigned a random vector.

Embedding

Learning similarity

The model training now begins using the data. When it comes to semantic proximity, it becomes (statistically) apparent in data from forum posts, for example, that apples and pears are related. They appear, for instance, in the context of recipes, edible plants, fruit trees, or statistics ("don't compare apples and pears" [a German saying]). The model learns that apples and pears can be related by filling in gaps in texts with the correct word or by matching sentence pairs.

Adjusting weights

Based on this information about the proximity of apples and pears, the model performs countless calculations on each vector until the vectors become similar and move closer to one another. This process is called weight adjustment. It is the actual training process, during which the weights associated with the individual vectors are optimized. This results in a new vector for the token, which subsequent processes (e.g., retrieval) are based on.