Embedding
An embedding is a dense numerical vector — an ordered list of floating-point numbers — that encodes the semantic meaning of a piece of data such as a word, sentence, image, or audio clip. The key property of a good embedding space is that similar items map to vectors that are geometrically close together, while dissimilar items map to distant vectors. This is learned during training by exposing the model to vast quantities of data and adjusting the vectors until the geometry reflects meaningful relationships.
Think of it like placing every word in a city, where synonyms live on the same street, related concepts occupy the same neighbourhood, and antonyms are across town. Once you have that map, finding "similar to X" is just a matter of measuring walking distances.
A typical workflow using the OpenAI embeddings API looks like this: you send a string to the API and receive back a 1,536-dimensional vector, which you store in a Vector Database like Pinecone or pgvector. At query time, you embed the user's question and retrieve the stored vectors with the shortest cosine distance. This is the core retrieval step in a RAG system.
Embeddings are foundational to Semantic Search, RAG, and recommendation engines. They are produced by Transformer-based models and sit in what is called a Latent Space — a continuous representation surface the model has learned to organise. Fine-tuning a model on domain-specific data reshapes this space so that specialised vocabulary and concepts cluster more accurately.
You will encounter embeddings whenever you build semantic search, document similarity tools, classification pipelines, or any retrieval-augmented application. They are also the mechanism by which Multimodal models align text and image representations in a shared vector space.
Related Courses
Master the fundamentals of text embeddings, vector similarity search, and production vector database deployments with Pinecone, ChromaDB, and more.
ChromaDB: Local Vector DatabaseRun vector search locally with ChromaDB — setup, collections, embedding functions, persistence, and building offline-capable AI applications.
Semantic Search ImplementationBuild production semantic search — embedding pipelines, hybrid search, reranking, evaluation metrics, and end-to-end search architecture.