What are Embeddings and Vector Search?

EmbeddingVector SearchRAGLLMIndustrial AI

What is an Embedding?

An embedding turns a piece of text, an image or a signal into a fixed-length sequence of numbers (a vector). The conversion preserves meaning: two sentences with similar meaning end up with vectors close to each other.

The question is also turned into an embedding, and the document chunks with the closest vectors are retrieved. Closeness is usually measured with cosine similarity. Unlike keyword search, a question about "leaves turning yellow" can also find a paragraph titled "symptoms of chlorosis".

Its Role in RAG

In RAG systems, embeddings are the step that chooses the context given to the language model. If the wrong chunks are chosen, even the best language model answers wrongly.

Practical Notes

  • Multilingual models: a multilingual embedding model such as bge-m3 can keep Turkish and English sources in one index.
  • Chunk size: chunks that are too small lose context; ones that are too large carry irrelevant text.
  • Corpus selection: adding unrelated documents lowers accuracy; more documents is not always better.

Worked example: A Local LLM and RAG Agronomy Assistant