Optimizing foundation models
Retrieval-Augmented Generation
On their own, FMs don't know an enterprise's documents, manuals, reports, or transactions. RAG searches that enterprise data using the prompt and adds the most relevant pieces to the prompt as context, so the answer is accurate and up to date.
How it works
- Embed: an ML model turns documents, images, or audio into vector embeddings, numbers in an n-dimensional space. Related items have nearby vectors: "sea" is close to "ocean" and far from "stapler".
- Store: the vectors and their metadata go into a vector database built for fast similarity search across billions of vectors.
- Retrieve: the prompt is embedded too, and the database returns the closest matches using k-nearest neighbors (k-NN) or cosine similarity.
- Generate: the FM answers using the prompt plus the retrieved context.
AWS vector database options
- Amazon OpenSearch Service (provisioned)
- Amazon OpenSearch Serverless
- pgvector in Amazon RDS for PostgreSQL
- pgvector in Amazon Aurora PostgreSQL-Compatible Edition
- Amazon Kendra
In the AnyCompany case, the chatbot now queries a database of enterprise data and gives contextual answers.