Skip to content

Vector Embeddings

Lists of numbers that encode the meaning of text so similar meanings sit close together, letting software match questions to answers by meaning, not words.

Also called: Embeddings · Text embeddings · Embedding vectors · Semantic vectors

Reviewed

Interactive lab

Hands on: use the controls to explore. Anything that plays on its own pauses while you are working inside it.

When do customer questions match your FAQ?

Monday · 11:00

90

Questions matched at cosine ≥ 0.80 (%)

Peak
Mon 11:00
90
Busiest day
Monday
avg 61
Best hour
11:00
avg 81

Daytime questions are routine ("track my order", "visa time") and clear the threshold; late-night messages are more varied and code-mixed, so fewer match — those need a clarifying question, a menu or a person.

0100Peak hourBest hour on average

Focus the grid and use the arrow keys (Home / End for 00:00 / 23:00), or point at a cell.

Illustrative share of inbound WhatsApp questions whose nearest FAQ clears a 0.80 cosine-similarity threshold, by day and hour. Daytime questions match well; late-night ones are more varied.

01What is vector embeddings?

Vector embeddings are numeric representations of text — or of images and audio — produced by an embedding model. Each piece of text becomes a fixed-length list of numbers (a vector, commonly a few hundred to a few thousand dimensions), positioned so that texts with similar meaning land close together. "Where is my parcel?", "order kab aayega" and "track my delivery" end up near each other even though they share almost no words.

Closeness is usually measured with cosine similarity — the angle between two vectors, from −1 to 1, where higher means more alike — or with dot product or Euclidean distance. To match a customer's WhatsApp message against your FAQ, you embed every FAQ question once, embed each incoming message at runtime and pick the stored vectors with the highest similarity. The same mechanism powers semantic search, duplicate detection, intent recognition without hand-written keyword lists, and the retrieval step of retrieval-augmented generation (RAG).

Embeddings are the representation; a vector database is where you store and search them at scale with approximate nearest-neighbour indexes. Vectors from different models — or different versions of the same model — live in different spaces and cannot be compared, so switching models means re-embedding everything. And similarity is not correctness: two sentences can be close in meaning yet need different answers, which is why bots pair a similarity threshold with a fallback.

Key takeaways

  • Vector embeddings are fixed-length lists of numbers that place texts with similar meaning close together.
  • Bots compare embeddings with cosine similarity to match a customer's message to FAQs, documents or intents, even when no words overlap.
  • Vectors from different models or model versions cannot be compared; changing models means re-embedding everything.
  • Similarity is a confidence signal, not truth: tune a threshold on labelled real messages and fall back below it.
  • Embeddings are the representation; a vector database is where large collections are stored and searched.

02Why does vector embeddings matter?

Customers on WhatsApp do not use your FAQ's wording: they write in Hinglish, misspell product names and ask the same thing a dozen ways. Keyword rules miss most of that; embeddings catch it, so a bot can find the right answer or document without hand-maintained synonym lists. For a RAG-based AI agent, retrieval quality — which depends on the embeddings and on how content is chunked — sets the ceiling on answer quality, because the model cannot use a fact it was never shown.

03Example: FAQ matching for a Jaipur travel agency

The agency embeds 220 FAQ questions about visas, packages and cancellations. A customer writes "dubai visa kitna din me milta hai?". Its nearest FAQ, "How long does a Dubai tourist visa take?", scores a cosine similarity of 0.86 — above the agency's tuned threshold of 0.80 — so the bot answers with the stored reply. "can i take my dog to manali" scores only 0.58 against its closest FAQ, about pets on bus tours, so instead of guessing the bot asks a clarifying question and offers an agent. (Scores are illustrative.)

04 · How it works, step by step

How does vector embeddings work?

  1. Step 1

    Chunk your content

    Split FAQs, policies and product data into self-contained chunks — one question-and-answer pair, or a few hundred tokens of an article — with metadata such as language, product and last-updated date.

  2. Step 2

    Embed and store

    Run each chunk through one embedding model and store the vector with its text, metadata and the model name, in a vector database or a database with a vector extension.

  3. Step 3

    Embed the incoming message

    When a messages webhook arrives, embed the customer's text with the same model. Light normalisation (extra spaces, repeated punctuation) helps; translation is usually unnecessary with a multilingual model.

  4. Step 4

    Search and score

    Find the top few chunks by cosine similarity, filtered by metadata such as product or current policy version. Keep the scores — they are your confidence signal.

  5. Step 5

    Apply a threshold

    Above your tuned threshold, answer from the top match or pass the chunks to the LLM. Below it, ask a clarifying question, show a menu or hand off. Tune on labelled real messages, not guesswork.

  6. Step 6

    Re-embed on change

    Re-embed chunks whose content changes. When you change embedding model, re-embed everything into a new index and switch over in one step.

