What is a vector database?
The Harvard Chan AI Glossary
In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.
A vector database stores numerical descriptions of things and helps find descriptions that are similar. A database is an organized collection of information that software can search and update. A vector, in this setting, is simply an ordered list of numbers. Those numbers can represent patterns in a document, picture, sound recording or other item.
An AI model—a mathematical system that has learned patterns from examples—can turn an item into such a list. The resulting representation is called an embedding. The numbers are learned together so that useful similarities can be compared. They are not usually a list of human-readable labels such as “happy,” “formal” or “about gardening.”
Imagine a collection of help articles. One explains “ending your membership.” A reader searches for “cancel my subscription.” The articles and the question can be converted into compatible embeddings. The database looks for stored number patterns that are close to the question’s pattern according to a chosen mathematical comparison. This can find related material even when the wording differs.
“Close” is an analogy for numerical similarity, not physical distance. The items with the most similar representations are often called nearest neighbors. The database finds them by comparing numbers; it does not independently decide whether an article contains a true or complete answer.
Searching every stored item can take too long in a large collection. An index is an additional arrangement of information that helps software find candidates faster. Some indexes use approximate search: they look for very similar matches without guaranteeing that they found the mathematically closest ones. This exchanges some search accuracy for speed and lower computing requirements.
Records can also include metadata, meaning descriptive details such as a document’s date, language or owner. These details let the system restrict a search to current documents or material a particular user is allowed to read. Searching by similarity should not bypass ordinary access controls.
A vector database need not replace a conventional database. Some ordinary database products have added vector-search capabilities. Systems can also combine similarity search with exact word matching, which remains useful for names and product numbers.
A health system could use vector search to help clinicians locate clinical practice guidelines or standard operating procedures relevant to a complex case. Similarity alone would not distinguish a retired guideline from the current version or identify whether a protocol applies to pediatrics or adult care. Effective dates, approval status, department scope and access permissions must be enforced through metadata filters alongside the vector search.
Sources: pgvector — Project Documentation; Johnson, Douze and Jégou — Billion-Scale Similarity Search with GPUs (2017).
If you would like to find out more about AI and improve your leadership skills, consider the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.
AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.
For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.
Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy