Module 4 · Vector Databases · Lesson 9 of 34

Embeddings: meaning as numbers

How text becomes a vector, how cosine similarity compares meanings, and why it beats keyword search.

In this lesson · about 18 minutes

  • Explain what an embedding is and what its numbers capture
  • Calculate cosine similarity for two small vectors
  • Explain why semantic search finds matches that share no words

Computers compare numbers easily, but not meanings. An embedding model bridges the gap: it turns a piece of text into a list of numbers, a vector, such that texts with similar meaning get similar vectors.

  • Real embeddings have hundreds or thousands of numbers (dimensions), for example 768 or 1,536. No single number has a neat label; meaning is spread across all of them.
  • In this lesson's simulator we cheat on purpose: 6 dimensions with readable labels (Animals, Food, Technology, Money, Feelings, Travel), so you can see what is going on.
  • "My puppy is unwell" and "our vet clinic hours" share no words, but both point strongly in the Animals direction, so their vectors are close.

Worked example

Cosine similarity by hand

Three tiny 2-D vectors: A = (3, 4), B = (4, 3), C = (4, −3). Which is A more similar to?

    Step 0 of 5

    Try it · simulator

    Embeddings and semantic search

    Each article becomes a list of numbers that captures its meaning. Type a question and find the articles whose vectors point the same way.

    AnimalsFoodTechnologyMoneyFeelingsTravelHow to train a new dogOur vet clinic opening hoursBest food for a kittenFeeling lonely after moving abroadRefund for a cancelled ticketCheap flights to the beach this summerEasy pasta recipe for dinnerBread and pizza baking classHotel and airport transfer dealsReset your app passwordLaptop battery drains too fastHow to pay your invoice onlinequery

    Query vector (6 numbers)

    Anima 1.00Food 0.00Techn 0.00Money 0.00Feeli 0.40Trave 0.00

    Words with a meaning in this toy model: puppy

    Closest articles (cosine similarity)

    How to train a new dog0.98
    Our vet clinic opening hours0.90
    Best food for a kitten0.73
    Feeling lonely after moving abroad0.37
    Refund for a cancelled ticket0.05
    Keyword search finds nothing: no article shares a word with “my puppy is sick”. Search by meaning still finds “How to train a new dog”.
    Words this toy model knows

    airport, angry, app, bank, bark, battery, beach, bread, cat, charger, cheap, code, computer, cook, dinner, dog, eat, fish, flight, food, happy, holiday, hotel, invoice, kitten, laptop, loan, lonely, love, money, passport, password, pasta, pay, pet, phone, pizza, price, puppy, recipe, refund, restaurant, sad, salary, software, ticket, trip, vacation, vet, worried

    Check your understanding0 of 4 correct

    Question 1

    1.What does an embedding model produce?

    Question 2

    2.A = (1, 0) and B = (0, 1). What is their cosine similarity?

    Question 3

    3.A user searches the parts catalogue for “SKU-88213”. What works best?

    Question 4

    4.You switch to a new embedding model. What must you do with the stored vectors?

    Quiz score: 0 of 4

    Tip: answer every quiz question correctly first.

    Written by Noviq Academy in its own words. The simulators are small teaching models that keep the real idea and leave out the scale; their numbers (prices, speeds, scores) are illustrative. Model names, prices and features change quickly, so check your provider's current documentation before you build. Read-aloud uses your device's built-in voices.