Glossary · AI/ML
Embedding
Also known as: embeddings, vector embedding, text embedding
A list of numbers (a vector) that represents the meaning of a piece of text, so that similar meanings end up close together in vector space.
How it is used
- Run each document chunk through an embedding model (for example
nomic-embed-textin Ollama). - Store the vectors in a vector database.
- Embed the user’s question with the same model and find the closest vectors, usually by cosine similarity.
This is the retrieval step in RAG.
Example
curl http://localhost:11434/api/embed -d '{
"model": "nomic-embed-text",
"input": "What is retrieval-augmented generation?"
}'
The response contains an array of floats, one vector per input.
Gotchas
- Vectors from different embedding models are not comparable. Re-embed everything if you switch models.
- Chunk size matters: too big blurs the meaning, too small loses context.