Lesson 08: Embeddings as numerical representations of text
When do you shut and closing time use different wording, yet you recognize the connection. Helping search find such connections is a good entry point for embeddings.
You do not need to calculate a vector yet. First consider why search needs another representation of text.
Give text a comparable representation
Map coordinates let you compare locations. Embeddings represent text with numerical vectors so systems can compare features. This is an analogy: vectors often have many dimensions, and individual dimensions are not readable labels for borrowing or opening.
A common workflow stores passage embeddings, embeds the query compatibly, and finds similar candidates. Compatibility matters: unrelated models’ numbers cannot be assumed comparable in one space.
How long can I keep a book may retrieve B’s fourteen-day loan rule despite different terms. Results depend on model, language, and task; numbers, negation, and similar old versions can cause mistakes.
Similar passages may answer different questions
For pushing a return date back, both B’s fourteen days and C’s seven days discuss time. B concerns the original loan; C the renewal extension. A relevant-looking B cannot establish extension duration.
The library offers renewals and eligible books get one seven-day renewal share a topic, but only the latter establishes frequency and duration. Topic resemblance alone is insufficient.
A similarity score is not a correctness percentage. It measures closeness under a representation and method; versions, conditions, and support still need checking.
Classify meanings without numbers
Group three closing-time phrasings, then write paraphrases for loan period and renewal, mapping them to A, B, and C. Add a similar-topic pair that is not interchangeable, such as current and historical limits.
This manually illustrates the purpose of semantic retrieval without running an embedding model. Distinguish related meaning from the same applicable answer before dealing with scores.
A way to check
Ordinary hours need A, original loan periods B, and renewal C. B/E share a topic, but current limits need B and historical comparison can need both. Semantic proximity does not resolve versions.
Further reading: Sentence Transformers: Quickstart
← Previous · Learning plan · Fictional library practice sources · Next →