05Vector embeddings in code

import numpy as np
# Built once, offline: one vector per FAQ question, all from the same model.
faq_texts = [
"How long does a Dubai tourist visa take?",
"Can I cancel a holiday package?",
"Are pets allowed on bus tours?",
]
faq_vecs = np.array([embed(t) for t in faq_texts]) # embed() = your provider's call
faq_vecs /= np.linalg.norm(faq_vecs, axis=1, keepdims=True) # unit length
THRESHOLD = 0.80 # tune on labelled real messages for YOUR model
def match(message: str):
q = np.asarray(embed(message))
q = q / np.linalg.norm(q)
scores = faq_vecs @ q # cosine similarity, since all vectors are unit length
order = np.argsort(scores)[::-1]
best, second = scores[order[0]], scores[order[1]]
if best < THRESHOLD or best - second < 0.03:
return None, float(best) # low or ambiguous: clarify, show a menu or hand off
return faq_texts[order[0]], float(best)

Normalise once so cosine similarity is a dot product, then require both a minimum score and a clear gap over the runner-up.

06 · Common mistakes, and the fix

Common mistakes with vector embeddings

  • Mixing models

    Vectors from two models, or two versions of one model, are not comparable, and the similarities between them are meaningless. Store the model name with each vector and re-embed everything when you switch.

  • Copying someone else's threshold

    Similarity scales differ between models: a 0.8 that works for one may be too strict or too loose for another. Tune on a few hundred labelled real messages.

  • Poor chunking

    Chunks that mix three topics match everything weakly, and tiny fragments lose their context. Make each chunk answer one question and carry its own heading.

  • Ignoring code-mixed text

    If the model handles Hinglish or Tamil poorly, matching collapses on exactly the messages customers send. Test candidate models on real code-mixed traffic before choosing.

  • Trusting the top match blindly

    "Cancel my order" and "cancel my subscription" can sit close together. Use a threshold, check the gap to the second-best score, and fall back when it is small.

07 · Tips from the bench

Best practices for vector embeddings

  • Normalise vectors once so cosine similarity becomes a fast dot product.
  • Add real customer phrasings as extra vectors pointing to the same answer.
  • Log the top score for every message; the low-score bucket is your list of missing FAQs.
  • Filter by metadata (language, product, policy version) before ranking by similarity.

08Vector embeddings: key facts and limits

Form
A fixed-length vector of floats per text
Typical dimensions
Hundreds to a few thousand, by model
Similarity measure
Cosine similarity, −1 to 1 (higher is closer)
Comparable only within
One model and one model version
Uses in bots
FAQ matching, semantic search, intent detection, RAG retrieval
Threshold
Tuned per model on labelled messages — no universal value

09Vector Embeddings FAQs

What are vector embeddings in simple terms?+
They are lists of numbers that capture what a piece of text means. Texts with similar meanings get similar numbers, so software can find related questions or documents even when the words differ.
What is cosine similarity?+
It is a score of how closely two vectors point in the same direction, from −1 to 1. For text embeddings, higher means closer in meaning, and bots use a tuned cutoff to decide whether a match is good enough to answer from.
What is the difference between embeddings and a vector database?+
Embeddings are the vectors themselves; a vector database stores them and finds the nearest ones quickly. A few hundred FAQ vectors can be compared in memory, but large collections need an index.
Do embeddings work for Hindi and Hinglish messages?+
Yes, with a multilingual model. Such models can place Hindi, English and code-mixed text in one space, so "order kab aayega" can match "where is my order", but quality varies by model, so test on your own traffic.
Do I need to re-embed my content when I change models?+
Yes. Vectors from different models live in different spaces and cannot be compared, so re-embed all content with the new model and switch indexes in a single step.

From definition to your first message

InfiQ is an official Meta Business Partner. Start a 7-day free trial — no card needed — and see this running on your own number.